Jump to content

[Request]Locking items on map


Recommended Posts

  • Premium

Try this one

Spoiler

game.py
Find:
class GameWindow(ui.ScriptWindow):
to	def __init__(self): add:
		self.display = 0
		self.time = 0

to	def __GuildWar_OpenAskDialog(self, guildID, warType): add:
		self.display = 1
		self.time = app.GetTime() + 120 ## 120 seconds
		
to	def __GuildWar_OnDecline(self): add:
		self.display = 0
		
to	def OnUpdate(self): add:
		if app.GetTime() > self.time and self.display:
			self.__GuildWar_OnDecline()

 

NOT TESTED

  • Love 1
Link to comment
Share on other sites

  • Premium
Acum 43 minute, Nevisor a spus:

Try this one

  Ascunde conținuturi


game.py
Find:
class GameWindow(ui.ScriptWindow):
to	def __init__(self): add:
		self.display = 0
		self.time = 0

to	def __GuildWar_OpenAskDialog(self, guildID, warType): add:
		self.display = 1
		self.time = app.GetTime() + 120 ## 120 seconds
		
to	def __GuildWar_OnDecline(self): add:
		self.display = 0
		
to	def OnUpdate(self): add:
		if app.GetTime() > self.time and self.display:
			self.__GuildWar_OnDecline()

 

NOT TESTED

Thanks but nothing happen, no error/effect.

Link to comment
Share on other sites

The quest must know what's there in the item shop.

  • You can create an array for this in questlib.lua or the quest.
  • You can use a query to fetch what's there in the item shop. (I do not recommend this method because it might be a lag in the game.)
    • You must cache it even If you want.

Then you can check it with pc.get_wear()

  • You can create an array for this in the quest or questlib.lua (I gave an example)

The last thing is to combine all of them

quest xxx begin
	state start begin			
		when login with pc.get_map_index() == xx begin
			-- You can use a query to fetch the item vnums from the table. (I still do not recommend this method if you are not using cache method)
			local blockedItems = { 11209, 11409, 11609, 11809 }
			
			-- Wear positions, is exist in common/length.h if you want to check it out.
			local wearPositions = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22 }
			
			-- Make a loop and check every wear position and check is equal to the blocked items in array or not.		
			for i = 1, table.getn(blockedItems), 1 do
				for j = 1, table.getn(wearPositions), 1 do
					if (pc.get_wear(wearPositions[j]) == blockedItems[i]) then
						chat("You can't..")
						return
					end
				end
			end
		end
	end
end

 

Best Regards

Ken

  • Love 1

Do not be sorry, be better.

Link to comment
Share on other sites

  • Premium
38 minutes ago, Ken said:

The quest must know what's there in the item shop.

  • You can create an array for this in questlib.lua or the quest.
  • You can use a query to fetch what's there in the item shop. (I do not recommend this method because it might be a lag in the game.)
    • You must cache it even If you want.

Then you can check it with pc.get_wear()

  • You can create an array for this in the quest or questlib.lua (I gave an example)

The last thing is to combine all of them

Best Regards

Ken

quest xxx begin
	state start begin			
		when login begin
			--[[
				The blocked map indexes, customize them.
			]]
			local blockedIndexes = {101, 102, 103};
			
			--[[
				The blocked items values, customize them.
			]]
			local blockedItems = {11209, 11409, 11609, 11809};

			--[[
				The wearPosition values, do not touch them, you can find them in the common/length.h file (serverside source).
			]]
			local wearPositions = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22}

			if (table_is_in(blockedIndexes, pc.get_map_index())) then
				for i = 1, table.getn(blockedItems) do
					for j = 1, table.getn(wearPositions) do
						if (pc.get_wear(wearPositions[j]) == blockedItems[i]) then
							chat(string.format("This item is locked for this map: %s, remove it to be able to enter here.", item_name(blockedItems[i])))
							warp_to_village();
						end -- if
					end -- for
				end -- for
			end -- if
		end -- when
	end -- state
end -- quest

This is better for that purpose, to block the item you must send the player away from the map at the login, this is also more customizable.

 

"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

  • Premium
2 hours ago, Syreldar said:

quest xxx begin
	state start begin			
		when login begin
			--[[
				The blocked map indexes, customize them.
			]]
			local blockedIndexes = {101, 102, 103};
			
			--[[
				The blocked items values, customize them.
			]]
			local blockedItems = {11209, 11409, 11609, 11809};

			--[[
				The wearPosition values, do not touch them, you can find them in the common/length.h file (serverside source).
			]]
			local wearPositions = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22}

			if (table_is_in(blockedIndexes, pc.get_map_index())) then
				for i = 1, table.getn(blockedItems) do
					for j = 1, table.getn(wearPositions) do
						if (pc.get_wear(wearPositions[j]) == blockedItems[i]) then
							chat(string.format("This item is locked for this map: %s, remove it to be able to enter here.", item_name(blockedItems[i])))
							warp_to_village();
						end -- if
					end -- for
				end -- for
			end -- if
		end -- when
	end -- state
end -- quest

This is better for that purpose, to block the item you must send the player away from the map at the login, this is also more customizable.

He should also add a timer loop to put a message say("") every 5 seconds to player. That will make the player put down the item because is very annoying. Its better than a disconnect.

Link to comment
Share on other sites

  • Premium
1 minute ago, Dobrescu Sebastian said:

He should also add a timer loop to put a message say("") every 5 seconds to player. That will make the player put down the item because is very annoying. Its better than a disconnect.

It's not a disconnect, it warps to village.

 

"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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      Quest 6/7 Problem

    2. 5

      Effect weapons

    3. 3

      Crystal Metinstone

    4. 3

      Feeding game source to LLM

    5. 113

      Ulthar SF V2 (TMP4 Base)

    6. 3

      Feeding game source to LLM

    7. 0

      Target Information System

    8. 3

      Feeding game source to LLM

  • Recently Browsing

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