| 03-14-2005, 09:35 PM | #1 |
I was thinking of making a stamina system for a map I am making, but I don't know how or what it would look like. When a unit moves, it will lose stamina (mana) relative to how fast it is going (100-270 would drain a little, 270-520 would drain a lot). When the unit stops moving, it will start regaining the stamina (mana). This idea is similar to the one in Diablo 2. If that isn't possible, then what could be a useful replacement for the mana? The map is space-based, for those who may need to know. Help is appreciated. |
| 03-14-2005, 11:01 PM | #2 |
You could always make a leaderboard and have a bar made like this ||||||||||||||||||| since mana is important... but it sounds totally possible to do... |
| 03-15-2005, 10:10 PM | #3 |
Well, the problem isn't displaying it, the problem is making it. |
| 03-16-2005, 02:36 AM | #4 |
Well, I'm not sure if this is exact coding, and it would need a test, but you could make a loop. Code:
Custom Script: loop Custom Script: exitwhen udg_Speed() = 100.00 Unit - Change unit speed of [color=red]Unit[/color] to ([color=red]Speed of Unit[/color] - 1) Set Speed = (Speed - 1) wait .25 seconds Custom Script: endloop Again, that would be the loop, and I'm not sure if that is correct(can't verify at the moment), but that is generally how you would want your loop to be. You might even want to make it so it checks when the unit stops moving. But at the moment I'm not sure to have multiple exitwhen functions. Your event would be something like 'Unit is issued an order with no targer', or something of that nature. And if this is something for every unit, you might want to localize the variable, or make an array. Whichever is best suited for the situation. |
| 03-16-2005, 06:11 AM | #5 |
if u don't have a lot of units to do it to (or even a fair amount is ok since its just calculations mostly) u can put it in a periodic event: every 0.5 seconds condition: actions: pick units in checkstaminagroup + if distance between point(GetHandleReal( pickedunit, X ), GetHandleReal( pickedunit, Y ) and current pos of unit > 32 then ++ set stamina of unit (either a handleReal or mana or a variable or wood or whatever) = stamina - 1 + else if blah blah > 64 then ++ set stamina = stamina - 3 + else if blah blah < 8 then (not moving case roughly) ++ set stamina = stamina + 2 + end if + SetHandleReal( pickedunit, "X", units current x pos ) + SetHandleReal( pickedunit, "Y", units current y pos ) + if stamina < somethin then ++ set move speed +blah blah, etc u get the point u'd need handle variable scripts, i'd post em but i don't have my editor open (not necessarily by the name handle variables, just gamecache stuff) |
