PDA

View Full Version : Healing weapon?


Darion
16th Dec 2001, 02:18 PM
How do code a weapon so when it's projectile touches a player on my team it "heals" them? So far I can only get it to not hurt them, not give them help.

Or, how do I spawn an item (when i fire a weapon) right at a player's location so they pick it up instantly?

Wormbo
16th Dec 2001, 02:40 PM
The healing is quite simple:
simulated function ProcessTouch(Actor Other, Vector HitLocation)
{
if ( Pawn(Other) != None && (insert your team check here) ) {
Pawn(Other).Health += (insert healing amount);
if (Pawn(Other).Health > (a maximum value, usually 199) )
Pawn(Other).Health = (the maximum value);
}
//insert you additional code here
}

That spawning stuff is easy, too:
function Fire(float Value)
{
//other Fire() stuff
Spawn(class'AnyItem').GiveTo(Pawn(Owner));
}

Although this works, you should change the spawn().giveto() to something longer. (Include some error detection.)

Darion
16th Dec 2001, 03:34 PM
Thank you so much!!!

If I were there, i would hug you right now!!!

Smoke39
16th Dec 2001, 04:30 PM
Send 'im a Log in the mail! All kids love Log!

EvilDrWong
17th Dec 2001, 06:37 AM
smoke, youve been hyping log quite a bit for a while now... You work for Blammo?

Smoke39
17th Dec 2001, 10:17 PM
It's Lo-og, Lo-og; it's big, it's heavy, it's wood.......
Anyone for a game of Monotony?