HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Reducing Mana

07-25-2004, 01:02 AM#1
Strider619
I know i posted something similar to this before but i didnt get the way the person described the way i was supposed to make the trigger. heres wat i want to do. Lets say a certain Unit starts moving his mana would start reducing as it walked, only while walking. How would i do this?
07-25-2004, 01:05 AM#2
Nabren
Quote:
Originally Posted by Strider619
I know i posted something similar to this before but i didnt get the way the person described the way i was supposed to make the trigger. heres wat i want to do. Lets say a certain Unit starts moving his mana would start reducing as it walked, only while walking. How would i do this?

Probably the easiest way would be to have an event of a unit being issued an order to move/attack(which would mean he is moving) and then enable a trigger that runs every second or so and subtracts mana. Then another trigger for an event of being issued the stop command, which would mean he isn't moving anymore, and disabling the trigger that subtracts his mana.

Doing it this way you don't have to pay attention to where the unit last was and where he is now, which makes it easier on the processor, since you only run checks when he actually does something and not when he is standing still.
07-25-2004, 06:13 AM#3
Strider619
Ill try tat thanks.
07-25-2004, 07:04 AM#4
Anitarf
Yes, the order detection is rather unreliable. If you want to do this for only a single unit, doing a position comparison every 1 second is the way to go.
07-25-2004, 10:47 AM#5
Milkman
I believe that there is a order called idle, can't you use this to check when the unit is not moving, like :
A unit is issued an order without target, takes orderstring (idle)
Unit is yourunit
set unit mana = unit mana - 1
07-25-2004, 01:11 PM#6
SpadeZ
I think there is a way, but it may lag the game because it takes a constant firing trigger. It requires a minimun of 2 triggers, a new region and a new variable. First you must create a region, a very small region no bigger than the size of a footman. Then you must create a unit variable for the unit that is losing mana. The triggers are as follows:

(Note: Somewhere you will need to place an action that sets the unit that you want to lose mana (preferably in the initialization, but if the unit spawned later, then you would need to place it straight after it is spawned). Let "UnitLosingMana" be a unit variable with no array and the initial value to be none. Let "TheNewRegion" be the new region required for this trigger to work.)

Code:
[center][i][b]Trigger 1[/b][/i][/center]
    [b]Events[/b]
        Time - Every 0.50 seconds of game time
    [b]Conditions[/b]
    [b]Actions[/b]
        Region - Center TheNewRegion <gen> on (Center of (Region centered at (Position of UnitLosingMana) with size (10.00, 10.00)))

Code:
[center][i][b]Trigger 2[/b][/i][/center]
Untitled Trigger 002
    [b]Events[/b]
        Unit - A unit leaves TheNewRegion <gen>
    [b]Conditions[/b]
        (Triggering unit) Equal to UnitLosingMana
    [b]Actions[/b]
        Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 1.00)


This is just a basic example. You will need alot more triggers, regions and variables than what i have mentioned if you want to use this for more than one unit. Just a general idea.

Hope this helps.