wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 03-22-2009, 11:33 PM   #1
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default SetUnitX/Y + TriggerRegisterEnterRegion = evil

I will explain short the reason.
for example we have several regions on the map with this event and it does do something on enter (or leave) so...

we need to insta move some unit to some point.
so we usually call
Code:
call SetUnitX(u,x)
call SetUnitY(u,y)

and here is allready the epic fail ! cause after we called call SetUnitX(u,x) unit will be moved.
and keep it's current Y position. so in some cases this unit may be "in wrong place" and trigger. (or what ever)
and well yeah after this we call to SetUnitY and unit is arriving to it's destination.

i post this here cause i spend today a half day fixing a very weird issue with a custom blink spell in my AOS (it does use custom 3D pathing which is based on regions) so i was very shocked sometimes than i was not blinked at all or moved not to the right place.

and now the most important. the fix is using the lame -_- SetUnitPostion() function cause it moves the unit "at once" and it can't be at wrong place for some time frame. (also it account pathing etc.)

well it's not very important (for most maps) but i think you should know this.
__________________
Toadcop is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 03-22-2009, 11:35 PM   #2
darkwulfv
Alpha Male of Wc3c
 
darkwulfv's Avatar


Official Map Reviewer
 
Join Date: Mar 2006
Posts: 3,646

Submissions (6)

darkwulfv is just really nice (270)darkwulfv is just really nice (270)

Send a message via AIM to darkwulfv
Default

...And SetUnitPosition is lame because...? And if it would be offset by improper pathing (which for a blink spell would be avoided anyways through checks), you could just call SetUnitX/Y afterwards, since it'd only be moving a fractional amount and shouldn't end up in a random spot.
__________________
The Spell Request Thread
Quote:
Originally Posted by Joe-Black-5
a dota like map but with unique stuff
(There was no map attached, and that was all the thread said.)
Spells I've Made

Darkwulfv's Lightning Grapple || Tritanis' Lazy Bolt

darkwulfv is offline   Reply With Quote
Old 03-22-2009, 11:39 PM   #3
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Hmnn SetUnitX/Y is useful for movement because it is fast and pathing-less. Another use is for dummy units that pretend to be missiles.

Catch: As it is for movement, the new position is very close to the last one, so stuff should work ok. Dummy units are also not supposed to be even considered by events, so it works for them as well.

For long distances, It seems you are right and SetUnitPosition all the way, any speed increase or defense against pathing seems irrelevant in comparison to that bug.

Quote:
and now the most important. the fix is using the lame -_- SetUnitPostion() function cause it moves the unit "at once" and it can't be at wrong place for some time frame. (also it account pathing etc.)
You could like... disable the trigger before doing SetUnitX/Y , not like it improves stuff that much.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-23-2009, 02:49 AM   #4
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Quote:
you could just call SetUnitX/Y afterwards
the interesting... if i called

call SetUnitPosition
call SetUnitX
call SetUnitY

it screwed the movement =\ anyway so idk (maybe SetUnitPosition is applied on current thread queue end ?) need to check this...

Quote:
Catch: As it is for movement, the new position is very close to the last one, so stuff should work ok. Dummy units are also not supposed to be even considered by events, so it works for them as well.

For long distances, It seems you are right and SetUnitPosition all the way, any speed increase or defense against pathing seems irrelevant in comparison to that bug.
yes exactly.
Quote:
disable the trigger before doing SetUnitX/Y
well
1) i need to keep the check (otherwise i don't the pathing system :P)
2) i have 700+ triggers xD
2a) constant native GetTriggeringRegion takes nothing returns region hmmm. i think precreate region will be the same. a fuck dilemma >.< .... i think i will keep it for the first how it's now.

.
Quote:
..And SetUnitPosition is lame because...?
it's slow. and it takes in account pathing.

btw ... tga texture can be used as war3map.wpm really handly to draw own pathing map in Photoshop xD
__________________
Toadcop is offline   Reply With Quote
Old 03-23-2009, 03:15 AM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Quote:
2) i have 700+ triggers xD
Congratulations, you don't plan code correctly.


Well, but yeah disable won't work...

Are your bunch of regions a grid?, I think you could do better than using regions, still perhaps we could pray for an atomic SetUnitX/Y alternative to come... Until then I guess you'll have to use SetUnitPosition.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-23-2009, 09:10 AM   #6
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Quote:
the interesting... if i called

call SetUnitPosition
call SetUnitX
call SetUnitY

it screwed the movement =\ anyway so idk (maybe SetUnitPosition is applied on current thread queue end ?) need to check this...
Well, I have experienced that SetUnitX and SetUnitY does NOT stop orders in any way, it simply moves the unit in the field. The SetUnitPosition also seems to have special handling to wc3, meaning its calling an OrderStopCheck aswell as pathing check. To not hang out on this bug, I suggest only move the units a little each time. The bigger the distance is, the more you will get unseen problems.


