eminem100 Guest |
Quote
|
2017-06-29 18:53:31 |
|
// first config part.LOL
var s = ccbGetSceneNodeFromName("soldier"); var otherNode = ccbGetSceneNodeFromName("Camera1");
// now this **** comes. // if the enemy comes to the activation area then, execute the code // cancel everything
ccbAICommand(s, "cancel"); // this line does't works, even i come to the activation range, the soldier just walks randomly till it reaches random point to where it has to go
// now keep on shooting the enemy // if the enemy dies then call other members of the troop to that area in order to make is just like real
if (Camera1.health == 0) { // if the player is dead, then call other members. call_troop(); } else {
//loop till the player dies for (; Camera1.health = 0;) { ccbAICommand(s, "attack", otherNode); } }
I don't know what is happening, can anyone please mark out the mistake here?
|
eminem100 Guest |
Quote
|
2017-06-29 18:57:02 |
|
I've added the Hash symbol (), I don't know why this is not showing in the forum.
|
3DBlendSphinx Guest |
Quote
|
2017-06-29 22:35:34 |
|
Your 'FOR LOOP' code is setting the Camera1.health to zero instead of comparing.
You have- for (; Camera1.health = 0;) { ccbAICommand(s, "attack", otherNode); }
when it should be
for (; Camera1.health>0;) { ccbAICommand(s, "attack", otherNode); }
But a better way would to be
while(Camera1.health>0) { ccbAICommand(s, "attack", otherNode); }
|
3dblendsphinx Registered User |
Quote
|
2017-06-29 23:03:22 |
|
And you are calling Camera1 versus the variable that is assigned to access it. So instead of Camera1.health>0 it should be otherNode.health>0
|