UGX-Mods

Call of Duty 5: World at War => Help Desk => Modding => Topic started by: cris428 on May 26, 2016, 03:00:26 pm

Title: Health
Post by: cris428 on May 26, 2016, 03:00:26 pm
Can you change your health and zombies health.
Title: Re: Health
Post by: liamsa669 on May 26, 2016, 04:03:11 pm
jep...
players:
players = get_players();
for(i=0;i<players.size;i++)
{
players[i].health = #;
players[i].maxhealth = #;
}

zombies:
_zombiemode_spawners.gsc line 10:
level.zombie_health = 150; 
Title: Re: Health
Post by: JR-Imagine on May 26, 2016, 04:47:32 pm
jep...
players:
players = get_players();
for(i=0;i<players.size;i++)
{
players.health = #;
players.maxhealth = #;
}
You mean this?
players = getPlayers(); // Fuck your utility functions :)
for( i = 0; i < players.size; i++ ) {
// Players is an array, why are you setting a variable on an array?
// Changed it to the i-th element of the array
players[i].maxhealth = 100; // Change this line
players[i].health = players[i].maxhealth;
}
Title: Re: Health
Post by: liamsa669 on May 26, 2016, 04:55:04 pm
You mean this?
players = getEntArray( "player", "classname" ); // Fuck your utility functions :)
for( i = 0; i < players.size; i++ ) {
// Players is an array, why are you setting a variable on an array?
// Changed it to the i-th element of the array
players[i].maxhealth = 100; // Change this line
players[i].health = players[i].maxhealth;
}
theres not really any diffrence... u just wanted to b cool and confussing to people who are new to scripting so u used a diffrent method of gethering player data. ohhh... shit i forgot the s :D thx 4 remembering, i wrote that right b4 i left to go to a mass 4 my school cuz... they wont allow me to graduate if i dont :'(
Title: Re: Health
Post by: JR-Imagine on May 26, 2016, 05:00:20 pm
theres not really any diffrence... u just wanted to b cool and confussing to people who are new to scripting so u used a diffrent method of gethering player data. ohhh... shit i forgot the s :D thx 4 remembering, i wrote that right b4 i left to go to a mass 4 my school cuz... they wont allow me to graduate if i dont :'(
I wanted to be cool? If by "be cool" you mean not call a utility function which literally just returns the result of getPlayers() and waste execution time, then yes, I wanted to be cool. ;) (Pro tip: Before using a utility function, check what it does to make sure it's not completely useless. :P)

I do a lot of CoD4 stuff so I forgot getPlayers() was even a thing, figured get_players() would just call getEntArray(), guess not. getEntArray() will obviously be less efficient, therefore edited my previous post.

Anyways, main point was that you were setting the variables on the array instead of the element.
Title: Re: Health
Post by: cris428 on June 01, 2016, 03:57:54 pm
Thanks so much for the response guys