HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Complicated detection . . .

08-31-2003, 11:14 PM#1
Pesmerga
Ok, first thread started in a while. Heres my problem -

I have a knight. I select him. I press up arrow key.


Events
Player - Player 1 (Red) Presses the Up Arrow key

Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
Unit - Order (Picked unit) to Move To ((Position of (Picked unit)) offset by (0.00, 160.00))


This is all fine and dandy, but if the unit hits a wall and I press foward again, he either tries to get to that point by walking around the obstacle, or if theres no way there, he just walks closest to the fence and screws up the pathway. Is there a possible way to detect if he can move foward anymore?

I don't think thats possible, so I've tried the following -

Make a grid of regions, 36 in all (just for test purposes) 6x6 grid. Center the units on the regions at map start.

Events
Player - Player 1 (Red) Presses the Up Arrow key

But I can't find an action to detect the region in front of him. If anyone knows the answer, I would greatly appreciate it. Thanks.
08-31-2003, 11:22 PM#2
Draco
Well, if you had an invisible unselectable unit right up against the wall, you could do an If/Then/Else and check...

Event - Player presses up arrow

Actions:
IF/Then/Else - If a unit(the invis one) is within 50 units (or 160 or whatever) of "Knight/Hero Person), then do nothing, else Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions) - Unit - Order (Picked unit) to Move To ((Position of (Picked unit)) offset by (0.00, 160.00)) or whatever you did before.


- - -

What is the loop for btw? It works without it.
08-31-2003, 11:25 PM#3
Pesmerga
Oh great idea, thanks a bunch. Umm, could a pathing blocker be detected as a 'unit within range'?
08-31-2003, 11:26 PM#4
Draco
A pathing blocker is a doodad, so no.
08-31-2003, 11:33 PM#5
Guest
Ummm you could use pick every doodad in range of 86 of selected unit.

Also what i did for my bomberman map is made it so it would move exactly to the grid style. So you could detect it based off where he is.... It works great for me i don't know how to explain it any better..
08-31-2003, 11:35 PM#6
Draco
I'd like to see your trigger that detects range of regular doodads plz...
09-01-2003, 12:00 AM#7
Pesmerga
Ok - new problem.

Events
Player - Player 1 (Red) Presses the Up Arrow key

Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
If ((No region contains (Picked unit)) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Unit - Order (Picked unit) to Move To ((Position of (Picked unit)) offset by (0.00, 160.00)))


Now, the ((No region contains (picked unit)) equal to true part doesn't seem to work. If you find a flaw, I would love to hear it.
09-01-2003, 03:32 AM#8
Guest
Your problem is that turn off this trigger doesn't stop the trigger from running... what you need to do is pick the multiple action if than else statement and after turn off trigger have skip remaining actions.
09-01-2003, 03:35 AM#9
Pesmerga
Yah I tried both of those. It's not the action thats wrong, its the condition. No Region doesnt seem to work, but im going to use other methods besides this. Thanks anyways - ill be posting again with other problems :)
09-01-2003, 03:40 AM#10
Guest
I can do exactly what you want but i would need your map as its not worth it to do the same thing on a different map... my email is [email protected] if your intrested.
09-01-2003, 04:47 AM#11
Draco
If you just post a blank map with your trigger, coolaboy, he can open it and copy and paste it into his. That's if he doesn't want to post his map or give it to sum1...
09-01-2003, 04:50 AM#12
Pesmerga
No no, its ok, really, but im just figuring out better methods at the moment.
09-01-2003, 01:52 PM#13
Guest
Well im bored so i just might make a blank map to show everyone how to do arrow movement.
09-01-2003, 02:19 PM#14
Guest
Well its almost done so to save time i used Local player which i don't think will work in multiplayer... I will test it though.
09-01-2003, 04:59 PM#15
Newhydra
if the unit is in the playable map area, it would be in a region, yes?

Couple things you could try...One: you could try having an array of regions which is where the walls are, then check through that array each time the unit moves. (if unit in region walls[0] return, ect)

Or you could use invisible units/doodads for your walls, then go "if region centered at point w/offset(location of picked unit + P) with width X and length Y contains <whatever you decide to use> then return"