- Joined
- May 11, 2008
- Messages
- 1,198
so i was sick today and had to stay home, so a couple of days ago i started rewriting one of my map's biggest triggers. i used the broken trigger for reference and started from scratch. anyway today i finished it. doesn't seem to have any bugs and i got all of that in there.
please let me know what you think, jass experts.
and for jass newcomers...if you have questions about it just ask.
please let me know what you think, jass experts.
and for jass newcomers...if you have questions about it just ask.
JASS:
scope pickrunnerandchaserrewrite initializer I
private function randomedpandaskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_pandaren_flames, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function randomedmageskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_starfall, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_CAST )
call TriggerRegisterUnitEvent( gg_trg_starfall_off, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_ENDCAST )
endfunction
private function pandaskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_pandaren_flames, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function mageskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_starfall, GetTrainedUnit(), EVENT_UNIT_SPELL_CAST )
call TriggerRegisterUnitEvent( gg_trg_starfall_off, GetTrainedUnit(), EVENT_UNIT_SPELL_ENDCAST )
endfunction
private function randomedtreedemonskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_consume_tree, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
call TriggerRegisterUnitEvent( gg_trg_teleport_tree, GetLastReplacedUnitBJ(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function treedemonskills takes nothing returns nothing
call TriggerRegisterUnitEvent( gg_trg_consume_tree, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
call TriggerRegisterUnitEvent( gg_trg_teleport_tree, GetTrainedUnit(), EVENT_UNIT_SPELL_EFFECT )
endfunction
private function randomeddemonmageskills takes nothing returns nothing
call UnitAddItemByIdSwapped( udg_item_Copy[2], GetLastReplacedUnitBJ() )
call UnitAddItemByIdSwapped( udg_item_Copy[3], GetLastReplacedUnitBJ() )
endfunction
private function demonmageskills takes nothing returns nothing
call UnitAddItemByIdSwapped( udg_item_Copy[2], GetTrainedUnit() )
call UnitAddItemByIdSwapped( udg_item_Copy[3], GetTrainedUnit() )
endfunction
private function randomchaser takes nothing returns nothing
call ReplaceUnitBJ(GetTrainedUnit(), udg_chasers_random[GetRandomInt(0, 9)], bj_UNIT_STATE_METHOD_DEFAULTS )
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'Edem' then
call randomedmageskills()
else
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'Ofar' then
call randomedpandaskills()
else
endif
endif
endfunction
private function randomrunner takes nothing returns nothing
call ReplaceUnitBJ(GetTrainedUnit(), udg_runners_random[GetRandomInt(0, 25)], bj_UNIT_STATE_METHOD_DEFAULTS )
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'unec' then
call randomedtreedemonskills()
else
if GetUnitTypeId(GetLastReplacedUnitBJ()) == 'hdhw' then
call randomeddemonmageskills()
else
endif
endif
endfunction
private function pnameset takes nothing returns nothing
call SetPlayerName( GetOwningPlayer(GetTriggerUnit()), udg_strings[( GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())) + 12 )] )
endfunction
private function setmbiconitemreplaced takes nothing returns nothing
call MultiboardSetItemIconBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), udg_icons[GetUnitPointValue(GetLastReplacedUnitBJ())])
endfunction
private function setmbiconitemtrained takes nothing returns nothing
call MultiboardSetItemIconBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), udg_icons[GetUnitPointValue(GetTrainedUnit())])
endfunction
private function setmbitemname takes nothing returns nothing
call MultiboardSetItemValueBJ( udg_mainmultiboard, 1, S2I(udg_mbp[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]), GetPlayerName(GetOwningPlayer(GetTriggerUnit())) )
endfunction
private function rru takes nothing returns nothing
call UnitAddItemByIdSwapped( 'phlt', GetLastReplacedUnitBJ() )
call RemoveUnit(GetTriggerUnit())
endfunction
private function ru takes nothing returns nothing
call UnitAddItemByIdSwapped( 'phlt', GetTrainedUnit() )
call RemoveUnit(GetTriggerUnit())
endfunction
private function spawnflyer takes nothing returns nothing
call ReplaceUnitBJ(GetTriggerUnit(), 'nnht', bj_UNIT_STATE_METHOD_RELATIVE)
endfunction
private function A takes nothing returns nothing
if GetUnitTypeId(GetTriggerUnit()) == 'ncbf' or GetUnitTypeId(GetTriggerUnit()) == 'ncbe' or GetUnitTypeId(GetTriggerUnit()) == 'ndmg' then
if GetUnitTypeId(GetTrainedUnit()) == 'edot' then
call randomrunner()
call setmbiconitemreplaced()
call setmbitemname()
call pnameset()
call spawnflyer()
else
if GetUnitTypeId(GetTrainedUnit()) == 'unec' then
call treedemonskills()
call setmbiconitemtrained()
call setmbitemname()
call pnameset()
call spawnflyer()
else
if GetUnitTypeId(GetTrainedUnit()) == 'hdhw' then
call demonmageskills()
call setmbiconitemtrained()
call setmbitemname()
call pnameset()
call spawnflyer()
else
call setmbiconitemtrained()
call setmbitemname()
call pnameset()
call spawnflyer()
endif
endif
endif
else
if GetUnitTypeId(GetTriggerUnit()) == 'nfnp' then
if GetUnitTypeId(GetTrainedUnit()) == 'edry' then
call randomchaser()
call setmbitemname()
call setmbiconitemreplaced()
call pnameset()
call rru()
else
if GetUnitTypeId(GetTrainedUnit()) == 'Edem' then
call mageskills()
call setmbitemname()
call setmbiconitemtrained()
call pnameset()
call ru()
else
if GetUnitTypeId(GetTrainedUnit()) == 'Ofar' then
call pandaskills()
call setmbitemname()
call setmbiconitemtrained()
call pnameset()
call ru()
else
call setmbitemname()
call setmbiconitemtrained()
call pnameset()
call ru()
endif
endif
endif
else
endif
endif
endfunction
//===========================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_TRAIN_FINISH )
call TriggerAddAction( t, function A )
endfunction
endscope