setting a var null() ?

jonsilva

New member
hello
ive made a change in the killgun script to clean the entityvar num...
but I cant find out if the variable is still there or gone after using the killgun script

@cmd killgun 1 0
void killgun(int Num, int Flag)
{ // Kill bound gun based on number
    void self = getlocalvar("self");
    void Gun = getentityvar(self, Num);

    if(Gun!=NULL()){
      bindentity(Gun, NULL());
      if(Flag==1){
        damageentity(Gun, self, 10000, 0, openborconstant("ATK_NORMAL"));
setentityvar(self, Num, NULL());
      } else {
        killentity(Gun);
      setentityvar(self, Num, NULL());
      }
    }
}

in the slamstart script i know the variable is killed after using the finish script
otherwise the enemy would not bind the player after the player died all lives and continued throw credits... this without using ClearL on enemy idle...
but in the killgun script i cant find out if the entityvar Num is clean ?

@cmd finish
void finish(int Damage, int Type, int x, int y, int z, int Face)
{ // Damage as slam finisher
  void self = getlocalvar("self");
  void target = getlocalvar("Target" + self);
  int SDir = getentityproperty(target,"direction");
  int MDir;

  if(Face==0){ // Same facing?
      MDir = SDir;
  }

  if(Face==1){ // Opposite facing?

    if(SDir==0){ // Facing left?
      MDir = 1;
    } else { MDir = 0;}
  }

  if(target==NULL())
  {
    target = getentityproperty(self, "grabbing");
    setlocalvar("Target" + self, target);
  }
  if(target!=NULL())
  {
    int dir = getentityproperty(target,"direction"); //Get opponent's facing direction
    if(dir==0){ // Facing left?
      x = -x;
    }

    if(Type==1)
    {
      damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL")); // 1st Finisher
    }

    if(Type==2)
    {
      damageentity(target, self, Damage, 1, openborconstant("ATK_NORMAL9")); // 2nd Finisher
    }

    tossentity(target, y, x, z); // Toss opponent
    changeentityproperty(target, "direction", MDir);

    setlocalvar("Target"+self, NULL()); //Clears variable
  }
}
 
Why don't you use this updatescript to check the value in entity variable:

Code:
script	@script
void main()
{
    void self = getlocalvar("self");
    void Test = getentityvar(self, 1);

      drawstring(160,110,4, Test);
}
@end_script

This updatescript will display the value in entity variable 1
You can paste this right into character's text :)
 
iam not sure if the script is working
I cant see the string anywere in the monitor


made a few modification on the cords...


this is the standard
var0.jpg


in here it spawnsgun "dust"
var01.jpg


when I use the normal @cmd killgun 1 0 the string always shows the number "195044936" --- it must be overwriting the variable ?!?!

if I use this line in killgun script
setentityvar(self, Num, NULL());

the string goes back to the 1st image above "VT EMPTY UNITIALIZED" -- so maybe everything is working fine the memory block stays empty

void killgun(int Num, int Flag)
{ // Kill bound gun based on number
    void self = getlocalvar("self");
    void Gun = getentityvar(self, Num);

    if(Gun!=NULL()){
      bindentity(Gun, NULL());
      if(Flag==1){
        damageentity(Gun, self, 10000, 0, openborconstant("ATK_NORMAL"));
setentityvar(self, Num, NULL());
      } else {
        killentity(Gun);
setentityvar(self, Num, NULL()); // clears entityvar Num
      }
    }
}
 
Ah yes, I usually use killgun function in enemy and bosses text. since they are normally defeated, I assume their entity variable will be emptied too
If the function were used by players or at least entities which aren't removed often, you should clear the entity variable
 
Back
Top Bottom