Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hey there For my game, i'd prefer my enemies to be able to shoot at a bit of a longer range. They move right up to each other and shoot ppint blank. I've tried fiddling with the activation and shoot range, it doesn't change. Are there any scripts or anything that can allow them to at least stop and fire from a few metres away?? |
||||
|
Sounds like you have selected for "Shoot" to directly hit instead of using the "use scene node clone as bullet". The enemy will then shoot from a distance. |
||||
|
I have been using only 3d nodes for bullets, they still don't fire from a distance, i don't understand what's going on. Proximity based shooting seems to work, but they only target the player camera and not other nodes. |
||||
|
you can try this (from CC documentation) ccbAICommand(sceneNode, command, param) Note: This function is not available in the editor. Sends a command to an object with the behavior 'Game Actor with Health'. In this way, it is possible to make the object move somewhere, attack something, or similar. Paramers are: sceneNode: Node where this is applied to. The node has to have a Game Actor with Health behavior attached to it. command: String with the command. See below. param, Parameter for the command. See below. Possible commands and parameters for the AI are: "cancel" - AI will cancel the current action it is doing (shooting, walking etc) and start doing nothing, or start the next action which makes sense to it in the current situation (like attacking a nearby enemy). The parameter will be ignored and can be null. "moveto" - AI will move to a 3d position. The parameter needs to be a vector3d() with the 3d position where to move to. "attack" - AI will attack the enemy which is supplied as parameter. The ai will attack the enemy even if it is outside of the range of its weapon. Examples: var s = ccbGetSceneNodeFromName("man"); var otherNode = ccbGetSceneNodeFromName("soldier"); ccbAICommand(s, "attack", otherNode); Lets an AI with the name "man" attack another node with the name "soldier". |
||||
|
So does that go into a blank .js file? I'm not that good with scripts yet so i'm a little confused. |
||||
|
[URL=http://www.mediafire.com/view/27r4b6hmqzo3e6h/execute_java_script.png/file] [/URL] under the behaviors tab choose a behavior to use (before first drawing do something - or a behavior triggered by event) then go to 'special' and then to 'Execute Java Script' there you can copy and paste the script you want to use |
||||
|
Ohh so THAT'S how it works. That's really useful. Thank you! |
|