Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi this is a basic AI. Very very basic. Follow character when is visible and shot or make som action when in range. Here a boring video to show.. https://www.youtube.com/watch?v=... If this help i send you the behavior script.. is super basic. please NIKO , i love coppercube please clean visualization bugs . |
||||
|
https://drive.google.com/open?id... Behavior |
||||
|
Very useful, thanks i ve added some more functions… checking node health switch between walk and attack animations. // This is a coppercube behavior AI // The following embedded xml is for the editor and describes how the behavior can be edited: // Supported types are: int, float, string, bool, color, vect3d, scenenode, texture, action /* <behavior jsname="behavior_AI" description="Basic AI - AGRESSIVE"> <property name="attack_node" type="scenenode" /> <property name="attack_radius" type="int" default="100" /> <property name="attack_action" type="action" /> <property name="attack_interval" type="int" default="500" /> <property name="step_before_fire" type="int" default="5" /> </behavior> */ behavior_AI = function() { // settings: this.attack_node = this.attack_node; this.attack_radius = this.attack_radius; this.LastTime = null; this.LastPosition = new vector3d(0,0,0); this.stepcounter =0; this.firecounter=0; this.step_before_fire=this.step_before_fire; }; behavior_AI.prototype.onAnimate = function(n, timeMs) { var targetPos = ccbGetSceneNodeProperty(this.attack_node, 'Position'); var currentPos = ccbGetSceneNodeProperty(n, 'Position'); var name=ccbGetSceneNodeProperty(n, 'Name'); var health=ccbGetCopperCubeVariable("(hashtag)+name+".health"); if (health == 0 ) return false;// AI must be died, return.. if ( ( timeMs - this.LastTime) > this.attack_interval ){ var distance = Math.sqrt( Math.pow( parseInt(targetPos.x-currentPos.x) ,2) + Math.pow( parseInt(targetPos.y-currentPos.y) ,2) + Math.pow( parseInt(targetPos.z-currentPos.z) ,2) ); if ( distance < this.attack_radius ){// moving towards attack node.. if (this.firecounter ==0) { ccbAICommand(n, "cancel"); ccbAICommand(n, "moveto", targetPos); this.stepcounter++; } else this.firecounter --; // wait until attack anım ends... } else { // may be random patrol... } if ( this.stepcounter>this.step_before_fire){ // start attack and wait attack anımation ccbAICommand(n, "cancel"); ccbAICommand(n, "attack", this.attack_node); ccbInvokeAction(this.attack_action); this.stepcounter=0; this.firecounter =1; } this.LastTime = timeMs; } return false; } |
||||
|
"...checking node health switch between walk and attack animations..."" Wow nice improvements, i like!!! ;) |
||||
|
Impressive!! |
||||
|
Jaime Zegpi...Thought you had left the community. There are a couple of people looking for you as you built a multiplayer script and abandoned the development before producing the key elements of the system... When will you be able to finish it? Your website went down over a year ago... Please can you finish it and release it to the community |
||||
|
Hi Zoo here you can test. https://jaime.zegpi.cl/lab/coppercube/multinverso/scene/ ( open two windows , one normal and other private ) You can download from here. https://github.com/jaimezegpi/multinverso Please this is only test i made in my boring time.. change as you like. A multiplayer Script need be made by Niko, here have more experience and knowledge about his engine. |
|