Jump to content
Sign in to follow this  
deadman

New function for spawns

Recommended Posts

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.

 

Share this post


Link to post

You could also remove the spawn limit in the source, there was a dif for that around too.

  • Love 1

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.