PHP Code:
--[[
-- Castle War
-- Quest Writer By : HaveBeen™
-- For EPVP
]]--
quest castlewar begin
state start begin
function check()
local gmlist = {"HaveBeen"} -- Enter the names of GameMaster
for i = 1,table.getn(gmlist),1 do
if(gmlist[i] == pc.get_name()) then
return true
else
return false
end
end
end
when letter with castlewar.check() == true begin
send_letter("Castle War")
end
when button or info begin
say_title("Castle War: ")
say("")
--
if(game.get_event_flag("castlewar_status") == 0) then
say_reward("Hello "..pc.name)
say_reward("Do you want to open the Battle of the castle? ")
local s = select(locale.yes,locale.no)
if(s == 2) then return end
say_title("Castle War: ")
say("")
--
local amount = {100,500,1000,1500} -- Amount of Homicide xD
local luck = number(1,table.getn(amount))
game.set_event_flag("castlewar_kills",amount[luck])
game.set_event_flag("empire_1",game.get_event_flag("castlewar_kills"))
game.set_event_flag("empire_2",game.get_event_flag("castlewar_kills"))
game.set_event_flag("empire_3",game.get_event_flag("castlewar_kills"))
game.set_event_flag("castlewar_status",1)
say_reward("The castle was opened war.. ")
--
notice_all("The Castle was opened war!. ")
elseif(game.get_event_flag("castlewar_status") == 1) then
say_reward("Hello "..pc.name)
say_reward("Do you want to turn off the War of the castle? ")
local s = select(locale.yes,locale.no)
if(s == 2) then return end
say_title("Castle War: ")
say("")
--
say("Castle war closed.. ")
game.set_event_flag("castlewar_status",0)
game.set_event_flag("castlewar_kills",0)
game.set_event_flag("empire_1",0)
game.set_event_flag("empire_2",0)
game.set_event_flag("empire_3",0)
end
end
when 11001.chat."Join the Battle of the castle" or 11003.chat."Join the Battle of the castle" or 11005.chat."Join the Battle of the castle" with game.get_event_flag("castlewar_status") == 1 begin
say_title(mob_name(npc.get_race())..":")
say("")
---
if(pc.get_level() < 75) then
return say_reward("75 can not go below the level of.. ")
end
say("Do you want to join war? ")
say("")
local s = select(locale.yes,locale.no)
if(s == 1) then
pc.warp(x,y)
end
end
when login with pc.get_map_index() == xxx begin
if(game.get_event_flag("castlewar_status") == 0) then
warp_to_village()
else
say_title("Castle War Information: ")
say("")
---
say("Total number of enemies "..game.get_event_flag("castlewar_kills"))
say("Good luck.. ")
end
end
when kill with npc.is_pc() and npc.empire != pc.empire and pc.get_map_index() == xxx begin
game.set_event_flag("empire_"..pc.get_empire(),game.get_event_flag("empire_"..pc.get_empire())+1)
local empirename = {"Shinsoo","Chunjo","Jinno"}
chat(empirename[pc.get_empire()].." "..game.get_event_flag("empire_"..pc.get_empire()).." Points Wins! ")
if(game.get_event_flag("empire_"..pc.get_empire()) == game.get_event_flag("castlewar_kills")) then
if(pc.get_empire() == 1) then -- Shinsoo
notice_in_map("Shinsoo Won The War! ")
game.set_event_flag("empire_1",0)
game.set_event_flag("empire_2",0)
game.set_event_flag("empire_3",0)
game.set_event_flag("castlewar_kills",0)
game.set_event_flag("castlewar_status",0)
warp_all_to_village()
elseif(pc.get_empire() == 2) then -- Chunjo
notice_in_map("Chunjo Won The War! ")
game.set_event_flag("empire_1",0)
game.set_event_flag("empire_2",0)
game.set_event_flag("empire_3",0)
game.set_event_flag("castlewar_kills",0)
game.set_event_flag("castlewar_status",0)
warp_all_to_village()
elseif(pc.get_empire() == 3) then -- Jinno
notice_in_map("Jinno Won The War! ")
game.set_event_flag("empire_1",0)
game.set_event_flag("empire_2",0)
game.set_event_flag("empire_3",0)
game.set_event_flag("castlewar_kills",0)
game.set_event_flag("castlewar_status",0)
warp_all_to_village()
end
end
end
end
end
## Edit the mapindex
## Edit the x and y coordinats..
## I'm sorry I forgot something :D
## The number of killings in the table is selected(Automatic)..
## local amount = {100,500,1000,1500} -- Change the number of xD
King Regards
Mfg HaveBeen™