Jump to content
Keuvyn T.

MAP_COPY FUNCTION

Recommended Posts

Hello everyone, :ok:

 

I need a great force of yours because I have no idea how to do it.

 

The problem of my map is the following, when a group of 5 players enters it the map starts the waves script, so far is ok. 

 

The problem occurs when another 5-player group enters, instead of opening it like a new map and starting the script from scratch for the new team, the new team is directed to the map of the previous team, when in fact they should be directed to a "copy" of this map which will then start scripting from zero to the new team.

 

This is what I mean with map_copy, I believe the PvP arena uses this system, just see this battles occur on the same map at the same time, can someone help me?

 

Here is the Crtl.lua, Entry.lua and Instancy_Vars.lua, of the map that I want to do this.

 

--- CRTL.LUA OF MAP INFERNAL ABYSS

--------------------------------------------------------------------------
--									--
--									--
--				ctrl.lua				--
--									--
--									--
--------------------------------------------------------------------------
print( "Loading InfernalAbyss Ctrl.lua" )


function config(map)
    MapCanSavePos(map, 0) 
    MapCanPK(map, 0) 
    MapCanTeam( map, 1 )
    MapType( map , 3 )
    MapCopyNum(map, 1) 
    SingleMapCopyPlyNum(map, 300)  
    MapCanStall(map , 0)
end

function get_map_entry_pos_InfernalAbyss()
	SetMapEntryTime(map, "2006/10/18/14/0", "0/24/0", "0/24/0", "0/24/0")
end

function init_entry(map)
end

function after_enter_InfernalAbyss( role , map_copy )
end

function before_leave_InfernalAbyss( role )
end

function map_copy_run_special_InfernalAbyss( map_copy ) 
end

function map_run_InfernalAbyss(map)
end

function map_copy_run_InfernalAbyss( map )
	local copy = GetMapCopyID2(map)
	local playersIn = GetMapCopyPlayerNum(map) 
	if(playersIn == 0)then
		return 0
	end
	-- Timer --
	if(Instance.tick[copy] == nil)then
		Instance.tick[copy] = 1
		else
		Instance.tick[copy] = Instance.tick[copy] + 1
		if(Instance.tick[copy] >= (Instance.timer * 60))then
			Instance_FuncAll(Instance.players[copy],"BickerNotice","Failed clearing all waves within "..Instance.timer.." minutes! challenge canceled!")
			Instance_FuncAll(Instance.players[copy],"MoveCity","")
		end
	end
	-- Main Scripts --
	local waveid = Instance.waveNow[copy]
	local party = Instance.players[copy]
	if(Instance.monsters[copy][waveid] == nil)then
		if waveid == 1 then
			if(Instance.waveDelay[copy] == nil)then
				Instance.waveDelay[copy] = 8
			end
			Instance.waveDelay[copy] = Instance.waveDelay[copy] - 1
				Instance_FuncAll(Instance.players[copy],"BickerNotice","First wave starting in "..Instance.waveDelay[copy].." second(s)! All adventurer prepare for the battle!")
				if(Instance.waveDelay[copy] <= 0)then
					Instance:spawnWave(map,waveid)
					Instance.waveDelay[copy] = 5
				end
			else
			Instance:spawnWave(map,waveid)
		end
	else
		if(Instance:AllDead(copy,waveid) == 1)then
			if(Instance.waveDead[copy][waveid] == nil)then
					if(Instance.waveDelay[copy] == nil)then
						if(Instance.boss[Instance.waveNow[copy] + 1] == true)then
							Instance_FuncAll(Instance.players[copy],"BickerNotice","Wave No."..waveid.." is defeated! Abyss Demon - Efreet is spawning!")
							else
							if(Instance:MaxWave(copy) == 0)then
								if(Instance.boss[Instance.waveNow[copy] + 1] ~= true)then
									Instance_FuncAll(Instance.players[copy],"BickerNotice","Wave No."..waveid.." is defeated! Next wave is spawning soon!")--Need to improve text/talk
								end
								if(Instance.boss[Instance.waveNow[copy]] == true)then
									Instance_FuncAll(Instance.players[copy],"BickerNotice","Demon Efreet: I admired your ability. Even my Incarnation also cowered in defeat. Come forth to me as you have awakened my bloodlust! Do not disappoint me!")
									Instance_FuncAll(Instance.players[copy],"Instance_Reward",waveid)
								end
							end
						end
					end
					if(Instance:MaxWave(copy) == 1)then
						if(Instance.closeCount[copy] == nil)then
							Instance_FuncAll(Instance.players[copy],"BickerNotice","Congratulations! You have cleared the trials!")--Need to improve text/talk
							Instance.closeCount[copy] = 30
							if(Instance.boss[Instance.waveNow[copy]] == true)then
								Instance_FuncAll(Instance.players[copy],"BickerNotice","Demon Efreet: This icy feeling is the feeling of death? It has been 3 thousand years since I have experienced it, imbecile mortals! Killing me does not change anything! There will always be greed, despair and misery! I will be back one day!")
								Instance_FuncAll(Instance.players[copy],"Instance_Reward",waveid)
							end
						end
						else
						if(Instance.waveDelay[copy] == nil)then
							Instance.waveDelay[copy] = 21
						end
						Instance.waveDelay[copy] = Instance.waveDelay[copy] - 1
						Instance_FuncAll(Instance.players[copy],"BickerNotice","Next wave starting in "..Instance.waveDelay[copy].." second(s)!")
						if Instance.waveDelay[copy] <= 0 then
							Instance.waveDead[copy][waveid] = true
							Instance.waveNow[copy] = Instance.waveNow[copy] + 1
							Instance.waveDelay[copy] = nil
						end
					end
					if(Instance.closeCount[copy] ~= nil)then
						Instance.closeCount[copy] = Instance.closeCount[copy] - 1
						Instance_FuncAll(Instance.players[copy],"BickerNotice","Warning! [Infernal Abyss] will collapse in "..Instance.closeCount[copy].." seconds! All adventurer prepare to hide!")
						if(Instance.closeCount[copy] <= 0)then
							Instance_FuncAll(Instance.players[copy],"MoveCity","")
						end
					end
			end
		end
	end
