Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
I did this for fun and haven't even gotten around to trying it out. I simply asked chatgpt to write a script that would allow a follower/companion. Again, I haven't even played around with it. Would it even work? Here's what it spat out. GENERATED BY CHATGPT To create a script that allows an allied NPC to follow, interact, and help the player, you can use JavaScript in your CopperCube extension. Here's a step-by-step guide on how to implement this functionality:
In this example, we assume that you have already defined the player object and the NPC object in your CopperCube scene and provided names for them (replace "PlayerObjectName" and "NPCObjectName" with the actual names you assigned to the objects). The code sets the desired distance for the NPC to follow the player (followDistance) and the movement speed for the NPC (movementSpeed). Inside the OnAnimate event handler, the code calculates the distance between the player and the NPC using the getDistanceFrom method. If the distance is greater than the specified follow distance, it moves the NPC towards the player by calculating the direction vector between them and applying movement to the NPC using the addToPosition method. You can add additional logic inside the OnAnimate event handler and elsewhere in the code to handle NPC interactions and helping the player. For example, you can detect triggers, attack enemies, play specific animations, or trigger other actions based on certain conditions. Remember to save the extension code file, build the extension, and import it into your CopperCube project. Test the NPC behavior to ensure it follows, interacts, and helps the player as expected, and make any necessary iterations or adjustments to the code. |
||||
|
I'm mainly playing with it, not as a short cut but a tool for non coders. I fully understand the script would need tweaking. I really hope the resident coding geniuses (too many to name and you know who you are :) ) have some input |
||||
|
Funny part is by the time a "non-coder" learns to "tweak" that code he will effectively be a programmer. Here's the code translated to CC. It's not a 1-for-1 translation as I didn't feel like doing a bunch of encapsulation because frankly I hate OOP. Maybe you or someone else can learn something from it. Enjoy. https://files.catbox.moe/nur176.... |
||||
|
that's pretty cool. |
||||
|
you should train the chatgpt by fully sending api refrence and a few written script so he can learn and give you coppercube js api code |
||||
|
What exactly did you tell chat Gpt to get it to spit out code that works? Every time I’ve asked it doesn't And yeah It would be cool if somebody trained chat GPT to work with Coppercube They did it with unity |
||||
|
Idontwannasignin wrote: What exactly did you tell chat Gpt to get it to spit out code that works? Every time I’ve asked it doesn't And yeah It would be cool if somebody trained chat GPT to work with Coppercube They did it with unity just copy the api refrence with all function names and tell chatgpt to learn it then send chatgpt a few code example so he can get general knowledge of what a script looks like |
||||
|
I did And I still couldn't ever get it to work |
||||
|
@Idontwannasignin You do realize I translated the code in OP's post to work inside CC, right? |
||||
|
what? I'm just saying I can't get it to work |
||||
|
Of course you can't because you don't understand programming. Learn to code and then play with AI. Or you can just keep asking it questions and maybe eventually one of the results you copy and paste will work. Good luck. |
||||
|
I know lua I'm still working out the kinks with JavaScript and coppercube API I just didn't understand what you said |
||||
|
Sure you do. Good luck. |
||||
|
why are you trying to hate on me so hard |
||||
|
I'm still playing around with it. I'm still trying to train in. Now it spits out stuff like this:
It still doesn't work. |
[ 1 2 ] Page 1 of 2 |
|