• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJass] Unit enters rect, order it to move to a different rect

Status
Not open for further replies.
Level 3
Joined
Jun 14, 2007
Messages
56
Hellooo!
Now this one is quite a simple one. but i'm having difficulty with eeet

I will post code shortly, atm i cant access my worldedit :( will fix soon.



The basics:
- Trying to programme a unit that checks houses in a map room by room
- The code is vjass in a library
- I use the struct room which has integers area/house/part and rect (corresponding location) and boolean checked. global room array is used to create the rooms and refer to them elsewhere
- i have a seperate trigger with actions that run the function EnterRoom that orders the unit to the next room in the library
- i have another trigger that loops and adds the events to the above trigger UnitEntersRect(ROOM[x].rect) x loops up to the max number of rooms obviously
- the function EnterRoom only takes unit. the way i tried to get the triggering rect that he entered was the if RectContainsUnit function (combined with is rect the target rect etc) But the thing is sometimes it doesnt quite work because the unit doesnt seem to be in the rect immediately after entering. waiting 1 second after entering seems to work but obviously this is a messy idea.









If possible think of this problem as explaining how to move the spawning units from start to finish in a maze tower defense using vjass because its the same idea!
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
There are natives for this one:
JASS:
// EVENT_GAME_ENTER_REGION
constant native GetTriggeringRegion takes nothing returns region
constant native GetEnteringUnit takes nothing returns unit
Though still that is not so simple.

Another solution would be to use this
 
Level 3
Joined
Jun 14, 2007
Messages
56
OMG no kidding there is a GetTriggeringRegion baaah i had no idea i just searched for Rect assuming it would be rect. and i had a look through gui triggers swear i couldnt find it! gah! thanks mann i feel sillyy
 
Status
Not open for further replies.
Top