• 🏆 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!

[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