Deck16][ beta is there for CoD2

General chat area for anything whatsoever

Moderator: Core Staff

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 10:37 pm

I am not sure but I think the health first regenerates if the health is below 100.

Code: Select all

	player iprintln("health: " + player.health);
		player.health += 100;
		player iprintln("health2: " + player.health);
Doing some testing :D
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: Deck16][ beta is there for CoD2

Post by <LT>YosemiteSam[NL] » July 25th, 2010, 10:37 pm

In my case that would be perfect, I want the player to have a temp health of 200 (when picking up the healthpack only). That would give players a reason to go down to the ...uhm well poisonpool area.

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 10:43 pm

Ok tested it. You can set it over 100 if you take now damage no regeneration. If you now take damage and you health gets lower than 100 health will regenerate.
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: Deck16][ beta is there for CoD2

Post by <LT>YosemiteSam[NL] » July 25th, 2010, 10:48 pm

Aha so I could change rezils code from;

Code: Select all

 o notsolid();
      self waittill("trigger", user);
      if(user.health<100) 
      { //not at full health
         if(health=="big")
         {
into;

Code: Select all

 o notsolid();
      self waittill("trigger", user);
      if(user.health ==< 100) 
      { //not at full health
         if(health=="big")
         {
??

btw, if I ever see a genie I wish I was a master at scripting, then I wouldn't have to bother you guys anymore :)

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 10:56 pm

see below
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
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 11:06 pm

here with countdown for the temporary super health

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.maxhealth = 200; 
		user thread super_health(delay);
		o playsound("weap_pickup");    
		wait 10; //to prevent unlimited ammo while staying inside the trigger

		o playsound(sound);
         
		o hide();
		self maps\mp\_utility::TriggerOff();
         
		if(isdefined(delay))
			wait delay;
         
		self maps\mp\_utility::TriggerOn();
		o playsound("spawnsound");
		o show();
   }
}

super_health(delay){
	
	self endon("killed_player");
	
	if(!isDefined(delay)
		delay = 20; // 20s delay
	
	if(delay <= 0)
		delay = 20;
	
	for(i = delay; i >= 0; i--){
		
		if(player.health <= 100)
			return;
		
		if(i > 15)
			self iprintln(i + "seconds left"); 
			// you can play a warning sound here 
			// self playsound("warning"); e.g.
		
		wait 1;
	}
}
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: Deck16][ beta is there for CoD2

Post by <LT>YosemiteSam[NL] » July 25th, 2010, 11:30 pm

I get this error;

Code: Select all

bad syntax: (file 'maps/mp/_health_pickup.gsc', line 75)
  delay = 20; // 20s delay
        *
But, I removed the whole superhealth delay scripting but it still doesn't work. :?

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 11:34 pm

ah i forgot a bracket

Code: Select all

 if(!isDefined(delay))
      delay = 20; // 20s delay
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: Deck16][ beta is there for CoD2

Post by Rezil » July 25th, 2010, 11:34 pm

My code was more like the original cod1 health system. You could integrate lev's script into it too but I think it's better the way it is. It's probably not what you're looking for tho.
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: Deck16][ beta is there for CoD2

Post by waywaaaard » July 25th, 2010, 11:44 pm

here forgot to reset the health though :P

Code: Select all

super_health(delay){
	
	self endon("killed_player");
	
	if(!isDefined(delay))
		delay = 20; // 20s delay
	
	if(delay <= 0)
		delay = 20;
	
	for(i = delay; i >= 0; i--){
		
		if(player.health <= 100)
			return;
		
		if(i > 15)
			self iprintln(i + "seconds left"); 
			// you can play a warning sound here 
			// self playsound("warning"); e.g.
		
		wait 1;
	}
	
	if(player.health > 100)
		player.health = 10;
}
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: Deck16][ beta is there for CoD2

Post by Rezil » July 25th, 2010, 11:46 pm

Code: Select all

   if(player.health > 100)
      player.health = 100; //*
Fixed.
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: Deck16][ beta is there for CoD2

Post by <LT>YosemiteSam[NL] » July 26th, 2010, 8:42 am

Ok thx, I'll try it when I get home tonight.

p.s. Waywaaaard .... is it ok if a few (3) of my friends join the server tonight ?

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 26th, 2010, 11:40 am

of course - more people more fun
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: Deck16][ beta is there for CoD2

Post by <LT>YosemiteSam[NL] » July 26th, 2010, 1:40 pm

waywaaaard wrote:here forgot to reset the health though :P

Code: Select all

super_health(delay){
	
	self endon("killed_player");
	
	if(!isDefined(delay))
		delay = 20; // 20s delay
	
	if(delay <= 0)
		delay = 20;
	
	for(i = delay; i >= 0; i--){
		
		if(player.health <= 100)
			return;
		
		if(i > 15)
			self iprintln(i + "seconds left"); 
			// you can play a warning sound here 
			// self playsound("warning"); e.g.
		
		wait 1;
	}
	
	if(player.health > 100)
		player.health = 10;
}
But like I said.... I removed the whole delay script but then the healthpack doesn't get removed and you don't get 200 health ?

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

Re: Deck16][ beta is there for CoD2

Post by waywaaaard » July 26th, 2010, 2:24 pm

hm without the super_health function your 200 health won't be removed
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:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest