Just chasing an enemy with a specific name to attack

xyz555

Member
[size=8pt]Is there a script of  this can make the
Attack props only just chase an enemy with a specific name to attack ?

(But it will not attack at all, enemies of other names .)

Thank your guidance
[/size] :) :) :)
 
xyz555 said:
[size=8pt]Is there a script of  this can make the
Attack props only just chase an enemy with a specific name to attack ?

(But it will not attack at all, enemies of other names .)

Thank your guidance
[/size] :) :) :)



I want to let the
Attack props take the initiative to chase an enemy with a specific name, but it will not chase other enemies with different names at all.
Thank your guidance[/size][/size] :) :) :)
 
Hmmm.... if you want to create homing missile which targets specific entity, it could be simple
But if you want to create regular enemy which hunts certain player, it could be more complex
 
Bloodbane is right, attacking specific name is quite simple but you gave too vague description.
attack props? chase?
what you want to do exactly, how attack looks like, whos attacming , npc , player? you control him during attack or its automatic ?
i think id change player candamage to npc obstacles only and change this one enemy that you want to hurt to npc so enemy types wont be hurt.

some properties to use
Code:
@script
    void self = getlocalvar("self");
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");

    void vEntity;                                       //Target entity placeholder.
    int  iEntity;                                       //Entity enumeration holder.
    int  iName;                                         //Entity name.
    int  iMax      = openborvariant("ent_max");         //Entity count.

    float Tx;
    float Tz;
    float Disx;
    float Disz;

    if(frame == 0){
      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target name

        //Sign?
        if(iName == "Sign" && vEntity!=self){
          Tx = getentityproperty(vEntity, "x");
	  Tz = getentityproperty(vEntity, "z");
          Disx = Tx - x;
          Disz = Tz - z;

          if(Disx >= -12 && Disx <= 12 && Disz >= -25 && Disz <= -15)
          {
            performattack(self, openborconstant("ANI_FOLLOW1"));
          }
        }
      }
    }
@end_script
 
First of all, thank you for your guidance,
I actually hope to create a regular enemy that can hunt down certain players (names), and it will only keep chasing. (But this regular enemy is never chasing players with other names) :)


My English is not very good. Sorry, but thank you very much for your help, thank you!!! ;)
 
I would just make player with this name his parent and enemy wiould chase parent
hostile none
 
I still wonder why you'd need such enemy xyz555. The answer could give better understanding on how to code this enemy

But anyways, I've coded AI for that enemy. It works great but might need some codes to stabilize it  8)

bWWd said:
I would just make player with this name his parent and enemy wiould chase parent

That might work, though the enemy won't attack player unless he/she is using script to attack
 
Bloodbane said:
I still wonder why you'd need such enemy xyz555. The answer could give better understanding on how to code this enemy

But anyways, I've coded AI for that enemy. It works great but might need some codes to stabilize it  8)

bWWd said:
I would just make player with this name his parent and enemy wiould chase parent

That might work, though the enemy won't attack player unless he/she is using script to attack



First of all, thank you very much for replying to my post, because my game , there is a place where an entity must chase a protagonist with a fixed name (but this entity will never chase a protagonist with a different name), if With such a scripted game, it can be more complete. Thank you :) :) :)
 
xyz555

it think the solution is a combination of what Malik's story system does
http://www.chronocrash.com/forum/index.php?topic=4690.msg66867#msg66867 & for the most part what bWWd has described.

that story system seems to be able to take into account the name of a player & do script accordingly

the story system portion spawns an enemy that matches your specific player, if he is present, if not it spawns a  different enemy that does no do that action , but does standard actions & the bwwd portion of the code allows it to act like you want, if the code "detects" your specific player.


I hope you can pull this off & share
 
Thank you very much for your help Bloodbane, this is very useful, and I am very grateful too. Thank you!!! ;) ;) :) :)
 
Back
Top Bottom