• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJass] Trigger Causes Warcraft to Crash

Status
Not open for further replies.
Level 1
Joined
Jan 21, 2008
Messages
7
Hi, thanks for looking.

I am having some trouble with my trigger it causes the game to crash when triggered. i have no idea why, but it does. Nobody else that i talk to seems to know what to do about it :cry: So i hope that someone can help me out. :wthumbsup:
JASS:
scope ChangeTerrainP1

private function actions takes nothing returns nothing
    local location l
    local real x
    local real y
    local integer i
    call TriggerSleepAction ( 0.001 )
    set l = GetUnitRallyPoint ( GetTriggerUnit() )
    set x = GetLocationX(l)
    set y = GetLocationY(l)
    if 'T1x1' == GetUnitTypeId ( GetTriggerUnit() ) then
        set i = 1
    else
        set i = 2
    endif
    if IsPointInRegion( area[0], x, y ) then
        call SetTerrainType ( x, y, terrainid[0], -1, i, 1 )
    endif
    call RemoveLocation( l )
endfunction

//===========================================================================
function InitTrig_ChangeTerrainP1 takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent( t, gg_unit_T1x1_0010, EVENT_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterUnitEvent( t, gg_unit_T3x3_0009, EVENT_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddAction( t, function actions )
endfunction

endscope
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
terrainid[0] might be a nonexistant path, I don't know if that's it, but try remove that temporarily.
Side note: your first few lines can be compressed from:
JASS:
local location l
    local real x
    local real y
    local integer i
    call TriggerSleepAction ( 0.001 )
    set l = GetUnitRallyPoint ( GetTriggerUnit() )
    set x = GetLocationX(l)
    set y = GetLocationY(l)
to
JASS:
    local real x = GetUnitX(GetTriggerUnit())
    local real y = GetUnitY(GetTriggerUnit())
--donut3.5--
 
Level 1
Joined
Jan 21, 2008
Messages
7
You both are wrong,
@ Eleandor
The wait is not the problem, i have taken it out, and warcraft still has the same error. I need that in there because, if i dont then it sets l to were the rally point was before i set it, i need to give the game just i tinny blip of time before i set a location equal to that point.

@Donut3.5
I dont want to set then to where the triggering unit is, i want them to be set to where the rally point is, so that i can use them in...
JASS:
SetTerrainType ( x, y, terrainid[0], -1, i, 1 )
Im using the x and y, because if just use the location, i would have to use the other function, which is a BJ...
 
Status
Not open for further replies.
Top