• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

[Solved] How to merge JASS?

Status
Not open for further replies.
Level 20
Joined
Jul 12, 2010
Messages
1,719
hey there, i need help to merge JASS triggers into 1...

TIPS:
1)im NOOB with Jass and i have absolutely no knowledge about it!!
2)can i merge the triggers if they were GUI and converted to custom text?

well here are the simple triggers that i want to merge...

  • Enter Dungeon lvl 1
    • Events
      • Unit - A unit enters Enter Dungeon lvl 1 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Exit Dungeon lvl 1 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 360.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
  • Exit Dungeon lvl 1
    • Events
      • Unit - A unit enters Exit Dungeon lvl 1 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Enter Dungeon lvl 1 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 180.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
  • Enter Dungeon lvl 2
    • Events
      • Unit - A unit enters Enter Dungeon lvl 2 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Exit Dungeon lvl 2 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 360.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
  • Exit Dungeon lvl 2
    • Events
      • Unit - A unit enters Exit Dungeon lvl 2 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Enter Dungeon lvl 2 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 180.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
  • Enter Dungeon lvl 3
    • Events
      • Unit - A unit enters Enter Dungeon lvl 3 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Exit Dungeon lvl 3 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 360.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
  • Exit Dungeon lvl 3
    • Events
      • Unit - A unit enters Exit Dungeon lvl 3 <gen>
    • Conditions
    • Actions
      • Set Move_Point[1] = (Center of Enter Dungeon lvl 3 <gen>)
      • Set Move_Point[2] = (Move_Point[1] offset by 100.00 towards 180.00 degrees)
      • Unit - Move (Triggering unit) instantly to Move_Point[2]
      • Custom script: call RemoveLocation(udg_Move_Point[1])
      • Custom script: call RemoveLocation(udg_Move_Point[2])
JASS:
function Trig_Enter_Dungeon_lvl_1_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Exit_Dungeon_lvl_1)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 360.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Enter_Dungeon_lvl_1 takes nothing returns nothing
    set gg_trg_Enter_Dungeon_lvl_1 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Enter_Dungeon_lvl_1, gg_rct_Enter_Dungeon_lvl_1 )
    call TriggerAddAction( gg_trg_Enter_Dungeon_lvl_1, function Trig_Enter_Dungeon_lvl_1_Actions )
endfunction
JASS:
function Trig_Exit_Dungeon_lvl_1_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Enter_Dungeon_lvl_1)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 180.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Exit_Dungeon_lvl_1 takes nothing returns nothing
    set gg_trg_Exit_Dungeon_lvl_1 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Exit_Dungeon_lvl_1, gg_rct_Exit_Dungeon_lvl_1 )
    call TriggerAddAction( gg_trg_Exit_Dungeon_lvl_1, function Trig_Exit_Dungeon_lvl_1_Actions )
endfunction
JASS:
function Trig_Enter_Dungeon_lvl_2_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Exit_Dungeon_lvl_2)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 360.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Enter_Dungeon_lvl_2 takes nothing returns nothing
    set gg_trg_Enter_Dungeon_lvl_2 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Enter_Dungeon_lvl_2, gg_rct_Enter_Dungeon_lvl_2 )
    call TriggerAddAction( gg_trg_Enter_Dungeon_lvl_2, function Trig_Enter_Dungeon_lvl_2_Actions )
endfunction
JASS:
function Trig_Exit_Dungeon_lvl_2_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Enter_Dungeon_lvl_2)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 180.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Exit_Dungeon_lvl_2 takes nothing returns nothing
    set gg_trg_Exit_Dungeon_lvl_2 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Exit_Dungeon_lvl_2, gg_rct_Exit_Dungeon_lvl_2 )
    call TriggerAddAction( gg_trg_Exit_Dungeon_lvl_2, function Trig_Exit_Dungeon_lvl_2_Actions )
endfunction
JASS:
function Trig_Enter_Dungeon_lvl_3_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Exit_Dungeon_lvl_3)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 360.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Enter_Dungeon_lvl_3 takes nothing returns nothing
    set gg_trg_Enter_Dungeon_lvl_3 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Enter_Dungeon_lvl_3, gg_rct_Enter_Dungeon_lvl_3 )
    call TriggerAddAction( gg_trg_Enter_Dungeon_lvl_3, function Trig_Enter_Dungeon_lvl_3_Actions )
