Spawnable healthpacks in CoD2

Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 1st, 2010, 10:14 pm

Waywaaaard and Rezil already helped me on this one but it doesn't seem to work.
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();
   }
}
Can someone help me out here, I'm at a loss :cry:

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 1st, 2010, 10:42 pm

How do you know you don't get 200 health?
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 1st, 2010, 11:11 pm

When I pick up the healthpack I jump into the poison pool in my map and I die after almost 4 times of hitting the hurt trigger.
And that is normal with 100 health.
+ If I devmap I can set my maxhealth to 200 but still I die exactly the same as I would with 100 health.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 1st, 2010, 11:20 pm

Will do some testing.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 2nd, 2010, 8:45 am

Is it maybe possible to adjust the damage you get, to half the value ?
Some sort of work around the health thing.

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Spawnable healthpacks in CoD2

Post by waywaaaard » August 2nd, 2010, 10:59 am

I am pretty sure that it works that you have 200 health. Just do some debugging and print out your current health. Before and after you picked up a healthpacket.
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 2nd, 2010, 11:54 am

ok i'll try that m8.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 2nd, 2010, 9:02 pm

Did testing. I was right Lev, any health above 100 gets reset to 100(you get a little breathing sound just before it resets, as though you got hurt). It works short-term though, the user just doesn't keep the health.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Spawnable healthpacks in CoD2

Post by waywaaaard » August 2nd, 2010, 9:38 pm

hmmmm how long is the duration?
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 2nd, 2010, 9:46 pm

Don't know, a couple of frames I assume.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 2nd, 2010, 10:12 pm

I noticed that too but think anything of it.
Like rezil said it's just one breath...few frames not more than a second.

Btw when you open console and type /maxhealth it says 200 (if you set it to 200 hundered) but in reality it's 100...go figure

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 2nd, 2010, 10:18 pm

I did an iprintln to print the users health the moment he gets 200 health, it does change to 200 but reverts back to 100 once I check again(different trigger).
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Spawnable healthpacks in CoD2

Post by waywaaaard » August 3rd, 2010, 10:14 am

Hm it's difficult to change the damage of weapons only for I while. (Atleast i think so) We could make a loop for 20secs that adds always 20 healthpoints to the player so it's harder to kill him.
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Spawnable healthpacks in CoD2

Post by <LT>YosemiteSam[NL] » August 3rd, 2010, 11:27 pm

That could be a good work around. I'll see i f I can figure it out.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Spawnable healthpacks in CoD2

Post by Rezil » August 5th, 2010, 7:55 pm

Hm it's difficult to change the damage of weapons only for I while. (Atleast i think so) We could make a loop for 20secs that adds always 20 healthpoints to the player so it's harder to kill him.
20 seconds = 400 health points, too much in this case. 10 seconds with every second adding 10 health points is fine imo. But again, cod2 has regenerative health so the player would heal and the whole idea falls apart.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests