wc3edit.net

United Warcraft 3 map hacking!
It is currently March 29th, 2024, 8:19 am

All times are UTC




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: First Script!
PostPosted: June 14th, 2007, 3:13 am 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
It's my first JASS written trigger.. I used the 'New Trigger' template in JC..
Code:
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:
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


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 3:18 am 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
every time you see a x_NewTrigger_x
or whatever, I'd change it there too.


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 3:28 am 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
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


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 3:32 am 
Offline
Honorary wc3edit.net Traitor
User avatar

Joined: February 1st, 2007, 4:11 pm
Posts: 2513
Location: NEVADA
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.


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 3:37 am 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
What do I type to call a function? -.-
Just
call myfunc?

Now tell me what's wrong with this?

Code:
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


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 6:04 am 
Offline
S.M.B. Creator
User avatar

Joined: January 20th, 2007, 11:32 am
Posts: 84
Location: Germany
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


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 7:46 am 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
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:
call TriggerAddCondition(gg_trg_spell2, (Condition (function spell2_cond))


And here is the whole trigger!
Code:
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

_________________
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


Last edited by namespoofer on June 14th, 2007, 5:15 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 11:25 am 
Offline
S.M.B. Creator
User avatar

Joined: January 20th, 2007, 11:32 am
Posts: 84
Location: Germany
Code:
(Condition (function spell2_cond))


you should delete the Space " " after "Condition" ;)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 5:14 pm 
Offline
V.I.P.
User avatar

Joined: March 4th, 2007, 12:39 am
Posts: 332
Location: United States
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


Top
 Profile  
 
 Post subject:
PostPosted: June 14th, 2007, 5:37 pm 
Offline
Forum Drunk
User avatar

Joined: January 17th, 2007, 4:22 pm
Posts: 2903
Location: Darmstadt, Germany
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)