ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Announcements and Showcase
forum topic indicator Pet follow
person icon
o139
Registered User
Quote
2024-01-03 14:33:38

Here is a pet follow script if anyone need it.. just put it on pet every 3000ms execute javascript

note both the player and pet must have actor behavior

note you must change the name dragon1 and player1 to your own name nodes

dragon = ccbGetSceneNodeFromName("dragon1");
pos1 = ccbGetSceneNodeProperty(dragon, "Position");

player = ccbGetSceneNodeFromName("player1");
pos2= ccbGetSceneNodeProperty(player, "Position");

distance = pos1.substract(pos2).getLength();

if(distance>10){
ccbAICommand(dragon, "moveto", new vector3d(pos2.x, pos2.y, pos2.z));

}



its possible to invert the distance to get a moveto player when range is <x meters.. behavior

happy coding and cheers!!

person icon
andgameplay
Registered User
Quote
2024-01-03 16:52:43

Thanks for share 0139, you are very good coder!

person icon
o139
Registered User
Quote
2024-01-03 21:03:43

your welcome and thanks for saying that..

person icon
blackwater
Registered User
Quote
2024-01-04 12:43:46

Thanks for sharing that! Will surely be to good use for many of us :D

person icon
o139
Registered User
Quote
2024-01-04 13:55:59

your welcome blackwater! and glad you think so.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |