| 04-04-2009, 07:43 AM | #1 |
I hope Vexorian will care about it now ... JASS:library BoundSentinel initializer init //************************************************* //* BoundSentinel //* ------------- //* Don't leave your units unsupervised, naughty //* them may try to get out of the map bounds and //* crash your game. //* //* To implement, just get a vJass compiler and //* copy this library/trigger to your map. //* //************************************************* //================================================== //========================================================================================= globals private constant boolean ALLOW_OUTSIDE_PLAYABLE_MAP_AREA = true private real maxx private real maxy private real minx private real miny endglobals //======================================================================= private function dis takes nothing returns boolean local unit u=GetLeavingUnit() local real x=GetUnitX(u) local real y=GetUnitY(u) // uncomment the line above may result to spam messages. // debug call BJDebugMsg("you try to move the unit " + GetUnitName(u) + " outside the entire map, that will crash the game") if(x>maxx) then call SetUnitX(u,maxx) set u = null return false elseif(x<minx) then call SetUnitX(u,minx) set u = null return false endif if(y>maxy) then call SetUnitY(u,maxy) elseif(y<miny) then call SetUnitY(u,miny) endif set u=null return false endfunction private function init takes nothing returns nothing local trigger t = CreateTrigger() local region r = CreateRegion() local rect map local rect rc if ALLOW_OUTSIDE_PLAYABLE_MAP_AREA then set map = GetWorldBounds() else set map = bj_mapInitialPlayableArea endif set minx = GetRectMinX(map) set miny = GetRectMinY(map) set maxx = GetRectMaxX(map) set maxy = GetRectMaxY(map) set rc=Rect(minx,miny,maxx,maxy) call RegionAddRect(r, rc) call RemoveRect(rc) if ALLOW_OUTSIDE_PLAYABLE_MAP_AREA then call RemoveRect(map) endif call TriggerRegisterLeaveRegion(t,r, null) call TriggerAddCondition(t, Condition(function dis)) set rc=null set map = null endfunction endlibrary |
| 04-05-2009, 09:31 AM | #2 |
what is it good for? i mean... who would like to crash the game entirely on purpose? |
| 04-05-2009, 03:46 PM | #3 | |
Quote:
and this system is basically by Vexorian ...but TrollBrain made this revision because he thinks Vex's has some issues (dunno excactly what... to lazy to read that thread.) |
| 04-05-2009, 04:03 PM | #4 |
Why is this: JASS:if(x>maxx) then call SetUnitX(u,maxx) set u = null return false elseif(x<minx) then call SetUnitX(u,minx) set u = null return false endif Different from this? JASS:if(y>maxy) then call SetUnitY(u,maxy) elseif(y<miny) then call SetUnitY(u,miny) endif Why does the first null and return false, but the second does not? |
| 04-05-2009, 07:52 PM | #5 |
Vex should fix it, I agree, but I don't think submitting a 'fixed' version is the way to get him to do it. |
| 04-05-2009, 08:35 PM | #6 |
@darkwulfv : For speed freak. Even if you use SetUnitX / SetUnitY (X and Y outside the allowed area) in a same function without any wait beetween them, the trigger will run twice. Now, imagine what's happen when the trigger is running because of SetUnitX or SetUnitY. @Rising_Dusk : Sure, but should i make a triple post ? |
| 04-05-2009, 08:43 PM | #7 |
Have you tried sending him a PM? |
| 04-05-2009, 08:53 PM | #8 |
No i didn't try, i guess he has many pms and don't read all of them. But meh delete this thread if you think you have to do it. |
| 04-06-2009, 04:02 AM | #9 | |
Quote:
|
| 04-06-2009, 03:06 PM | #10 |
After fixing the lack of "boolean", it crashes on xe's map when using ALLOW_OUTSIDE_..=true , and shooting a missile towards the top and without it, it looks very bad. |
| 04-06-2009, 04:27 PM | #11 | ||
@Here-b-Trollz : Fixed, thx. @Vexorian : Fixed the lack of "boolean" Quote:
Quote:
You don't allow it for the left and the right in your version. But if allow moving an unit a little outside the playable map area is really usefull, then i can add a constant like you. EDIT : Anyway it's your library, you have all the keys. |
| 04-06-2009, 05:00 PM | #12 | |
Quote:
|
| 04-06-2009, 07:06 PM | #13 |
Why in the world are you updating your script, Troll? I mean, really, what was 'wrong' with Vex's script in simple terms and after that will Vex fix it if it's indeed wrong. That's really the only discussion that needs to happen here. |
| 04-06-2009, 08:26 PM | #14 | |
Quote:
@Vexorian : Could you post your script plz, i'm curious of what thing can crash. |
| 04-06-2009, 11:00 PM | #15 |
Turtle rock, then use SetUnitX/SetUnitY to move a missile towards a direction, point top. I think that relying only on world bounds causes the crash. Alternatively, you can pick xe's map, then change double green fire so their expiration times are rather large, shoot this missiles towards the top with a slight deviation to the right, then wait, it takes a while but it crashes. |
