First Script!

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

First Script!

Post by namespoofer »

It's my first JASS written trigger.. I used the 'New Trigger' template in JC..

Code: Select all

function Trig_NewTrigger_Conditions takes nothing returns boolean
    return ( GetPlayerName(GetTriggerPlayer()) == "WorldEdit" )
endfunction

function Trig_NewTrigger_Actions takes nothing returns nothing
local integer i
set i = 0
loop
    exitwhen i==3
    call DisplayTextToForce( GetPlayersAll(), "test x3")
    set i = i+1
endloop
endfunction

//==== Init Trigger NewTrigger ====
function InitTrig_NewTrigger takes nothing returns nothing
set gg_trg_NewTrigger = CreateTrigger()
//call TriggerRegister__(gg_trg_NewTrigger, )
call TriggerRegisterPlayerChatEvent (gg_trg_NewTrigger, Player(0), "-test", true)
call TriggerAddCondition(gg_trg_NewTrigger, Condition(function Trig_NewTrigger_Conditions))
call TriggerAddAction(gg_trg_NewTrigger, function Trig_NewTrigger_Actions)
endfunction


I can't figure out how to change the name of my trigger.. I only need to change it at

Code: Select all

function InitTrig_NewTrigger
TriggerAddCondition(gg_trg_NewTrigger
TriggerAddAction(gg_trg_NewTrigger


Correct?
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

every time you see a x_NewTrigger_x
or whatever, I'd change it there too.
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Post by namespoofer »

But functions can have any name, and can be called under the InitTrig right? So if I were to make a new trigger, and just call the cond/act function, it would work.. right? Or are function names specified to a certin trigger and that trigger only.. ahhh -.-
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

functions sure, but you'll need to make sure your event etc is hooked up to that - and the condition check..

also you have a few other places that NewTrigger shows up that are important to change... not all need to - but a lot do.
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Post by namespoofer »

What do I type to call a function? -.-
Just
call myfunc?

Now tell me what's wrong with this?

Code: Select all

function func1 takes nothing returns nothing
    call DisplayTextToForce(GetPlayersAll(), "You pressed ESC!")
endfunction

//==== Init Trigger NewTrigger ====
function InitTrig_test3 takes nothing returns nothing
    set gg_trg_test3 = CreateTrigger()
    //call TriggerRegister__(gg_trg_NewTrigger, )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_test3, Player(0))
    call func1
endfunction
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
Totti_8
S.M.B. Creator
Posts: 84
Joined: January 20th, 2007, 11:32 am
Location: Germany

Post by Totti_8 »

you can't write "call func1"

the InitTrig Action runs at Initalization of the map and so it wouldn't work if you only write this. There should be "call TriggerAddAction(<yourTrigger>, <yourFunction>)"
Image
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Post by namespoofer »

What's the script for a weather effect variable? (I mean a local too)
Edit: I still would like to know the local name above, but for now I just declared it in globals.. -.-

I'm having trouble with this trigger, the world editor is telling me that this line is an 'invalid argument type (unitevent)'

Code: Select all

call TriggerAddCondition(gg_trg_spell2, (Condition (function spell2_cond))


And here is the whole trigger!

Code: Select all

function spell2_cond takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction

function spell2_act takes nothing returns nothing
call AddWeatherEffect( gg_rct_blizzard_spell3, 'SNbs')
set udg_weather = GetLastCreatedWeatherEffect()
call TriggerSleepAction( 6.00)
call RemoveWeatherEffectBJ(udg_weather)
set udg_weather = null
      endfunction

//==== Init Trigger NewTrigger ====
function InitTrig_spell2 takes nothing returns nothing
    set gg_trg_spell2 = CreateTrigger()
    //call TriggerRegister__(gg_trg_NewTrigger, )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_spell2, EVENT_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_spell2, (Condition (function spell2_cond))
    call TriggerAddAction(gg_trg_spell2, function spell2_act)
endfunction


Spoofzz
Last edited by namespoofer on June 14th, 2007, 5:15 pm, edited 1 time in total.
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
Totti_8
S.M.B. Creator
Posts: 84
Joined: January 20th, 2007, 11:32 am
Location: Germany

Post by Totti_8 »

Code: Select all

(Condition (function spell2_cond))


you should delete the Space " " after "Condition" ;)
Image
namespoofer
V.I.P.
Posts: 332
Joined: March 4th, 2007, 12:39 am
Location: United States

Post by namespoofer »

Ooo again you help me! Thank you Totti!

Edit: Still doesn't work! -.- I tried deleteing other spaces.. but I thought spaces didn't matter? :?
Image
Doesn't Dekar make the world easier?

"I Wumbo. YOU Wumbo. He she me.. WUMbo. Wumbo; WumboING; WumBOLogy; the study of WUMBO. It's first grade, Spongebob!"
"I'm sorry I doubted your great wisdom Patrick!"

Catch me on Azeroth (U.S. East) - NameSpoofer
User avatar
Dekar
Forum Drunk
Posts: 2895
Joined: January 17th, 2007, 4:22 pm
Location: Darmstadt, Germany

Post by Dekar »

The WE(U)-syntax-check is sometimes wrong... Just don't worry about it,
as long as jasscraft reports no errors. ;)
Don't pm me with Warcraft questions, this is a forum so just make a post!

In the world of thinking we are all immigrants. -Robert Nozick