Basically, I setup creeps in my oRPG to wander around so they dont look stupid standing motionless all the time.
I created regions for each kind of creep like 'Furbolg Area 1' and placed all furbolgs in there.
Then I created this triggeR:
That's to ensure that if they wander outside their region they get thrown back in there so they dont end up wandering all over the map.
The problem:
If a player is OUTSIDE Furbolg Area 1 and starts attacking a furbolg, the furbolg runs up to the border of the region and helplessly runs back inside the region unable to attack the player.
How can I solve this ? I know I need to put another condition like 'unit is attacked by player etc' so that it knows to be allowed to leave the region ONLY if it is attacked by a player...
Edit: Here's what I tried to do.. I tried adding the creep being attacked to a unit group and then the trigger above I added a new condition that checks if that unit is in the unit group. It didn't work.
I created regions for each kind of creep like 'Furbolg Area 1' and placed all furbolgs in there.
Then I created this triggeR:
Trigger:
- Furbolg Area 1
- Events
- Unit - A unit leaves Furbolg Area 1 <gen>
- Conditions
- (Unit-type of (Triggering unit)) Equal to Furbolg
- Actions
- Set CreepReturnArea = (Random point in Furbolg Area 1 <gen>)
- Unit - Order (Triggering unit) to Move To CreepReturnArea
- Custom script: call RemoveLocation(udg_CreepReturnArea)
- Events
That's to ensure that if they wander outside their region they get thrown back in there so they dont end up wandering all over the map.
The problem:
If a player is OUTSIDE Furbolg Area 1 and starts attacking a furbolg, the furbolg runs up to the border of the region and helplessly runs back inside the region unable to attack the player.
How can I solve this ? I know I need to put another condition like 'unit is attacked by player etc' so that it knows to be allowed to leave the region ONLY if it is attacked by a player...
Edit: Here's what I tried to do.. I tried adding the creep being attacked to a unit group and then the trigger above I added a new condition that checks if that unit is in the unit group. It didn't work.