Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
How can I make objects follow player? Like our army follows us when we press a key? |
||||
|
Yes, you can use the AI command for this. Use the javascript function ccbAICommand(), and I guess there is also a downloadable action plugin for this available. |
||||
|
Where to download or what is the script? |
||||
|
Yeah I already downloaded that. It's melee attack behavior. I need: Following behavior. For better understanding i am creating friend soldier so when we press 1st key they start following us and when we 2nd key they stop following. Now understood? |
||||
|
@niko wrote: Yes, you can use the AI command for this. Use the javascript function ccbAICommand(), and I guess there is also a downloadable action plugin for this available. I searched it found about moveto. But the problem is parameter is vector3D can it be anotherNode? By creating var in that script? |
||||
|
Hello, behroz-khan! I created an example for you to show you how to make a character follow a different character! Download it here: https://drive.google.com/file/d/... When you open that CCB file with CopperCube, please press the "Publish" tab at the top, and then press the button shaped like a "Play" arrow to test the sample. When the game starts, you can do this: 1. The cube named "Hero" can be moved with the arrow keys. 2. If you press the Z button, the cube named "Friend" will follow the other cube. 3. If you press the X button, the cube named "Friend" will stop following the Hero. Study the file to discover how I did that. |
||||
|
Thank you very much! I understood the script. I was really close I was doing one mistake. Without you I was unable to do that. The name of the file a futuristic person behroz-khan Futuristic person? haha ![]() ![]() ![]() |
||||
|
FROM WHERE I DOWNLOAD THE SCRIPT TO OBJECT FOLLOW THE PLAYER |
||||
|
He didn't make a script... but he uploaded a .ccb file to show what he did. Uses "Z" and "X" key to follow a cube named 'Hero' |
||||
|
how do i make a zombie follow me |
||||
|
Really depends on how perfect it must be. Most simple is to just move him a bit towards you every frame or so. State of the art would be an A* pathfinding algorithm, that you implement in a behavior. As a start, I'd suggest to add a behavior to the zombie: in proximity (to active camera) do something, when enter proximity, start a inFrame task, and on leaving proximity you'd unregister the task //------ this And in the "leave radius" proximity behavior you would then simply: // ccbUnregisterOnFrameEvent(onFrameTask); In the whole atan2 stuff you may have to switch some things by 180 degrees, until it works. |
||||
|
link doesn't work |
|