• 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.

Question.

Status
Not open for further replies.
Level 13
Joined
Nov 22, 2006
Messages
1,260
There is a vJass function that can do that. If you don't like vJass, you can use the normal Jass version here.

Just put it in your map header, the custom script section, and do:

  • Custom script: set udg_Bool = CheckPathability(GetLocationX(udg_Loc), GetLocationY(udg_Loc))
This uses a boolean global variable called Bool and a point variable called Loc (you can name them whatever you want, just be sure to change that name in the custom script line here also.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
I can't get it to work. This is for a arrowkeymovement system. I took out the part that is relevant in this case.

  • Then - Actions
    • Set tmp_loc = (Position of Player[tmp_integer])
    • Set tmp_loc2 = (tmp_loc offset by move_speed[tmp_integer] towards (Facing of Player[tmp_integer]) degrees)
    • Custom script: set udg_bool_path = CheckPathability(GetLocationX(udg_tmp_loc2), GetLocationY(udg_tmp_loc2))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • bool_path Equal to True
      • Then - Actions
        • Unit - Move Player[tmp_integer] instantly to tmp_loc2, facing move_direction[tmp_integer] degrees
      • Else - Actions
    • Custom script: call RemoveLocation(udg_tmp_loc)
    • Custom script: call RemoveLocation(udg_tmp_loc2)

Here's how my trigger looks. Even though "tmp_loc2" isn't walkable, "Player[tmp_integer]" still tries to move there, unfortuatly if it's not walkable, "Player[tmp_integer]" will just get shaky and move to the closest location to "tmp_loc" which is walkable. I wanna prevent that from happening.

If "tmp_loc2" isn't walkable I don't want "Player[tmp_integer]" to move there at all.

Do you think you can help me? :p

Btw, "move_speed[tmp_integer]" is at 5.
 
Last edited:
Level 13
Joined
Nov 22, 2006
Messages
1,260
Er, what's wrong with the method I suggested earlier? If you have problems with getting it to work, I can help you, you just need to tell me what part you didn't understand. Btw, if you're scared of little jass, don't be, it's really no big deal.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
I did use that method, but it didn't work. : O Well, the system works, I checked that, but my unit moves only 5 collosion size (or whatever it's called) per 0.01 second. I suspect that the system is not sensible enough for that. (tell me if I'm wrong).

I might also just have used it wrong. Take a look at the trigger I posted erlier, I have used the system there.

  • Custom script: set udg_bool_path = CheckPathability(GetLocationX(udg_tmp_loc2), GetLocationY(udg_tmp_loc2))
But even though the location where the player is moved isn't pathable, he still tries moves there, but fails. What he should be doing is nothing. :p
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Hmm yeah, I've heard that the CheckPathability function isn't so good anyways. But I've found something else here, but you would need Jass NewGen Pack for that (if you heard about it).

You would just need to remove "//" from this line:

////! external ObjectMerger w3a ANwk win& anam "Collision Ability" ansf "" Owk3 1 0.0 Owk4 1 0 Owk2 1 0.0 Owk1 1 0.0 acdn 1 0.0 ahdu 1 0.0 adur 1 0. aher 0 amcs 1 0


Then save the map, then put "//" back again. You can check the example map to see how to implement it. This covers the Wind Walk ability.

Then you would also need a dummy unit, I think you can copy it from the test map and change the id here:

private constant integer DUMMY_UNIT_ID = 'hfoo'


If the id is different in your map. You can view the rawcodes in the Object Editor by pressing Ctrl + D (I think).

In the example of usage you would just need to put those GetLocationX and GetLocationY instead of x and y.


I'm sorry if this is all too complicated for you. Let me know if you don't understand something.
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
Should the code be in the map header?

Btw, what's wrong with this? I get syntax error ...
  • set udg_bool_path = IsTerrainPathingType(GetLocationX(udg_tmp_loc2), GetLocationY(udg_tmp_loc2) TERRAIN_PATHING_WALKABLE)
Sorry for being a noob. : O

EDIT: I've been messin' around for one hour now... But I can't even get the test map to work. 0.0''
 
Last edited:
Level 13
Joined
Nov 22, 2006
Messages
1,260
Yeah it can be in the map header. Did you download Jass NewGen Pack from wc3c.net? What kind of errors are you getting.

Hmm, now when I looked at that line you posted, it seems you forgot to put a comma after GetLocationY(udg_tmp_loc2), watch out for that, that's probably what caused the error.

If it still doesn't work, you can send me the map, I'll make it work (you can use pastebin or something to send me the map).
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
I've got this system too work, but this one also fails in my map. :| What should I do?
Besides, when the system is enable i get HEAVY lag. Maybe that is because the function is called every 0.01 seconds, but stil ...

EDIT: Yay, I made it. udg_Player[udg_tmp_integer] was to big for the dummy unit / item... Now it's fixed. Thank you for helping me :D +rep
 
Status
Not open for further replies.
Top