| 09-02-2009, 08:49 PM | #1 | |
I was just messing around with vJass, and I was wondering how you create region/rect and checks if unit enters it, and it gets transported instantly. However, I have found that one function that crashes with error 0x0000005. Here's my vJass code: JASS:scope Shops initializer Init globals rect bset = Rect(20288.0, -24480.0, 20480.0, -24320.0) rect bsex = Rect(-27040.0 , -29184.0 , -26912.0 , -28928.0) rect bsin = Rect(-26656.0, -29088.0, -26592.0, -29024.0) rect bsout = Rect(20416.0, -24288.0, 20480.0, -24224.0) region bsetr = CreateRegion() region bsexr = CreateRegion() region bsinr = CreateRegion() region bsoutr = CreateRegion() endglobals private function Cond_bi takes nothing returns boolean return GetOwningPlayer(GetEnteringUnit()) != Player(1) endfunction private function Cond_bo takes nothing returns boolean return GetOwningPlayer(GetEnteringUnit()) != Player(1) endfunction private function Action_bi takes nothing returns nothing call SetUnitPosition(GetEnteringUnit(), GetRectCenterX(bsin), GetRectCenterY(bsin)) call DisplayTextToPlayer(GetOwningPlayer(GetEnteringUnit()), 0, 0, "Blacksmith Shop") endfunction private function Action_bo takes nothing returns nothing call SetUnitPosition(GetEnteringUnit(), GetRectCenterX(bsout), GetRectCenterY(bsout)) call DisplayTextToPlayer(GetOwningPlayer(GetEnteringUnit()), 0, 0, "City") endfunction private function Init takes nothing returns nothing local trigger bi = CreateTrigger() local trigger bo = CreateTrigger() local trigger t1i = CreateTrigger() local trigger t1o = CreateTrigger() call RegionAddRect(bsinr, bsin) call RegionAddRect(bsoutr, bsout) call RegionAddRect(bsetr, bset) call RegionAddRect(bsexr, bsex) call TriggerRegisterEnterRegion(bi, bsetr, null) call TriggerRegisterEnterRegion(bo, bsexr, null) call TriggerAddCondition(bi, Condition(function Cond_bi)) call TriggerAddCondition(bo, Condition(function Cond_bo)) call TriggerAddAction(bi, function Action_bi) call TriggerAddAction(bo, function Action_bo) set bi = null set bo = null set t1i = null set t1o = null endfunction endscope Quote:
Also, the map is insanely huge as well. |
| 09-02-2009, 11:09 PM | #2 |
My bet is on these lines... JASS:region bsetr = CreateRegion() region bsexr = CreateRegion() region bsinr = CreateRegion() region bsoutr = CreateRegion() |
| 09-02-2009, 11:28 PM | #3 | |
Quote:
This man speaks the truth, god bless him. |
| 09-03-2009, 12:09 AM | #4 |
Thanks! That worked. I searched through lot of Jass and vJass tutorials for region/rect part and I couldn't find it. I was wondering how region were created. Someone should make a tutorial for region and rect in Jass. Anyhow, thanks again Michael Peppers |
| 09-03-2009, 12:16 AM | #5 | ||
Quote:
No problem, I like to help if I can ![]() Quote:
![]() |
| 09-03-2009, 12:35 AM | #6 |
At first, it didn't work after I fixed the CreateRegion() thing, found out that you can't set rect(x,y,xx,yy) as well on the global. Something for me to remember now :P |
| 09-03-2009, 12:46 AM | #7 | ||
Quote:
ORLY? Please use this parse: Quote:
! ![]() |
| 09-03-2009, 12:58 AM | #8 | |||
Quote:
Ah, yes, now I remember, those things are functions (that give values, but still...) and in the global block you can only declare values. Quote:
Don't be angry if I don't :D |
| 09-03-2009, 01:12 AM | #9 | |
Quote:
Edit: I just thought of something, if you don't null it, wouldn't it build over time, like stacking it up each time the trigger executes? |
| 09-03-2009, 04:11 PM | #10 | |
Quote:
I apologize for the double post, but editing post doesn't bump the post. :( |