end

function map_copy_before_close_InfernalAbyss( map_copy )
end

function map_copy_close_InfernalAbyss( map_copy )
end

 

-- ENTRY.LUA OF INFERNAL ABYSS

function config_entry(entry) 
end 

function after_create_entry(entry)
end

function after_destroy_entry_InfernalAbyss(entry)
end

function after_player_login_InfernalAbyss(entry, player_name)
end

function check_can_enter_InfernalAbyss( cha, copy_mgr )
end

function begin_enter_InfernalAbyss(role, copy_mgr)
end

function before_leave_InfernalAbyss ( role )
end

-- INSTANCE_VARS.LUA OF INFERNAL ABYSS

print("	---* Loading [Infernal Abyss] Instance *---")
print("	Loading Instance_Vars.lua")
--print("* Loading Instance Functions PACK !")

function ResetInstanceVARS()
------------------------------------------
--------- DO NOT EDIT THESE --------------
------------------------------------------
Instance = {
boss = {},
tick = {},
wave = {},
masterwave = {},
rewards = {},
players = {},
bossNow = {},
waveNow = {},
waveDead = {},
closeCount = {},
waveDelay = {},
monsters = {},
openDay = {},
deadMob = {},
waveKill = {},
copyNow = 1
}

-------------------------------------------
------------ Modify These -----------------
-------------------------------------------
Instance.map = "InfernalAbyss" -- Map name
Instance.path = GetResPath(Instance.map.."/cache/") -- cache path
Instance.timer = 20 -- Time for the challenge to end in minutes
Instance.birth = "InfernalAbyss" -- Birth name from birthconf.lua
Instance.name = "Infernal Abyss"
-- Days the map open
Instance.openDay["Monday"] = true
Instance.openDay["Tuesday"] = true
Instance.openDay["Wednesday"] = true
Instance.openDay["Thursday"] = true
Instance.openDay["Friday"] = true
Instance.openDay["Saturday"] = true
Instance.openDay["Sunday"] = true
-- Enterance Requirements
Instance.reqLv = 60
Instance.reqPt = 1
dofile(GetResPath("InfernalAbyss/Instance_monsterConf.lua"))
dofile(GetResPath("InfernalAbyss/Instance_functions.lua"))
end

ResetInstanceVARS()
--print("* Instance Function PACK loaded!")

-- I download the map from here.

Quote

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...