• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Question about Unit - A unit leaves <Region>

Status
Not open for further replies.
Level 3
Joined
Jul 7, 2009
Messages
30
Just 1 question, put the yes/no answer (and if "yes", put a trigger action or Script text to solve my problem, please):
When trigger event is like
"Unit - Generic Unit Event"​
we can get unit using
"Set UnitValue = (Triggering unit)".​
My question is, can we get region, like
"Set RegValue = ..."​
when we use event like
"Unit - A unit leaves <Region>"?​
It is needed when I "don't know" what region stands in event, or I use 10-20 events with regions.
 
Level 3
Joined
Jul 7, 2009
Messages
30
When a unit enters region, save it somehow
Maker, do you mean I must create N (3 regions - 3 triggers, 100 regions - 100 triggers) triggers for every region unit can enter:
"Unit - A unit enters <RegionN>"
"Set Regions[number+1] = <RegionN>"
?
The answer to my question must remove N triggers from my map.

My map is working G R E A T now, but I use 16 triggers for triggering 15 regions, it looks like every trigger have
"Unit - A unit leaves <Region>"
"Set _regmotion_reg = <Region>"
"Set _regmotion_unit = (Triggering Unit)"
"Trigger - Run 16tr (checking conditions)"

And, last (16) trigger has action upon this unit + region it leaves.

It is... big list of trigs, so I want to see
"Unit - A unit leaves <Region1>"
"Unit - A unit leaves <Region2>"
"Unit - A unit leaves <Region3>"
...
"Unit - A unit leaves <RegionN>"
"Set _regmotion_reg = ..."
"Set _regmotion_unit = (Triggering Unit)"
...actions...

In O N E trigger, so I won't create 16 triggers.
But "Set _regmotion_reg = ..." is lost, I can't find anything like (TriggeringRegion)...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
When you leave a region, this system will create a footman in the region you left.

There are two versions of the system. One uses a wait, but is not necessarily 100 % accurate but you can test it. The other is 100 % accurate, but requires you to place 2x the amount of regions.

You only need three triggers for the system. Well two actually if you merge the initialization with Map Initialization trigger.
 

Attachments

  • Region_System.w3x
    19 KB · Views: 34
Level 4
Joined
Apr 14, 2009
Messages
118
Cant you do it with a generic unit event?

  • Unit - unit leaves region
then your conditions like triggering unit = ... and
triggering region = ...

You could do it in If_Then_Else to

hope that helps...
 
Level 3
Joined
Jul 7, 2009
Messages
30
Thank you, Maker! But I need to learn Hashtables before I use your system, and I have some questions with that, those I can answer with Hastables knowledge only. Such as "What if 2 regions have same points?" "What if a unit uses Blink spell or just jump over that a little bigger region?". Anyway, nevermind these, I will use my [N+1]trigger system for N regions now, because I have already written all triggers for them (they work P E R F E C T L Y, even if I 10x speed up my game). When I learn hastables, I will try to upgrade your system upon my needs, thanks again for that map!
Last question: how to close the tread? ;)
 
Status
Not open for further replies.
Top