I use "Unit in Unit Group" ( "Idle Units for Player" ) == false. That's how I check if a unit is moving or not.
Here's the whole trigger actually:
RandomEncountersEventsTimer-Every3.0secondsofGameTimeLocalVariablesiPlayer=0<Integer>Region=0<Integer>Hero=NoUnit<Unit>CombatInstance=0<Integer>ConditionsActionsPlayerGroup-ForeachplayeriPlayerin(ActivePlayers)do(Actions)ActionsVariable-SetHero=PlayerData[iPlayer].Hero
Variable - Set Combat Instance = Player Data[iPlayer].Combat Instance
Variable - Set Region = Player Data[iPlayer].Encounter Region
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
(Random integer between 1 and 3) == 1
Combat Instance < 0(Heroisin(IdleUnitsforplayeriPlayer))==falseRegion!=-1ThenGenerateRandomEncounter(iPlayer,Region)Else
As you see, I also check no make sure they're not already in combat, as well.
Rollback Post to RevisionRollBack
Pocket Warriors - A pokemon-style game with SC2 units and full banking. New demo coming soon!
I have a bazillion regions on my map, and two triggers for each. When a play enters a region, I mark the region they are in. When they leave, I unmark it only if it's the same one he's currently marked as being in. This handles over lapping regions.
Then I have a timer that runs every few seconds. I check for a random between 1 and 3 being 1 (for example), and I check that the player is in the grass.
The alternative method, checking every few seconds to see if the player was in a grass region, was very slow. Unit in Region isn't particularly fast, especially when you have a lot of them. It can be a pain setting up all those triggers, but it really goes by pretty fast, it's just a lot of copy and paste.
Have a seperate action definition for HeroEntersRegion(int RegionNumber) and HeroLeavesRegion(int RegionNumber), so your triggers are only 1 line long. That way, if you make changes later, you need only change it in one place.
Rollback Post to RevisionRollBack
Pocket Warriors - A pokemon-style game with SC2 units and full banking. New demo coming soon!
To post a comment, please login or register a new account.
@ctccromer: Go
I use "Unit in Unit Group" ( "Idle Units for Player" ) == false. That's how I check if a unit is moving or not.
Here's the whole trigger actually:
As you see, I also check no make sure they're not already in combat, as well.
@ctccromer: Go
What I do isn't pretty, but it's fast.
I have a bazillion regions on my map, and two triggers for each. When a play enters a region, I mark the region they are in. When they leave, I unmark it only if it's the same one he's currently marked as being in. This handles over lapping regions.
Then I have a timer that runs every few seconds. I check for a random between 1 and 3 being 1 (for example), and I check that the player is in the grass.
The alternative method, checking every few seconds to see if the player was in a grass region, was very slow. Unit in Region isn't particularly fast, especially when you have a lot of them. It can be a pain setting up all those triggers, but it really goes by pretty fast, it's just a lot of copy and paste.
Have a seperate action definition for HeroEntersRegion(int RegionNumber) and HeroLeavesRegion(int RegionNumber), so your triggers are only 1 line long. That way, if you make changes later, you need only change it in one place.