HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A Simple Repeating Item Check...?

12-16-2006, 01:17 AM#1
Ignitedstar
There's a certain region in the map that I'm working on that has a slowing effect that reduces any unit's speed to 150 through triggers. Then, there's a certain item that I call the "Leg of Wonders"(it's cheesy name, but that's the point). It would "stop" the effect of the region's slowing effect. I'm doing this becuase I don't want a buff to appear.

I tested it by having a hero walk in and out of the region. The first part of the trigger works: Having the hero walk through the region with the item and not having it's speed reduced to 150. Then, walking back in without the item and sucessfully having it reduce the hero's speed by 150.

However, the second part is not doing so well. First of all, here are the checks that done when heros are inside the region:

Trigger:
Check for Leg
Collapse Events
Time - Every 1.00 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in RegionX <gen> matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) has an item of type Leg of Wonders) Equal to True
Collapse Then - Actions
Skip remaining actions
Collapse Else - Actions
Skip remaining actions
Collapse Unit Group - Pick every unit in (Units in RegionX <gen> matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) has an item of type Leg of Wonders) Equal to True
Collapse Then - Actions
Unit - Set (Triggering unit) movement speed to 150.00
Collapse Else - Actions
Do nothing

The checks don't seem to work for heros that are already inside the region and take/lose the Leg of Wonders. If they're in the region and they drop the leg, then they still move at their default speed. If the unit drops the item, leaves the region, re-enters, and then grabs the item, they don't have their speed reset to normal. What did I miss?
12-16-2006, 01:38 AM#2
aquilla
Why don't you just use Unit aquires/loses an item events with unit enters/leaves region?

The way you have coded it leaks a lot, and is sort of ineffective

eg, a unit picks up the item - add the unit to a unit group, remove the unit from the group when it drops the item - check if the unit is in the region and change movespeed accordingly
a unit enters/leaves the region - check if the unit is in the unit-group and change movespeed accordingly
12-16-2006, 01:47 AM#3
Ignitedstar
I totally forgot that the Unit Aquires an Item existed. Damn. I'll see what happens.