Weaploss help.

PS_VITA

Active member
Hi guys,

It's my first time using weaploss and I'm unsure of why it's not working as seen in the code below:

I'm putting this on a didhit script for the player.


Code:
void main()
{
  SuperArmorOnAnim (openborconstant("ANI_FOLLOW81"), openborconstant("ANI_FREESPECIAL35"));
}

void SuperArmorOnAnim (int PAnim1, int PAnim2){
	void ent = getlocalvar("self");
	int animation = getentityproperty(ent, "animationid");

	if(animation == PAnim1 || animation == PAnim2){
           changeentityproperty(ent, "nopain", 1);
           changeentityproperty(ent, "nodrop", 1);
           changeentityproperty(ent, "weaploss", 3);
	} else {
           changeentityproperty(ent, "nopain", 0);
           changeentityproperty(ent, "nodrop", 0);
           changeentityproperty(ent, "weaploss", 0);
	}
}


Any help is much appreciated.


Thanks
 
That won't work. Technically your code takes effect, but it's too late to matter because the native weapon loss routine runs before didhit and takedamage scripts execute. You'll either have to use doattack or find another way to get the effect you're after.

DC
 
PS VITA: Is that from player's didhitscript?
Why not make a script which is run from enemy's takedamagescript instead?
Also set weaploss 3 in enemy's text and use takedamagescript to do the weapon loss instead?
 
Damon Caskey said:
That won't work. Technically your code takes effect, but it's too late to matter because the native weapon loss routine runs before didhit and takedamage scripts execute. You'll either have to use doattack or find another way to get the effect your after.

DC

Ah, so it's a timing issue.  I never used doattack, but it sounds like I might have to implement such a script for every enemy unlike my failed attempt. Thanks for the info.


[/quote]
Bloodbane said:
PS VITA: Is that from player's didhitscript?
Yes it is.  You actually helped me come up with this script a while back, when we were attempting to create a "super armor " so that when the player is performing a certain animation he can't feel pain or get knocked out. Only this time I tried adding weaploss 3 to the code.

[/quote]
Bloodbane said:
PS VITA:
Why not make a script which is run from enemy's takedamagescript instead?
Also set weaploss 3 in enemy's text and use takedamagescript to do the weapon loss instead?

It seems that both your recommendation and DC's will lead me to modify the enemies so that they avoid making the players loose their weapons whenever they hit the player for certain animations. I think I need to give this a little more thought.

Thanks guys.
 
Back
Top Bottom