HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Setting Max Health

08-23-2005, 08:31 PM#1
MrApples
Ok, (yes I am using WEU) I'm trying to set the max health of certain units.
Quote:
Main Trigger
Set Life
Events
(This is run by a non-listed Trigger)
Conditions
Actions
Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
Loop - Actions
Advanced - For (Picked unit) Increase life maximum by ((Integer(((Picked unit)'s custom real value)))(The Real Custom Value keeps track of the original max health) - (Integer((Max life of (Picked unit)))))
Set LifeMax = (((Integer((Max life of (Picked unit)))) / 1) x GangHandiPlayer1)(The GangHandiPlayer is a integer between 1-100 that is used to handicap the units of a player)
Advanced - For (Picked unit) Decrease life maximum by ((Integer((Max life of (Picked unit)))) - LifeMax)

Quote:

Set Real Custom value Triggers
Default Life
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
Advanced - Set the custom real value for (Picked unit) to (Max life of (Picked unit))


Quote:
Default Life2
Events
Unit - A unit Finishes training a unit
Conditions
Actions
Advanced - Set the custom real value for (Trained unit) to (Max life of (Targeted unit))






08-24-2005, 03:49 AM#2
Ignitedstar
I think it would help on telling people what is wrong. Does it not remember the custom value, or their original max health, or what?
08-24-2005, 04:54 PM#3
MrApples
It doesn't do anything, thats whats wrong.
08-25-2005, 02:15 PM#4
Kalvorod
A good idea would be to put a peice of code to check if it is working starting at the beggining of the code. Something like "Game-Display message to all players (" SO far so good...").

Then test the game. If you see it, then go back to the editor, and move it down a line of code or two, and try again. Repeat until you don't see it(when it should be seen, of course).

If it doesn't show at all, that probobly means something is going wrong with your events/conditions for the script. I recommend using "repeat every .1 seconds" and then inserting a code that says "trigger-Turn this trigger off". Have the trigger that enables it turn it on, instead of calling it.

That may sound stupid, adding that extra code, but I know it works, and I don't know how you called the script.

Incase that it does show when the event starts, but not later, check your conditions in if statements ect.

Incase that it always shows, but still nothing happens, make sure that you used the correct varaibles.
08-25-2005, 02:17 PM#5
Kalvorod
In that last script, change "targeted unit" to "trained unit". That's the only thing I can see without even knowing what's wrong to begin with.