Yeah, I understand your point, but that way would be too complicated, I believe that this is the basic way, and he can develop it better himself later.^I would rather add units to a unit group when they enter the area, and save a timer (integer) value for them. Then use a periodic trigger that updates, let's say once every second, and reduces the timer value for each unit. When the timer hits zero reduce exp and restart the integer counter. If the unit is not in the region, remove it from the unit group.
That way it's more accurate. Your way makes it possible for a unit to be in the area for one second and it gets it's exp reduced.
- Trigger
- Events
- Unit - A unit enters Region
- Conditions
- ((Triggering unit) is a Hero) Equal to True
- Actions
- Unit Group - Add (Triggering unit) to DecreasedExp
- Trigger1
- Events
- Unit - A unit dies
- Conditions
- Actions
- Set Temp_R = 1000.00 //Replace 1000.00 with the Experience range of your map (from Game Play Constants)
- Set Temp_P = (Position of (Triggering unit))
- Set Temp_G = (Units within Temp_R of (Temp_P) matching ((Matching unit) is a Hero) Equal to True)) and ((Matching unit) belongs to an enemy of (Owner of (Triggering unit))))
- Unit Group - Pick every unit within Temp_G and do (Actions)
- Loop - Acitons
- If (All conditions are true) then do (Actions) else do (Actions)
- If - Conditions
- ((Picked unit) is in (DecreasedExp)) Equal to True
- Then - Actions
- Hero - Set (Picked unit) experience to (((Picked unit) experience)) - (0.1 * (Picked unit) experience))
- Else - Actions
- Custom script: call RemoveLocation (udg_Temp_P)
- Custom script: call DestroyGroup (udg_Temp_G)
- Trigger2
- Events
- Unit - A unit leaves Region
- Conditions
- ((Triggering unit) is in (DecreasedExp)) Equal to True
- Actions
- Unit Group - Remove (Triggering unit) from (DecreasedExp)