Jump to content

[LUA] Tips Script


Recommended Posts

Hello everyone,
I recently needed to make a small code. But I have a compile problem.

What error does the script present?
Other tips for controlling the item?

Thanks friends

 

 

quest monkey_dungeon begin
    state start begin
		function IsInDungeon(pc_index)
			local map_index = 108
			return (pc_index >= map_index*10000 and pc_index < (map_index+1)*10000)
		end
		--* Item teletrasporto Stanza *--
		when 57095.use begin
			if monkey_dungeon.IsInDungeon(pc.get_map_index()) == true then
				syschat("[Info] Non puoi utilizzare l'item all'interno del dungeon")
				return
			end
			-- if pc.get_map_index() ~= 109 then
				-- syschat("[Info] Puoi utilizzare l'item soltanto nel sotterraneo")
				-- return
			-- end
			if party.is_party() and not party.is_leader() then
				syschat("[Info] Soltato il Capo Gruppo puo' utilizzare questo item")
				return
			end
			timer("monkey_dungeon", 10)
			notice_in_map("Un gruppo di eroi affrontera' la Stanza Sotterranea")
			pc.remove_item(57095, 1)
			syschat("[Info] Tra 10 secondi verrete portati nella Stanza Sotterranea!")
		end
		--* Fine *--
		when monkey_dungeon.timer begin
			d.join(108)
			d.regen_file("data/dungeon/monkey_dungeon/monkey_dungeon1.txt")
        end
		when 5126.kill or 5156.kill begin
		notice_multiline("Uccidendo i mostri potrai trovare l'item Meccanismo Segreto",d.notice_big)
		notice_multiline("Se non riuscirai a trovarlo dovrai reiniziare il dungeon!",d.notice_big)
			if pc.count_item(57096) >= 1 then
			d.kill_all()
			notice_multiline("Hai trovato Meccanismo segreto!",d.notice_big)
			notice_multiline("Tra 30 secondi verrai riportato nel labirinto!",d.notice_big)
			timer("end_monkey1",30)
			end
				if pc.count_item(57096) == 0 then
				notice_multiline("Non hai ancora trovato Meccanismo segreto",d.notice_big)
				return
				end
		end
		when end_monkey1.timer begin
		d.exit_all()
		end	
			
	end
end

 

  • Sad 1
Link to comment
Share on other sites

I have a problem.

		when 5126.kill or 5156.kill begin
		notice_multiline("Uccidendo i mostri potrai trovare l'item Meccanismo Segreto",d.notice_big)
		notice_multiline("Se non riuscirai a trovarlo dovrai reiniziare il dungeon!",d.notice_big)
			if pc.count_item(57096) >= 1 then
			d.kill_all()
			notice_multiline("Hai trovato Meccanismo segreto!",d.notice_big)
			notice_multiline("Tra 30 secondi verrai riportato nel labirinto!",d.notice_big)
			timer("end_monkey1",30)
			end
				if pc.count_item(57096) == 0 then
				notice_multiline("Non hai ancora trovato Meccanismo segreto",d.notice_big)
				return
				end
		end
	

the pc count not is okay?

Why if i dont have 57096 i go out of the dungeon?

 

 

Link to comment
Share on other sites

  • Premium
6 hours ago, Asterix said:

I have a problem.


		when 5126.kill or 5156.kill begin
		notice_multiline("Uccidendo i mostri potrai trovare l'item Meccanismo Segreto",d.notice_big)
		notice_multiline("Se non riuscirai a trovarlo dovrai reiniziare il dungeon!",d.notice_big)
			if pc.count_item(57096) >= 1 then
			d.kill_all()
			notice_multiline("Hai trovato Meccanismo segreto!",d.notice_big)
			notice_multiline("Tra 30 secondi verrai riportato nel labirinto!",d.notice_big)
			timer("end_monkey1",30)
			end
				if pc.count_item(57096) == 0 then
				notice_multiline("Non hai ancora trovato Meccanismo segreto",d.notice_big)
				return
				end
		end
	

the pc count not is okay?

Why if i dont have 57096 i go out of the dungeon?

 

 

It means someone else has the item and killed a 5126/5156 monster. 

Also if those monsters are not unique to that specific dungeon, you might want to check for the dungeon on the 'when'.

when 5126.kill or 5156.kill with monkey_dungeon.IsInDungeon(pc.get_map_index()) begin

 

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

Link to comment
Share on other sites

7 hours ago, Syreldar said:

It means someone else has the item and killed a 5126/5156 monster. 

Also if those monsters are not unique to that specific dungeon, you might want to check for the dungeon on the 'when'.


when 5126.kill or 5156.kill with monkey_dungeon.IsInDungeon(pc.get_map_index()) begin

 

 

Thank you. But I have a strange problem, after doing the dungeon I can not do it again. If I restart the server yes.

 

I'm glad you've improved so much! I saw some post of yours, congratulations. In the end you're always a Messinese like me. Do not remember? I do not understand why I'm not accepted on skype but ok.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.