| 03-27-2005, 05:27 AM | #1 |
Okay, originally this trigger was all GUI with global variables to see if it worked right before I converted the global variables into locals. Well, I switched the unit variable over to local, worked fine. Then I switch the effect variable over, and nah ah. I don't know why it isn't working, I don't think I have anything wrong with the syntax. It's expecting me to have 'endloop' and is expected a name for removing the effects line. I'm not sure what my syntax error is, any help? Code:
Blazed Tower
Events
Unit - A unit Is attacked
Conditions
Or - Any (Conditions) are true
Conditions
((Attacked unit) has buff Blaze (Level 1)) Equal to True
((Attacked unit) has buff Blaze (Level 2)) Equal to True
Actions
Custom script: local unit u = GetAttackedUnitBJ()
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Attacked unit) has buff Blaze (Level 1)) Equal to True
Then - Actions
Custom script: loop
Custom script: exitwhen ( IsUnitAliveBJ( u ) ) == false
Custom script: call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) - 50.00 ) )
Custom script: call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" )
Custom script: local effect sfx = GetLastCreatedEffectBJ()
Wait 0.90 seconds
Custom script: call DestroyEffectBJ( sfx )
Custom script: endloop
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Attacked unit) has buff Blaze (Level 2)) Equal to True
Then - Actions
Custom script: loop
Custom script: exitwhen ( IsUnitAliveBJ( u ) ) == false
Custom script: call SetUnitLifeBJ( u, ( GetUnitStateSwap(UNIT_STATE_LIFE, u) - 100.00 ) )
Custom script: call AddSpecialEffectTargetUnitBJ( "chest", u, "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" )
Custom script: local effect sfx = GetLastCreatedEffectBJ()
Wait 0.90 seconds
Custom script: call DestroyEffectBJ( sfx )
Custom script: endloop
Else - ActionsThis 'should' be my last topic for awhile after this. |
| 03-27-2005, 12:03 PM | #2 |
Guest | So many "custom script", convert it to jass! 'B**x' - Blaze (Level 1) 'B**y' - Blaze (Level 2) Code:
function Trig_Blazed_Tower_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
return UnitHasBuffBJ(u, 'B**x') or UnitHasBuffBJ(u, 'B**y')
endfunction
function Trig_Blazed_Tower_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real f = 50 //Blaze (Level 1)
local effect eff
if UnitHasBuffBJ(u, 'B**y') then
//Blaze (Level 2)
set f = 100
endif
loop
exitwhen IsUnitDeadBJ(u)
call SetUnitLifeBJ( u, GetUnitState(u, UNIT_STATE_LIFE)-f )
set eff = AddSpecialEffectTarget( "Abilities\\Spells\\Other\\Incinerate\\FireLordDeat hExplode.mdl", u, "chest" )
call TriggerSleepAction(0.9)
call DestroyEffect(eff)
endloop
endfunction
function InitTrig_Blazed_Tower takes nothing returns nothing
set gg_trg_Blazed_Tower = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Blazed_Tower, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Blazed_Tower, Condition(function Trig_Blazed_Tower_Conditions))
call TriggerAddAction(gg_trg_Blazed_Tower, function Trig_Blazed_Tower_Actions)
endfunction |
| 03-27-2005, 02:28 PM | #3 |
you can only declare local variables at the very start of a function |
| 03-27-2005, 05:00 PM | #4 |
I got the trigger working, I posted this in another forum, because I'm noticing that it takes way longer for a response here than it does there. But I know why it wasn't working now. Thanks anyway though. |