endfunction
JASS:
function Trig_Exit_Dungeon_lvl_3_Actions takes nothing returns nothing
    set udg_Move_Point[1] = GetRectCenter(gg_rct_Enter_Dungeon_lvl_3)
    set udg_Move_Point[2] = PolarProjectionBJ(udg_Move_Point[1], 100.00, 180.00)
    call SetUnitPositionLoc( GetTriggerUnit(), udg_Move_Point[2] )
    call RemoveLocation(udg_Move_Point[1])
    call RemoveLocation(udg_Move_Point[2])
endfunction

//===========================================================================
function InitTrig_Exit_Dungeon_lvl_3 takes nothing returns nothing
    set gg_trg_Exit_Dungeon_lvl_3 = CreateTrigger(  )
    call TriggerRegisterEnterRectSimple( gg_trg_Exit_Dungeon_lvl_3, gg_rct_Exit_Dungeon_lvl_3 )
    call TriggerAddAction( gg_trg_Exit_Dungeon_lvl_3, function Trig_Exit_Dungeon_lvl_3_Actions )
endfunction

as you can see that takes 6 triggers and it would be way better if it could take only 1..

thnx in advance and +rep to anybody that helps me!! :grin:
 
I can help..
I'll edit this post soon.

JASS:
function Dungeon_enter1 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Exit_Dungeon_lvl_1)+100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Exit_Dungeon_lvl_1))
    return false
endfunction

function Dungeon_exit1 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Enter_Dungeon_lvl_1)-100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Enter_Dungeon_lvl_1))
    return false
endfunction

function Dungeon_enter2 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Exit_Dungeon_lvl_2)+100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Exit_Dungeon_lvl_2))
    return false
endfunction

function Dungeon_exit2 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Enter_Dungeon_lvl_2)-100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Enter_Dungeon_lvl_2))
    return false
endfunction


function Dungeon_enter3 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Exit_Dungeon_lvl_3)+100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Exit_Dungeon_lvl_3))
    return false
endfunction

function Dungeon_exit3 takes nothing returns boolean
    call SetUnitX(GetTriggerUnit(),GetRectCenterX(gg_rct_Enter_Dungeon_lvl_3)-100.0)
    call SetUnitY(GetTriggerUnit(),GetRectCenterY(gg_rct_Enter_Dungeon_lvl_3))
    return false
endfunction

function InitTrig_Dungeons_1_2_3 takes nothing returns nothing
    local trigger t = CreateTrigger()
    local region r = CreateRegion()
    call RegionAddRect(r,gg_rct_Enter_Dungeon_lvl_1)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_enter1))
    set t = CreateTrigger()
    set r = CreateRegion()
    call RegionAddRect(r,gg_rct_Exit_Dungeon_lvl_1)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_exit1))
    set t = CreateTrigger()
    set r = CreateRegion()
    call RegionAddRect(r,gg_rct_Enter_Dungeon_lvl_2)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_enter1))
    set t = CreateTrigger()
    set r = CreateRegion()
    call RegionAddRect(r,gg_rct_Exit_Dungeon_lvl_2)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_exit2))
    set t = CreateTrigger()
    set r = CreateRegion()
    call RegionAddRect(r,gg_rct_Enter_Dungeon_lvl_3)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_enter3))
    set t = CreateTrigger()
    set r = CreateRegion()
    call RegionAddRect(r,gg_rct_Exit_Dungeon_lvl_3)
    call TriggerRegisterEnterRegion(t,r,null)
    call TriggerAddCondition(t,Condition(function Dungeon_exit3))
    set t = null
    set r = null
endfunction

This should do.
It could be more efficient, but it's ok..

This is vanilla Jass btw.. It doesn't require JNGP
 
Level 26
Joined
Mar 19, 2008
Messages
3,140
Thats what most people tend to think. Vexorian wanted to name jass extension Jass++ but someone (don't remember who) suggested other name: vJass as shortcut from very Jass.

@xorkatoss JassCraft can help you a lot with functions finding if you aren't using NewGen - you can download it on Wc3C.net - plus you can use it to manipulate script without WE, what is very handy.
 
Level 20
Joined
Jul 12, 2010
Messages
1,719
@xorkatoss JassCraft can help you a lot with functions finding if you aren't using NewGen - you can download it on Wc3C.net - plus you can use it to manipulate script without WE, what is very handy.

ahh thnx for that program, it does kinda look like the one it has in JNGP, although i don't want to learn Jass, i still prefer GUI but if im going to leave GUI ill surely go for vJass, probably fail and go back to GUI again...
anyway thnx for the JassCraft +rep :grin:
 
Status
Not open for further replies.
Top