Medic

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Try this out tested in game . the distance was too small for the vector_within

Code: Select all

health_thread:

while(1)
{
   for(local.i=1;local.i<=$player.size;local.i++)
   {
     if($player[local.i].health < 100 && $player[local.i].hasmodel != 1)
     $player[local.i] thread waitheal

   }
waitframe
}
end

waitheal:
self.hasmodel = 1

self attachmodel models/items/item_100_healthbox.tik "Bip01 R Forearm"

while(self.health < 100 && isalive self)
{

	for(local.i=1;local.i<=$player.size;local.i++)
	{

	if($player[local.i] != self)
	{

		if(vector_within $player[local.i].origin self.origin 125 && $player[local.i].useheld == 1 && $player[local.i].dmteam == self.dmteam)
		{

			self fullheal
			self playsound dfr_M1L2_thankyou
			$player[local.i] iprint "YOU GET FULL HEALTH + 1 GRENADE FOR HEALING A TEAMMATE."
			$player[local.i] fullheal
			$player[local.i] ammo grenade 1

		}

	}
	}

	waitframe
}

self.hasmodel = 0

self removeattachedmodel "Bip01 R Forearm"

end
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

Grassy wrote:
and I changed the vector_within from 100 to 25. Now, healing does not happen at all. Have a look.
All looks ok, mybe 25 is too short?
Grassy
Haha this look familiar fellas?
Grassy
An ambiguous question will get a similar answer...
User avatar
MPowell1944
Moderator
Posts: 287
Joined: Thu Jan 09, 2003 7:06 am
Location: Woodstock, GA
Contact:

Post by MPowell1944 »

25 isnt too short b/c it worked with that.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

In my ingame test 25 did not work very well you almost have to go up and kiss them at that distance for my test as I remember it didn't work.
Image
Post Reply