Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Does anyone have a glue why the following action script crashes in CC when used with "When a key is pressed do something" ?
If I use the following "Execute Javascript" instead of having executed the action script it works but with error "Could not get property, provided scene node is invalid":
Maybe I missed something with the AI requirements? Thanks for any help. |
||||
|
If I had to take a guess would be the possible conflict between "this.npc" and "npc" variables in the first. I would not use the same name, see if when you change makes any difference. |
||||
|
Thanks @Robo for the idea. After following your advice, it unfortunately still crashes. |
||||
|
there are a few mistakes in your script code as I can see. you are using ccbGetSceneNodeFromNamein a wrong method. while you don't have to use this code at all. if you ever wish to use that code, then you can't use it with properties of the action like you are using this.npc and this.Targetyou need to use the name of actual object from the editor in string format like this "cubeMesh1 so instead of using ccbGetSceneNodeFromName(this.npc);use ccbGetSceneNodeFromName("npc"); however if you are using property as a type of "scenenode" then you actually don't have to use the above command to get the name of the scenenode. you can directly call an object or change its properties by using this.propertynameproperty should be a type of scenenode. then you can simply use this command to get the position of an object var targetpos = ccbGetSceneNodeFromName(this.Target,"Position"); there is no need to call the object by name simply use the property type. so this makes the whole code corrupted and you get an error could not get the property because you are calling the object in the wrong fashion. here is how the final script should goes:-
hopefully, this should work. let me know if this don't works. |
||||
|
Thanks for the helpful lesson @just_in_case! Now the scripts works totally fine. Among other experts you're a blessing here, coffee-supported you back ;-) |
||||
|
Thanks a lot @ Hadoken 😇 thats really gonna help😇 |
|