request for a script

04/24/2015 11:03 zartin#1
i want a rappelz script that gives u
a gift in your bag every hour of playing
04/24/2015 14:28 ismokedrow#2
Write a script called

function on_every_hour()
-- Logic
end

and create a scheduledcommand entry to fire that script every hour. (Thought I'm sure it won't be able to do targeted cmd's like insert_item, I could be wrong though)
04/24/2015 18:54 thund22222#3
I did some testing on scheduledcommand if the change type from 0 to 1 will appear as notice if the value 0 is the command but can not get it applied whether buff or tool
04/24/2015 19:44 Dark.Gts#4
NFlavor did something like this for a login event in 2014.

The way I understand it, the function 'on_time_based_event_reward()' (NPC_Event.lua) is run periodically for any player who has been logged in for a certain period of time if the environment variable 'game.use_time_based_event_script' is set.
This is done automatically on startup (assuming it wasn't removed from 'on_server_init()') by 'for_event_by_liveteam()' (NPC_Event.lua):
Code:
	set_env( "game.use_time_based_event_script",1 )
	set_env( "game.term_for_time_based_event_script",120 )
...where 120 is the required login period in minutes.

For example, if you set game.term_for_time_based_event_script to 5 and add the line insert_item(900000,1) to on_time_based_event_reward() without any further conditions, any player on the server will receive 1 stamina saver for every five minutes they are logged on.
04/24/2015 20:38 thund22222#5
Thank you very much, but you should be Put the function in on_server_init?
04/24/2015 21:07 Dark.Gts#6
Assuming your LUAs haven't been modified you won't have to add anything besides your own code. This is the important stuff:

server_init.lua:
Code:
[...]
function on_server_init()
	[...]
	for_event_by_liveteam() --라이브팀 사용 범위로 NPC_EVENT 스크립트에서 사용된다.
end
[...]
NPC_Event.lua:
Code:
[...]
function for_event_by_liveteam()

	play_time_event() --플레이 타임 이벤트
	[...]
end

function play_time_event()

	[...]
		set_env( "game.use_time_based_event_script",1 )
		set_env( "game.term_for_time_based_event_script",120 )
		--change the value above to your desired interval in minutes!
	[...]
end

function on_time_based_event_reward() 

	local state_code = get_local_info()  -- 국가코드
	local pcbang_grade = get_value("pcbang_user")	-- 프리미엄PC방 판단변수	
	local t_flag = get_flag( "reward_time_event" ) -- 캐릭터 별 플래그 값
	local account_t_flag = get_account_flag( "reward_time_event" ) -- 계정 별 플래그 값
	local current_time = get_os_date( "%Y-%m-%d %H:%M:%S" )
	local flag_current_time = get_os_date( "%Y-%m-%d" )
	local event_current_week = 0	
	local lv = get_value( "level" )

	--add your own code below!

	[...]
end
[...]
05/08/2023 04:56 tanos77#7
Could someone show me how to use the scripts I have already tried from sql, copying and pasting into new queries but most of them give an error on certain lines.
05/08/2023 05:53 Sh4doxie#8
Quote:
Originally Posted by tanos77 View Post
Could someone show me how to use the scripts I have already tried from sql, copying and pasting into new queries but most of them give an error on certain lines.
pm me with ur discord nick, ill try to help but only if ure able to "ask".