Quote:
1) i need to keep the check (otherwise i don't the pathing system :P)
What are you doing exactly?

Quote:
2) i have 700+ triggers xD
Thats quite alot, are you GUIing? :P
Anyway, I am having less, but more complicated ones. I prefer a good mix of difficulty and amount.
Quote:
2a) constant native GetTriggeringRegion takes nothing returns region hmmm. i think precreate region will be the same. a fuck dilemma >.< .... i think i will keep it for the first how it's now.
Everytime you move a unit with SetUnit(X/Y) you should run an additionally check which checks if a unit is in region or not to prevent enter region bugs.

Quote:
. it's slow. and it takes in account pathing.
I would never suggest using SetUnitPosition...
Quote:
btw ... tga texture can be used as war3map.wpm really handly to draw own pathing map in Photoshop xD
Didn't knew that, any link?
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 03-23-2009, 09:25 AM   #7
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

I can see this being a bitch of a bug. How about leaving a little sliver of map edge region free, then
Collapse JASS:
call SetUnitX(u,border)
call SetUnitY(u,ydest)
call SetUnitX((u,xdest)
__________________
PipeDream is offline   Reply With Quote
Old 03-23-2009, 09:45 AM   #8
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

pipedream's fix sounds good. you could even move the unit outside of the normal map boundaries rather than leaving an edge free.

another method would be to incrementally move the unit by smaller x/y values toward the desired position.
grim001 is offline   Reply With Quote
Old 03-23-2009, 02:29 PM   #9
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Quote:
Are your bunch of regions a grid?
no it's simple...
i have doodads placed on map.
after i create own slk with data for these doodads. dimensions in X/Y/Z
after i place into folder the war3map.doo and run my tool. after i get an
calls like this (it also scale the sizes depending on the doodad size)
Code:
call CreateHWRectBR(-8174,-3900,-7914,-3639,1054,1679)
it creates an rect with Z width. when on enter\leave events i do needed actions.

Quote:
Anyway, I am having less, but more complicated ones. I prefer a good mix of difficulty and amount.
lol xD.

Quote:
Didn't knew that, any link?
? it's simple.

your map dimensions (for example 128x128*4=512x512)
so you need an 512x512 32bit Tga (with a black alpha channel !) after simply messing with needed colors (! very important don't to use not allowed colors so use pencile instead of a brush) well then save it. and import as war3map.wpm (the import manager will overwrite the generated map with yours) well thats all works fine. and i use only black and white colors and... full size of the file is 1.6mb after mpq compression ~30kb =) or even less.

Quote:
call SetUnitX(u,border)
call SetUnitY(u,ydest)
call SetUnitX(u,xdest)
i will check and confirm if it's save as SetUnitPosition (in my relative hard case.)
__________________
Toadcop is offline   Reply With Quote
Old 03-23-2009, 03:37 PM   #10
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

Quote:
call SetUnitX(u,border)
call SetUnitY(u,ydest)
call SetUnitX((u,xdest)

I think this is going to work, unless you depend of region leave events as well as enter events.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 03-23-2009, 05:16 PM   #11
Blacktastic
User
 
Blacktastic's Avatar
 
Join Date: Oct 2006
Posts: 138

Blacktastic is on a distinguished road (12)

Default

If your problem is the fact that you can only move the X or Y one at a time, why not just move the x a short distance, then the y a short distance, and repeat until you achieve the wanted distance?

Or would the problem still occur under these circumstances?
__________________
lolwut
Blacktastic is offline   Reply With Quote
Old 03-23-2009, 05:33 PM   #12
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

Quote:
Originally Posted by Blacktastic
If your problem is the fact that you can only move the X or Y one at a time, why not just move the x a short distance, then the y a short distance, and repeat until you achieve the wanted distance?

Or would the problem still occur under these circumstances?

it wouldnt matter that much, but since this would decrease performance drastically it would be better to just use SetUnitPosition (maybe followed by a SetUnitX/SetUnitY) or Pipedreams Solution.
__________________

Last edited by akolyt0r : 03-23-2009 at 05:35 PM.
akolyt0r is offline   Reply With Quote
Old 03-23-2009, 08:34 PM   #13
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Quote:
Originally Posted by akolyt0r
since this would decrease performance drastically

you'd have to do it like 20 times to get as slow as SetUnitPosition
grim001 is offline   Reply With Quote
Old 03-23-2009, 08:41 PM   #14
Blacktastic
User
 
Blacktastic's Avatar
 
Join Date: Oct 2006
Posts: 138

Blacktastic is on a distinguished road (12)

Default

Quote:
Originally Posted by grim001
you'd have to do it like 20 times to get as slow as SetUnitPosition

Hence why I bothered suggesting what i did.
__________________
lolwut
Blacktastic is offline   Reply With Quote
Old 03-23-2009, 09:56 PM   #15
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,886

Submissions (4)

Toadcop is just really nice (299)Toadcop is just really nice (299)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Quote:
call SetUnitX(u,border)
call SetUnitY(u,ydest)
call SetUnitX((u,xdest)

I think this is going to work, unless you depend of region leave events as well as enter events.
yes works fine. but you need to be sure what the map edges also don't have some regions...
but the SetUnitPosition() is the bullet proved method. but in 99.9% of cases PipeDream's method will be the best solution.
__________________
Toadcop is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:15 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services