special features during slams

NED

Well-known member
Hello,

I would like to implement some "new" features in some of my slams.

-Is there a way for a player to spawn an entity when enemy is killed by a particular slam? Right after  @cmd    finish or  @cmd    throw

-Something else : I would like player to play a random sound during few slams
Just like in Beastie's Random sound script:
http://www.chronocrash.com/forum/index.php?topic=1359.0
But only if enemy is killed by this move

I precise player lasts a little time without changing anim after releasing enemy.
So there is certainly a way to put the script during this end moment.

Is it possible?
Any help is welcome.
 
there is a very fast way to do it it will run even if the player is in a fall animation...
but I don't know if it will work I haven't tested it

you need to put script in the entity.txt file instead of animations script

script @script
void main()
{
    float slamgo = getscriptvar(self, slam)
    void self = getlocalvar("self");
    void hp = getentityproperty(target,"health");
if(hp <=0 && slamgo == 1){
    performattack(self, openborconstant("ANI_FOLLOW10"));
    }else if(hp <=0 && slamgo == 2){
    performattack(self, openborconstant("ANI_FOLLOW11"));
    }else if(hp <=0 && slamgo == 3){
    performattack(self, openborconstant("ANI_FOLLOW12"));
    }
}
@end_script



anim attack1
@script
void self = getlocalvar("self");
setscriptvar(self, slam, 1);
@end_script
loop 0
delay 9
offset 100 189
bbox 79 97 50 91
frame data/chars/guy1/a01.gif
frame data/chars/guy1/a01.gif
frame data/chars/guy1/a01.gif
frame data/chars/guy1/a01.gif
frame data/chars/guy1/a01.gif

anim attack1 - can be the animation slam the player or enemie is making
but it will change to a fallow anim that can spawn an entity 

you can change this part (self, slam, 1); to 2 / 3/ 4... in the slam animation to change to follow10/11/12.....

if this part works making it spawn right after @cmd  finish or @cmd throw its very easy

-----------------//------------
you can just use this script after @cmd finish... it will spawn if the opponent is killed

void spawndead(void Name, float dx, float dy, float dz)
{ // spawn entity with if target is killed
void self = getlocalvar("self");

void target = getentityproperty(self, "opponent");
int hp = getentityproperty(target,"health");
void Spawn;
    if(hp<=0){
Spawn = spawn01(Name, dx, dy, 0);
}else {
    killentity(Spawn);
      }
}

@cmd spawndead "dust" 1 1 10
 
Thanks a lot! :)

The "spawndead" worked very well!
I used it to spawn an empty entity that uses Beastie's sound code.


But I'm not sure to understand well the 1st script.
Can it be used by player to detect if enemy is killed?
Or
The entity checks it's own life level?
 
But I'm not sure to understand well the 1st script.

the 1st is wrong I was doing something else then came up with that script

Can it be used by player to detect if enemy is killed?
unfortunately no... I don't think the player can do a (find a target) very well because is not controlled by AI... it must use getentityproperty(self, "opponent") to check the last hit opponent then the target is there with his health to the pick up.

but to make it work you just need to replace the line
void hp = getentityproperty(target,"health");
with
void target = getentityproperty(self, "opponent");
  int hp = getentityproperty(target,"health");

but forget about the 1st script it works better this way
void animdead(void Ani)
{ // goes to animation if current opponent is killed
  void self = getlocalvar("self");
  void target = getentityproperty(self, "opponent");
  int hp = getentityproperty(target,"health");
  void Spawn;
    if(hp<=0){
changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
  }
}

@cmd animdead "ANI_FOLLOW3"

if you used it itsbest if you make the 2 scripts spawndead and animdead into 1 or you can end up with a lot of script junk... 


 
Thanks again for sharing some of your knowledge
I'll try to use it on my system.

I might ask some advice about it later.
But the tests were really fuctional :)
 
Back
Top Bottom