• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Issue with action not triggering in parts of region

Status
Not open for further replies.
Level 3
Joined
Sep 19, 2017
Messages
36
So the issue i'm having is that the text only appears if you approach the region from the left or bottom, it will not appear from the right or top.

(in the video title i refer to it as a bug, but that may not be true)

I also uploaded a attachment of what the regions look like in editor

all of the if then else triggers perform the same action the only difference is the first one is for a named character.

Info Runes
Events
Unit - A unit enters Info Rai <gen>
Unit - A unit enters Info Empty 1 <gen>
Unit - A unit enters Info Empty 2 <gen>
Unit - A unit enters Info Empty 3 <gen>
Unit - A unit enters Info Empty 4 <gen>
Unit - A unit enters Info Empty 5 <gen>
Conditions
Actions
-------- Rai --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Rai <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
-------- Coming Soon 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Empty 1 <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
-------- Coming Soon 2 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Empty 2 <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
-------- Coming Soon 3 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Empty 3 <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
-------- Coming Soon 4 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Empty 4 <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
-------- Coming Soon 5 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Info Empty 5 <gen> contains (Triggering unit)) Equal to True
(Unit-type of (Triggering unit)) Equal to Soul
Then - Actions
Game - Display to (Player group((Owner of (Triggering unit)))) the text: Coming Soon!
Else - Actions
Do nothing
 

Attachments

  • regions.png
    regions.png
    590 KB · Views: 42
Last edited:
Level 2
Joined
Jan 31, 2019
Messages
27
I believe the units collision size is accounted for the enters region event, but the center point of the unit is still outside the region. You might need a custom "region contains unit" function, or instead create a new temporary position where you offset the units X and Y coordinates by the amount of its collision size towards the region, and then check if that point is inside said region.
 
I don't think collision is accounted for the event, because the issue @Josh The Jaunty explains, only occurs at the top-right cell, which is added hiddenly. (link above)

All checks in general work though on this event, checking if the unit is inside the rect, work fine. The check itself does not take collision into account, but only the unit's center's coordinates:

JASS:
function RectContainsCoords takes rect r, real x, real y returns boolean
    return (GetRectMinX(r) <= x) and (x <= GetRectMaxX(r)) and (GetRectMinY(r) <= y) and (y <= GetRectMaxY(r))
endfunction

function RectContainsUnit takes rect r, unit whichUnit returns boolean
    return RectContainsCoords(r, GetUnitX(whichUnit), GetUnitY(whichUnit))
endfunction
 
Level 2
Joined
Jan 31, 2019
Messages
27
Now that I look, looks like you are correct. So when the event is registered the rect used is hiddenly expanded 32 units towards the right and top sides. And when checking whether the rect contains the unit that rect has to be expanded by 32 units to those directions as well.
 
Status
Not open for further replies.
Top