Need help with some scripts

Joshiro

Member
Hey guys. I've been busy working on an improved angry mode that allows players to pick up weapons while in angry mode. I have it working for the most part except after picking up the weapon, none of it works except keeping changed color palette.  I also don't want the player to lose weapon while hit in angry mode. I tried changing the weapon loss using script but none of it works. I'm sure their are better ways to script this, but I'm still learning. I have all this in the default player model.

In my player spawn animation.
Code:
 @script
setglobalvar("angry", 0);
@end_script

pain;
Code:
@script	
    void vSelf = getlocalvar("self");
    int MHealth = getentityproperty(vSelf,"maxhealth");
    int Health = getentityproperty(vSelf,"health");
    int Limit = getentityvar(vSelf, 2);
	int angry = getglobalvar("angry");

    if(Health <= MHealth/2 && Limit!=10 && angry== 0  ){
      changeentityproperty(vSelf, "velocity",0,0); // can be omitted if used in IDLE
      performattack(vSelf, openborconstant("ANI_FOLLOW1"));
    }
	@end_script

follow1;
Code:
@script
	void self = getlocalvar("self");
	getentityproperty(self, "map");
    if(frame==1)
	{
	setglobalvar("angry", 1);
      setentityvar(self, 1, openborvariant("elapsed_time"));
 	changeentityproperty(self, "defense", 70);
	changeentityproperty(self, "nopain", 1);
	changeentityproperty(self, "nograb", 1);
	changeentityproperty(self, "nodrop", 2);
	changeentityproperty(self, "speed", 1.2);
	changeentityproperty(self, "running", 1.7);
	changeentityproperty(self, "map", 1);
	}
	@end_script

idle;
Code:
@script
    void self = getlocalvar("self"); //Get calling entity
    int angry = getglobalvar("angry");

    if(angry==1)
	{
	setentityvar(self, 1, openborvariant("elapsed_time"));
 	changeentityproperty(self, "defense", 70);
	changeentityproperty(self, "nopain", 1);
	changeentityproperty(self, "nograb", 1);
	changeentityproperty(self, "nodrop", 2);
	changeentityproperty(self, "speed", 1.2);
	changeentityproperty(self, "running", 1.7);
	changeentityproperty(self, "map", 1);

      set_entity_property(self, "alternate_idle", 2);
    }
@end_script

idle2;
Code:
@script
    void self = getlocalvar("self"); //Get calling entity
    int angry = getglobalvar("angry");

    if(angry==0)
	{
      set_entity_property(self, "alternate_idle", 1);
    }
@end_script

@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);
    if(Summon <= openborvariant("elapsed_time") - 3000)
	{
      setentityvar(self, 1, NULL());
      setglobalvar("angry", 2);
 	changeentityproperty(self, "defense", 0);
	changeentityproperty(self, "nopain", 0);
	changeentityproperty(self, "nograb", 0);
	changeentityproperty(self, "nodrop", 0);
	changeentityproperty(self, "speed", 1);
	changeentityproperty(self, "running", 1.5);
	changeentityproperty(self, "map", 0);
	set_entity_property(self, "alternate_idle", 1);
	}
@end_script

walk and run;
Code:
@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);
    if(Summon <= openborvariant("elapsed_time") - 3000)
	{
      setentityvar(self, 1, NULL());
      setglobalvar("angry", 2);
 	changeentityproperty(self, "defense", 0);
	changeentityproperty(self, "nopain", 0);
	changeentityproperty(self, "nograb", 0);
	changeentityproperty(self, "nodrop", 0);
	changeentityproperty(self, "speed", 1);
	changeentityproperty(self, "running", 1.5);
	changeentityproperty(self, "map", 0);
	set_entity_property(self, "alternate_idle", 1);
	}
@end_script

Than in weapon model I have this in idle animation:
Code:
@script
    void self = getlocalvar("self"); //Get calling entity
    int angry = getglobalvar("angry");
	getentityproperty(self, "weaploss");
    if(angry==1)
	{
	setentityvar(self, 1, openborvariant("elapsed_time"));
 	changeentityproperty(self, "defense", 70);
	changeentityproperty(self, "nopain", 1);
	changeentityproperty(self, "nograb", 1);
	changeentityproperty(self, "nodrop", 2);
	changeentityproperty(self, "speed", 1.2);
	changeentityproperty(self, "running", 1.7);
	changeentityproperty(self, "map", 1);
	changeentityproperty(self, "weaploss", 1,1 );
     	set_entity_property(self, "alternate_idle", 2);
    }
@end_script

Idle2;
Code:
@script
    void self = getlocalvar("self"); //Get calling entity
    int angry = getglobalvar("angry");

    if(angry==0)
	{
      set_entity_property(self, "alternate_idle", 1);
    }
@end_script

@script
    void self = getlocalvar("self");
    int Summon = getentityvar(self, 1);
    if(Summon <= openborvariant("elapsed_time") - 3000)
	{
      setentityvar(self, 1, NULL());
      setglobalvar("angry", 2);
 	changeentityproperty(self, "defense", 0);
	changeentityproperty(self, "nopain", 0);
	changeentityproperty(self, "nograb", 0);
	changeentityproperty(self, "nodrop", 0);
	changeentityproperty(self, "speed", 1);
	changeentityproperty(self, "running", 1.5);
	changeentityproperty(self, "map", 0);
	changeentityproperty(self, "weaploss", 0,1 );
	set_entity_property(self, "alternate_idle", 1);
	}
@end_script


 
Maybe it would be easier to make an "angry" version of each weapon and use script that switches regular weapon with angry mode? That's about all I can think of since for some reason I can't change properties using script in a weapon model.
 
Back
Top Bottom