unbind slam on zero hp

jonsilva

New member
hello
iam trying to unbind a slamstart2 once the target health reaches 1 or 0
but It doesn't seem to work... the enemy keeps looping the slam...

iam trying with an updatescript in entity header
script @script
void main()
{
  void self = getlocalvar("self");
  void target = getlocalvar("Target" + self);
  void hp2 = getentityproperty(target,"health");
  if ( hp2 <= 1 ){
bindentity(target, NULL());
}
}
@end_script

#performattack(self,openborconstant("ANI_FOLLOW5"));
#changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
        #bindentity(target, NULL());
ive also tried changing to an animation so I could use depost/finish but it doesn't change...
Is there a way to unbind a slam once the target health reaches 0
making the target then play death animation ?

I think the problem is that it cant check target hp2 health
ive used a similar script in the grabbed oponnent to play a follow2(death) once its health reaches 1 and worked...
 
Hmmm.... it's tough to spot the problem

BTW IIRC for some reason local variables can't be read by updatescript. I had to change the variables to entity variables to make it readable by updatescript

Also how does your function which do the unbinding look like?
 
thanks
ive manadge to get it working by using the script on the slamstart2 animation (follow3) into goes to follow5 witch then makes the depost and finish...
Code:
anim	follow3
@script
   void self = getlocalvar("self");
   void target = getlocalvar("Target" + self);
   int hp2 = getentityproperty(target,"health"); //Get target's health
   if ( hp2 <= 1 ){
	changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW5"));
	}
@end_script
	loop	1 2 22
	delay	5
	offset	340 335
	bbox	280 60 120 150 20
	attack	0 0 0 0
	@cmd	slamstart2
	@cmd	position 0 1160 0 -87 -1
	frame	data/chars/beyond/3giant/tramgb06.gif
	frame.............
	@cmd	hurt2 110
	frame.............
the script its for a slam on a tram...
a while back you could see the video of how is it working on the AOF trouble in south town game post...
but Ive just removed the video...
for some reason whenever I post a video in this forum someone will go to my youtube page and makes a dislike on my videos....
and don't know why this happens but I notice it also happens on videos others users post...
this things take so much time to get everything right coordinates / level spawn offsets positions / etc... I mean the person could give an opinion of what it doesn't like but just clicking the dislike button for no reason... hhhhuuuuuffff...!!!
 
Back
Top Bottom