wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-17-2007, 12:44 AM   #1
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default Question on triggers

Would my local trigger run everytime the event happens when i do this?
Collapse JASS:
function Trig_Guarding_Angel_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function Trig_Guarding_Angel_Actions takes nothing returns nothing
    local trigger t = CreateTrigger()

    call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED )
    call TriggerAddAction( t, function Trig_Guarding_Angel_Effect )
    
    set t = null
endfunction

//===========================================================================
function InitTrig_Guarding_Angel takes nothing returns nothing
    set gg_trg_Guarding_Angel = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) )
    call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions )
endfunction


Last edited by Joker : 04-17-2007 at 12:44 AM.
Joker is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-17-2007, 01:03 AM   #2
Mezzer
:emote_grin:
 
Mezzer's Avatar
 
Join Date: Nov 2004
Posts: 841

Submissions (1)

Mezzer has a spectacular aura about (77)Mezzer has a spectacular aura about (77)Mezzer has a spectacular aura about (77)

Send a message via MSN to Mezzer Send a message via Yahoo to Mezzer
Default

Yes it would.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
Mezzer is offline   Reply With Quote
Old 04-17-2007, 08:54 PM   #3
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

how would i get it to stop?
Joker is offline   Reply With Quote
Old 04-17-2007, 09:35 PM   #4
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

OMFG I CANT READ

Last edited by akolyt0r : 04-18-2007 at 04:14 PM.
akolyt0r is offline   Reply With Quote
Old 04-18-2007, 12:04 AM   #5
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

Your just creating a timer. How would that stop the trigger? Mezzer said my local trigger would run everytime the event occured.
Joker is offline   Reply With Quote
Old 04-18-2007, 04:16 PM   #6
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

damn i cant READ


this one should work
(if you want Trig_Guarding_Angel_Effect to run only once)
Collapse JASS:
function Trig_Guarding_Angel_Effect takes nothing returns nothing
call DestroyTrigger(GetTriggeringTrigger())
//do stuff
endfunction

if you want Trig_Guarding_Angel_Effect more often things get more complicated ..(you would need a global variable (not MUI) or gamecache or ... )

Last edited by akolyt0r : 04-18-2007 at 04:20 PM.
akolyt0r is offline   Reply With Quote
Old 04-18-2007, 08:21 PM   #7
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

Would it work if i start a timer and destroy the trigger after the timer expires so that it would run more than once?

Edit: Another Question: Is it better to not use the InitTrig_Name?

Last edited by Joker : 04-18-2007 at 08:54 PM.
Joker is offline   Reply With Quote
Old 04-18-2007, 08:57 PM   #8
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

let me think ....
i think it would work ..somehow..but ..you might want to ask one of the other "more advanced" guys her too...

EDIT2:IGNORE THIS!:
Collapse JASS:
function Trig_Guarding_Angel_Effect takes nothing returns nothing
local timer t=GetExpiredTimer()
//if t!=null then
//    call DestroyTrigger(GetTriggeringTrigger())
//    call PauseTimer(t)
//    call DestroyTimer(t)
//    return
//endif
//
//Do Stuff
endfunction

function Trig_Guarding_Angel_Actions takes nothing returns nothing
    local trigger t = CreateTrigger()
    local timer T=CreateTimer()
    call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED )
    call TriggerAddAction( t, function Trig_Guarding_Angel_Effect )
    call TriggerRegisterTimerEventSingle(t,3.0)
    set t = null
    set T = null
endfunction

EDIT: i tried it, but i get a war3critical error when the unit is damaged...
EDIT2: found the error ,,cant be fixed -.-

Last edited by akolyt0r : 04-18-2007 at 09:12 PM.
akolyt0r is offline   Reply With Quote
Old 04-18-2007, 09:23 PM   #9
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

BUG

I was thinking more like this:

Collapse JASS:
function Trig_Guarding_Angel_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function Trig_Guarding_Angel_Effect takes nothing returns nothing
    call SetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE, GetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE ) + GetEventDamage() )
    //some game cache storing the damage to heal
    call PolledWait(15)
    call TriggerRemoveAction( Trig_Guarding_Angel_Actions )
endfunction

function Trig_Guarding_Angel_Actions takes nothing returns nothing
    local trigger t = CreateTrigger()

    call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED )
    call TriggerAddAction( t, function Trig_Guarding_Angel_Effect )
    
    set t = null
endfunction

//===========================================================================
function InitTrig_Guarding_Angel takes nothing returns nothing
    set gg_trg_Guarding_Angel = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) )
    call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions )
endfunction

would this work?
Joker is offline   Reply With Quote
Old 04-18-2007, 09:37 PM   #10
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

then dont give me the idea you want a timer -.-"

WRONG

Collapse JASS:
...WRONG
WRONG

Last edited by akolyt0r : 04-19-2007 at 04:46 AM.
akolyt0r is offline   Reply With Quote
Old 04-18-2007, 09:43 PM   #11
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

About the timers...I was going to make one, but then i remembered PolledWait did the same thing so i just used it. And i want the spell casted once like the cooldown would be higher than my PolledWait if thats what you mean
Joker is offline   Reply With Quote
Old 04-19-2007, 04:02 PM   #12
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

only once during the whole game ??

or

how many hits should this spell "absorb" ??

Collapse JASS:
    call SetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE, GetUnitState( GetDamagedUnit(), UNIT_STATE_LIFE ) + GetEventDamage() )
//use GetTriggerUnit() here

Last edited by akolyt0r : 04-19-2007 at 04:05 PM.
akolyt0r is offline   Reply With Quote
Old 04-19-2007, 08:42 PM   #13
Joker
User
 
Joker's Avatar
 
Join Date: Sep 2006
Posts: 687

Joker will become famous soon enough (32)Joker will become famous soon enough (32)

Default

It should absorb until the wait is up
Joker is offline   Reply With Quote
Old 04-20-2007, 11:10 AM   #14
akolyt0r
In Flames
 
akolyt0r's Avatar
 
Join Date: Jan 2006
Posts: 1,154

Submissions (3)

akolyt0r has a spectacular aura about (120)

Default

Collapse JASS:
function Trig_Guarding_Angel_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction

function Trig_Guarding_Angel_Effect takes nothing returns nothing
    call SetUnitState( GetTriggerUnit(), UNIT_STATE_LIFE, GetUnitState( GetTriggerUnit(), UNIT_STATE_LIFE ) + GetEventDamage() )
endfunction

function Trig_Guarding_Angel_Actions takes nothing returns nothing
    local trigger t = CreateTrigger()
    local triggerevent ta
    call TriggerRegisterUnitEvent( t, GetSpellAbilityUnit(), EVENT_UNIT_DAMAGED )
    set ta=TriggerAddAction( t, function Trig_Guarding_Angel_Effect )
    call PolledWait(5)
    call TriggerRemoveAction(t,ta)
    set t = null
endfunction

//===========================================================================
function InitTrig_Guarding_Angel takes nothing returns nothing
    set gg_trg_Guarding_Angel = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Guarding_Angel, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Guarding_Angel, Condition( function Trig_Guarding_Angel_Conditions ) )
    call TriggerAddAction( gg_trg_Guarding_Angel, function Trig_Guarding_Angel_Actions )
endfunction

Last edited by akolyt0r : 04-20-2007 at 03:02 PM.
akolyt0r is offline   Reply With Quote
Old 04-20-2007, 02:07 PM
akolyt0r
This message has been deleted by akolyt0r. Reason: ..
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 11:29 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2020, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services