Can anyone help me figure out why this trigger won't fire? It works when I force it to fire through another trigger, but then it doesn't work as intended.
Basically, what's happening here is if a unit steps on this circular region (which is wired into a variable because there are going to be many buildings, but currently it does not have an array, as it's just one building), a dialogue pops up and ask if they want to enter the building or not.
Entry Dialogue
Events
Unit - Any Unit Enters (Region(Any Region))
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering region) == Building Entries
((Triggering unit) is in Building Entries) == true
Then
Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
Variable - Set BuildingEntryDialogue = (Last created dialog)
Dialog - Set title of BuildingEntryDialogue to "Enter Building?"
Dialog - Create a button for dialog BuildingEntryDialogue with the dimensions (200, 50) anchored to Center with an offset of (-50, 0) setting the tooltip to "Does not make the unit enter the bu..." with button text "No" and the hover image set to ""
Variable - Set BuildingEntryReply[0] = (Last created dialog item)
Dialog - Create a button for dialog BuildingEntryDialogue with the dimensions (200, 50) anchored to Center with an offset of (50, 0) setting the tooltip to "Makes the unit enter the building." with button text "Yes" and the hover image set to ""
Variable - Set BuildingEntryReply[1] = (Last created dialog item)
Variable - Set MoveThisUnit = (Triggering unit)
Dialog - Show BuildingEntryDialogue for (Player group((Triggering player)))
Else
Dialog - Show BuildingEntryDialogue for (Player group((Triggering player)))
I've tried taking out that action in the Else, but it won't fire. I also took out the conditions in the if's but it still won't fire. Anyone got any idea?
The most obvious problem is that Triggering Player is not defined within the context of this trigger. Use owning player of triggering unit instead.
If that doesn't work, I wouldn't trust the Region(Any Region) part, but that's because I don't have experience with that.
Maybe because units always enter the region Entire Map and never leave it.
There are other ways to check if you are close to a building, for example distance between point A and point B. You can look for the closest building and see if it's close enough.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Can anyone help me figure out why this trigger won't fire? It works when I force it to fire through another trigger, but then it doesn't work as intended.
Basically, what's happening here is if a unit steps on this circular region (which is wired into a variable because there are going to be many buildings, but currently it does not have an array, as it's just one building), a dialogue pops up and ask if they want to enter the building or not.
Entry Dialogue
Events
Unit - Any Unit Enters (Region(Any Region))
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Triggering region) == Building Entries
((Triggering unit) is in Building Entries) == true
Then
Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
Variable - Set BuildingEntryDialogue = (Last created dialog)
Dialog - Set title of BuildingEntryDialogue to "Enter Building?"
Dialog - Create a button for dialog BuildingEntryDialogue with the dimensions (200, 50) anchored to Center with an offset of (-50, 0) setting the tooltip to "Does not make the unit enter the bu..." with button text "No" and the hover image set to ""
Variable - Set BuildingEntryReply[0] = (Last created dialog item)
Dialog - Create a button for dialog BuildingEntryDialogue with the dimensions (200, 50) anchored to Center with an offset of (50, 0) setting the tooltip to "Makes the unit enter the building." with button text "Yes" and the hover image set to ""
Variable - Set BuildingEntryReply[1] = (Last created dialog item)
Variable - Set MoveThisUnit = (Triggering unit)
Dialog - Show BuildingEntryDialogue for (Player group((Triggering player)))
Else
Dialog - Show BuildingEntryDialogue for (Player group((Triggering player)))
I've tried taking out that action in the Else, but it won't fire. I also took out the conditions in the if's but it still won't fire. Anyone got any idea?
The most obvious problem is that Triggering Player is not defined within the context of this trigger. Use owning player of triggering unit instead.
If that doesn't work, I wouldn't trust the Region(Any Region) part, but that's because I don't have experience with that.
@Fellius:
Actually it states in the event to use "Triggering Player" to get the player controlling the "Triggering Unit",
Apparently:
Unit - Any Unit Enters (Region(Any Region))
Does not function correctly. It doesn't actually register anything touching any regions.
Maybe because units always enter the region Entire Map and never leave it.
There are other ways to check if you are close to a building, for example distance between point A and point B. You can look for the closest building and see if it's close enough.