Name | Type | is_array | initial_value |
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Respawn_Actions takes nothing returns nothing
local unit x = GetTriggerUnit()
local integer i = GetUnitTypeId(x)
local location l = GetUnitLoc(x)
local location l2 = GetRectCenter(gg_rct_Region_000)
local unit y = CreateUnitAtLoc( Player(1), i, l2, bj_UNIT_FACING )
call IssuePointOrderLoc( y, "move", l )
call RemoveUnit(x)
set x = null
set y = null
call RemoveLocation(l)
call RemoveLocation(l2)
endfunction
//===========================================================================
function InitTrig_Respawn takes nothing returns nothing
local trigger Respawn = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( Respawn, Player(1), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( Respawn, function Respawn_Actions )
endfunction
//TESH.scrollpos=7
//TESH.alwaysfold=0
library SimError initializer init
//**************************************************************************************************
//*
//* SimError
//*
//* Mimic an interface error message
//* call SimError(ForPlayer, msg)
//* ForPlayer : The player to show the error
//* msg : The error
//*
//* To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************
//==================================================================================================
globals
private sound error
endglobals
//====================================================================================================
function Error takes player ForPlayer, string msg returns nothing
set msg="\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+msg+"|r"
if (GetLocalPlayer() == ForPlayer) then
call ClearTextMessages()
call DisplayTimedTextToPlayer( ForPlayer, 0.52, 0.96, 2.00, msg )
call StartSound( error )
endif
endfunction
private function init takes nothing returns nothing
set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
//call StartSound( error ) //apparently the bug in which you play a sound for the first time
//and it doesn't work is not there anymore in patch 1.22
endfunction
endlibrary
//TESH.scrollpos=20
//TESH.alwaysfold=0
native UnitAlive takes unit u returns boolean
scope Mystic initializer InitTrig_Mystic_Wolf
private constant function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' // ID of your spell
endfunction
private function Actions takes nothing returns nothing
// Don't change these
local unit x = GetTriggerUnit()
local location l = GetSpellTargetLoc()
local player xo = GetOwningPlayer(x)
local unit y
local integer lvl = GetUnitAbilityLevel(x, 'A000')
local real rnd = GetRandomReal(1 , 100)
local integer array d
// End
// Config variables bellow.
local boolean txt = true //displays debug messeges if set to true.
local boolean order = true // if the caster should get Ordered to stop after cast.
local boolean special = true // if set to true, you will have a chance (set bellow) to summon a special wolf.
local real mps = 4. - lvl // mana per second drained.
local real mps_rnd = 4. - lvl
local real t = 1. // the delay in which the caster looses mana.
local real chance = 25. // The chance to summon a special wolf.
// Dummy Units
set d[1]='n001' // This one will be created if level==1 (as you see in [])
set d[2]='n000' // This one will be created if level==2 (as you see in [])
set d[3]='n002' // This one will be created if level==3 (as you see in [])
set d[4]='n003' // This is the RawCode of special
// End of Dummy Units
// End of Config variables.
if GetUnitState(x , UNIT_STATE_MANA) < 1 then
call Error(GetOwningPlayer(x), "Not enough mana")
call RemoveLocation(l)
set x = null
set y = null
return
else
if rnd <= chance and special == true then
set mps = mps + mps_rnd
set y = CreateUnitAtLoc (xo, d[4], l, 0.) // We have a chance of 25% to summon a special Wolf.
else
set y = CreateUnitAtLoc (xo, d[lvl], l, 0.)
endif
endif
if order == true then
call IssueImmediateOrder(x , "stop") // if order is set to true, it will order the caster to stop.
endif
loop
exitwhen UnitAlive(y) == false or GetUnitState(x , UNIT_STATE_MANA) < 1 or UnitAlive(x) == false
call SetUnitState(x , UNIT_STATE_MANA , GetUnitState(x, UNIT_STATE_MANA) - mps) // we set the mana of the caster to his mana - variable mps.
call TriggerSleepAction(t) // delay action, deafult 1.
endloop
if txt == true then
if UnitAlive(y) == false then
call DisplayTimedTextToPlayer(Player(0), 0, 0, 2.5 , "Wolf has died.")
elseif UnitAlive(x) == false then
call DisplayTimedTextToPlayer(Player(0), 0, 0, 2.5 ,"The caster has died, therefore the wolf dies.")
elseif GetUnitState(x , UNIT_STATE_MANA) < 1 then
call DisplayTimedTextToPlayer(Player(0), 0, 0, 2.5 ,"The caster's mana has reached 0, the wolf dies.")
endif
endif
call KillUnit(y) // we kill our unit.
// we remove leaks
call RemoveLocation(l)
set x = null
set y = null
endfunction
//===========================================================================
private function InitTrig_Mystic_Wolf takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Conditions ) )
call TriggerAddAction( t, function Actions )
endfunction
endscope