I can "pick up" the healthpack with the script below but it doesn't give me 200 health.
I don't think the command should be maxhealth but something different (tried self.health and givehealth, but those also don't work)
Code: Select all
setupitemForPickup(item_name, item_xmodel, soundalias, delay)
{
precachemodel(item_xmodel);
   trig = getentarray("item_pickup_" +item_name,"targetname");
   org = getentarray("item_origin_" +item_name,"targetname");
   if(org.size == trig.size) //same ammount of origins and triggers, otherwise you get errors
   {
      for(i=0;i<org.size;i++)
      {
         trig[i] thread itemPickup(org[i], item_name, item_xmodel, soundalias, delay);
         
      }
   }
}
itemPickup(o, item, xmodel, sound, delay)
{
   for(;;)
{
   
      o setmodel(xmodel);
      o notsolid(); //already true, just not sure about all script_models
      self waittill("trigger", user);
      self.health = 200;
      
      o playsound("weap_pickup");    
        
      o hide();
      self maps\mp\_utility::TriggerOff();
      wait 10; //to prevent unlimited ammo while staying inside the trigger
      
      if(isdefined(delay))
         wait delay;
         
      self maps\mp\_utility::TriggerOn();
      o playsound("spawnsound");
      o show();
   }
}
 
														
 
														 
														