UGX-Mods
Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: DeletedUser on December 30, 2020, 11:41:29 pm
-
EDIT: SOLVED!
im trying and failing to figure out how to add player health.
health starts at 100 for example and goes down 1 every second with player_health--; in a loop and then i can add health by purchasing "food". problem im having which is the same problem i have with the generator script im working on also is that scripts are linear so whilst its in a loop to check/countdown/knock off player health it wont let me add to it. as its locked in the loop. apparently there may be a background global variable that constantly checks things like PH = player hits. yet i cant find that file. i need to be able to have the generator fuel go down each second, same with player health But at the same time be able to add fuel/health. yet this seems impossible so have to "thing/scripts" looping/checking side-by-side
any help on how i can achieve this will be appreciated.
also i am trying to figure out how to turn the power off (once turned on). ive had a look in many raw gsc files but i cant find it. doesnt help that i dont reli know what to specifically look for. any help on this matter will also be greatly appreciated.
many thanks in advance.
-
Just change the player maximum health of the player: "self.maxhealth"
self.health is always recovering to the maximum health.
-
Just change the player maximum health of the player: "self.maxhealth"
self.health is always recovering to the maximum health.
thank you but im trying to set it so its like a on screen timer displaying something like (Health [100]) - on game start. and it starts going down by 1 every second and when it hits 0 the player dies. and to stop it from hitting 0, the player would have to find and purchase food. in which i would build a food machine for that.
what uve mentioned (if ive understood it correctly) is that player health will constantly auto recover itself, whereas i am looking for it to auto deteriate. but not the players "actual health" as i dont want zombies hits to have any affect on this feature. im aiming to create merely a countdown timer, in which i would be able to set what it starts at on game start and how quick it goes down. and they would simply have to stop it from hitting 0.
-
Sounds like a second kind health bar, you need to make your own variable to keep the value.
You can make a whileloop or a waittill trigger to check if the player does not have eaten enough and is starving to death.
When that happens do a "radius" (look up script reference) damage on the player and the rest I think will run smoothly.
-
Sounds like a second kind health bar, you need to make your own variable to keep the value.
You can make a whileloop or a waittill trigger to check if the player does not have eaten enough and is starving to death.
When that happens do a "radius" (look up script reference) damage on the player and the rest I think will run smoothly.
i had a look at the radius damage just now and i dont think thats something im looking for. (i may be wrong). im hoping to build a simple countdown timer that you have to stop from hitting 0 by purchasing food.
best i can come up with is, using iPrintLn on game start to say ( Your health 100 ) & then have player_health--; in a loop to knock 1 off every second which is what im looking for & im sure ill eventually figure out how to kill the player when it hits 0. the issue im having with this approach is when i set player_health = 10; & then loop player_health--; it never hits 0. (i think) its going from 10 to 9, then back to 10, and so forth.
when playing around with the generator i done-
current_fuel = 0;
if(current_fuel < 50) *to set the limit*
then on purchase-
current_fuel = current_fuel + 10; & then-
if(current_fuel > 0)
while(1)
{
current_fuel--;
iPrintLnBold("test");
}
and i saw the msg "test" pop up every second, ten times. which is great. but coz of the loop i was not able to then keep on purchasing.
doing this-
if(current_fuel > 0)
while(1)
{
current_fuel--;
iPrintLnBold("test");
}
is the only way i can think of getting it to constantly "check & reduce". which it does nicely. but yh i cant do something else at the same time. ik the loop is why i cant. & that script are linear. but i was hoping theres a method that can work side-by-side or penetrate/update the loop or something like that
so i tried a rough same approach with player health but with health being set to 10. but yh it never hit 0.
Double Post Merge: December 31, 2020, 01:50:38 am
Sounds like a second kind health bar, you need to make your own variable to keep the value.
You can make a whileloop or a waittill trigger to check if the player does not have eaten enough and is starving to death.
When that happens do a "radius" (look up script reference) damage on the player and the rest I think will run smoothly.
i just figured out where i went wrong with using the generators method with player health. i now can get player health to hit 0. but just like the generator, i cant keep on purchasing.
im looking for something that will allow me to keep on purchasing whilst the generator/health is going down in its loop. is something like this even possible?
-
player health [SOLVED]
power off [SOLVED]
Looping scripts side-by-side = thread