On log in

05/06/2019 06:28 mlejnek2#1
Looking for help with on log in script for if say world boss buffs are active and a new player logs in them and there pets get them if they was not on when the boss was killed need a Script that will give the buffs with the same effect and lvl and time thats left on the current buffs running to players that are not on
05/14/2019 18:36 Hatrick_Wildfan#2
hi , there
first you need to add script when the boss died or the buff activated for that matter then run this script which store the buff start time on global variable
Code:
-- when world boss died 
function on_boss_world()

local now_time = get_os_time()   -- get now time
--set global variable of buff start time 
set_global_variable("world_boss_buff",now_time)

end
then use this function on login to check buff time and add it to the player when he logs in

Code:
-- on player login 

function world_boss_buff()
local now_time = get_os_time()   -- get now time
local buff_time = get_global_variable("world_boss_buff") -- buff start time 
if buff_time == nil or buff_time == "" then buff_time = 0 end 
local state_time = now_time - buff_time -- buff time 
local state_id = 14011 -- buff id
local state_power = 10 -- buff power 
-- check buff time if still running 
if now_time > buff_time then
add_cstate(state_id,state_power,state_time)
end
end
--NOTICE--

Quote:
you may wanna add a remove_cstate to a script when player login to remove the buff in case player logged in couple times in case you encounter problem