Jump to content

Function for Spawns


deadman

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Well guys, i post here my new functions for spawns i dont test it but i think its works.


function multiple_spawn_n(vnum, number, array)

		for i = 1, number do	--end	(repeatable spawn for the code number)
		
		mob.spawn(vnum, array[i][1], array[i][2])
		end
end

function multiple_spawn_d(vnum, number, array)

		for i = 1, number do	--end	(repeatable spawn for the code number)
		
		d.spawn_mob(vnum, array[i][1], array[i][2])
		end
end


Example:

quest test_it begin
	state start begin
	
		when login with pc.is_gm() begin
			multiple_spawn_n(1093, 4, {{100,100},{200,200},{300,300},{400,400}})
		end
	end
end

 

Thats its useful for reduce code in a event quest for example.

 

thats its the same to do this:

quest test_down begin
	state start begin
	
		when login with pc.is_gm() begin
		
			table = {
			{100, 100},
			{200, 200},
			{300, 300},
			{400, 400}
			}
			
			for i = 1, table.getn(table) do
			
			mob.spawn(1093, table[i][1], table[i][2])
			end
		end
	end
end

King Regards Deadman

 

Changelog:

 

- I edited the functions for use this more easy.

 

  • Metin2 Dev 7
  • Confused 1
  • Love 3
Link to comment
Share on other sites

Announcements



×
×
  • 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.