HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Custom Script / Jass Help

01-08-2005, 09:29 PM#1
oNdizZ
I dont really know if this is the right place but, anyway...

Can someone tell me what I should write in the custom script (GUI Action) to make a new trigger?

and, when i used that, what should i write (in a new custom script action) to set the trigger into a variable-array?
01-09-2005, 07:48 PM#2
oNdizZ
bump bump :/
if you didn't get it:
for example:
Custom Script: call "createnewtrigger called bla bla red"
set "last created trigger" = bla bla [1]

anyone plz?


rep for a good (working) answer...
isn't anyone tempted? :p
01-09-2005, 07:57 PM#3
PitzerMike
Hm that's easy.

In the variable editor make a trigger variable named WHATEVER

Custom Script: set udg_WHATEVER = CreateTrigger()

But yeah, the trigger won't do anything. You'll have to register events, add an action and a condition if you need one.
Simply convert an existing trigger to custom text and see how it's done there and how to use TriggerAddAction and TriggerAddCondition.

Oh, and if WHATEVER is a trigger array you'd have:

Custom Script: set udg_WHATEVER[Index] = CreateTrigger()
where Index is an integer
01-09-2005, 08:30 PM#4
oNdizZ
hmm, now it got really harder :P there a bunch of other jass here than calls :)

I named the trigger Test_Copy and used the all actions events conds that i wanted the real var. trigger to have later on, but huh? check the both blue marked things. the first one is on the converted and the second is on the original GUI trigger:

Code:
function Trig_Test_Copy_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetDyingUnit()) == [color=Blue]Player(1)[/color] ) ) then
        return false
    endif
    return true
endfunction

function Trig_Test_Copy_Func001C takes nothing returns boolean
    if ( not ( udg_AssaKillCountJobs[1] != 5 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Test_Copy_Actions takes nothing returns nothing
    if ( Trig_Test_Copy_Func001C() ) then
        set udg_AssaKillCountJobs[1] = ( udg_AssaKillCountJobs[1] + 1 )
    else
        call QuestMessageBJ( bj_FORCE_PLAYER[0], bj_QUESTMESSAGE_COMPLETED, "TRIGSTR_297" )
        call AdjustPlayerStateBJ( 250, Player(0), PLAYER_STATE_RESOURCE_GOLD )
        call AddHeroXPSwapped( 100, udg_Hero[1], true )
        call DestroyQuest( udg_AssaQuest[1] )
        call DestroyTrigger( udg_Assassin_Job[1] )
    endif
endfunction

//===========================================================================
function InitTrig_Test_Copy takes nothing returns nothing
    set gg_trg_Test_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Test_Copy, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Test_Copy, Condition( function Trig_Test_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Test_Copy, function Trig_Test_Copy_Actions )
endfunction

Code:
Test
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Equal to [color=Blue]Player 2 (Blue)[/color]
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                AssaKillCountJobs[1] Not equal to 5
            Then - Actions
                Set AssaKillCountJobs[1] = (AssaKillCountJobs[1] + 1)
            Else - Actions
                Quest - Display to Player Group - Player 1 (Red) the Quest Completed message: |cffffcc00CopKiller...
                Player - Add 250 to Player 1 (Red) Current gold
                Hero - Add 100 experience to Hero[1], Show level-up graphics
                Quest - Destroy AssaQuest[1]
                Trigger - Destroy Assassin_Job[1]

for me, it looks like it has been changed from player 2 to player 1 :/
01-09-2005, 11:19 PM#5
PitzerMike
Oh yeah, we programmers start counting at zero.

so GUI Player 1 = JASS Player(0)
and so on
01-11-2005, 03:42 PM#6
oNdizZ
ooookey. o_O
i can't understand why, but now i atleast understand why it is as it is =)