Jump to content
Sign in to follow this  
Aveline™

Event System

Recommended Posts

I'll share a little quest with your :P

 

Quest:

---------------------------------------------------------------
--- Copyright (c) 2014-2015 by  HaveBeen™
---------------------------------------------------------------
quest events begin
	state start begin
		function event()
			local data = {}
			data.eventName = {"Event Tanaka","Rain Metin","Event Mob","Close"}
			data.what_do = {
				[1] = {
					["mapIndexs"] = {1,21,41}, -- For Shinsoo,Chunjo,Jinno					
					["regenMode"] = true,
					["regenFile"] = "data/event/tanaka.txt",					
				},
				[2] = {
					["mapIndexs"] = {1,21,41}, -- For shinsoo,Chunjo,Jinno
					["regenMode"] = true,
					["regenFile"] = "data/event/metin.txt",
				},
				[3] = {
					["mapIndexs"] = {1,21,41}, -- For shinoso,Chunjo,Jinno
					["regenMode"] = true,
					["regenFile"] = "data/event/mob.txt",					
				},
			}
			data.notices = {
				[1] = {"EVENT_TANAKA","CLOSE_METIN"},
				[2] = {"EVENT_RAIN_METIN","CLOSE_METIN"},
				[3] = {"EVENT_MOB","CLOSE_METIN"},
			}
			data.eventFlags = {
				[1] = "tanaka",
				[2] = "rainmetin",
				[3] = "eventmob",
			}
			return data
		end
		when letter with pc.is_gm() and pc.name == "HaveBeen™" begin
			send_letter("Launch Event")
		end
		when button or info begin
			say_title("Launch Event:")
			say("")
			---
			say("Please select event.")
			say("")
			local data = events.event()
			local s = select_table(data.eventName)
			say_title("Launch Event:")
			say("")
			---
			if(s >= table.getn(data.eventName)) then
				return
			end
			say_title(string.format("%s:",data.eventName[s]))
			say("")
			---
			if(game.get_event_flag("event_"..data.eventFlags[s]) > 0) then
				say("Do you want to stop "..data.eventName[s].." ? ")
				say("")
				if(select(locale.yes,locale.no) >= 1) then
					say("Event is closing, please wait..")
					game.set_event_flag("event_"..data.eventFlags[s],0)
					notice_multiline(data.notices[s][2])
				end
			else
				say("Event opening, please wait..")
				say("")
				notice_multiline(data.notices[s][1])
				game.set_event_flag("event_"..data.eventFlags[s],1)
				for i = 1,table.getn(data.what_do[s]["mapIndexs"]), 1 do
					regen_in_map(data.what_do[s]["mapIndexs"][i],data.what_do[s]["regenFile"])
				end
			end
		end
	end
end

I hope you're like it.

 

Regards.

  • Love 6

Share this post


Link to post

can u show examples for the tanaka.txt metin.txt mob.txt ?

 

and where are the informations about the data.notice?

Share this post


Link to post

can u show examples for the tanaka.txt metin.txt mob.txt ?

 

and where are the informations about the data.notice?

 

data.notice has 2 text.

 

First is when event is opened, show 1 text. Another is when event is closed, show 2 text.

 

This system like dungeon system. You should be look at regen files.

 

Regards.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.