Jump to content
Forgot your email address? ×
×
×
  • Create New...

Function for Spawns


deadman

Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( 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 2
Link to comment

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

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


  • Read our Rules
  • Activity

    1. 20

      Fix unknown header 100% server: 1k player online francec

    2. 20

      Fix unknown header 100% server: 1k player online francec

    3. 20

      Fix unknown header 100% server: 1k player online francec

    4. 29

      Metin2 Project - How to create à Metin2 private server on virtual machine

    5. 40

      Changelogs

    6. 1

      I'm looking for a partner

    7. 5

      Help in implementing a switch bot

    8. 0

      Error FoxFS source install

    9. 5

      Help in implementing a switch bot

  • Recently Browsing

    • No registered users viewing this page.

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.