• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Deleting vials, item for item NPC trade, getting items after killing a monster

lycefur

New Member
Joined
Jul 13, 2010
Messages
99
Reaction score
2
1.How can I make vial after using a potion dissapear? solved, nightmare rep+

2.How can I make an NPC who sells for example item with id XXXX for not gold but for another item with id YYYY? For example when saying 'trade' to npc we can be able to buy chicken feathers for fine sulphur Example of xml code with npc like that please! solved, sonical rep+

3.How can I make every1 who took part in attacking/killing a boss instantly receive an item after boss dies? Script + explanation please! solved, damadgerz rep+

Ty for help, I will give rep!
 
Last edited:
Solution 1.

Go to data/actions/scripts/liquids/potions

At the 2nd line of the 'potions' file find:
Code:
	removeOnUse = "no",

And Replace with:
Code:
	removeOnUse = "yes",

There, when you use a potion, It will dissappear!
 
3. Solution

Open your data/monsters, then find that boss, and only you need to put is more chance on this item loot, for example:

<item id="1987" chance="1000"> <- hard to loot
<item id="1987" chance="100000"> <- easy to loot
 
3. Solution

Open your data/monsters, then find that boss, and only you need to put is more chance on this item loot, for example:

<item id="1987" chance="1000"> <- hard to loot
<item id="1987" chance="100000"> <- easy to loot

Ty for reply but its not what I wanted to get. This will simply increase chance of looting item, and I want players to get automatically an item after killing boss, I want an item to get 'summoned' into their backpacks after boss dies.
 
Lua:
local monster = "rat"
local itemm =   --itemid
function onKill(cid,target)
if getCreatureName(target) == monster then
doPlayerAddItem(cid,itemm,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"You have recieved a "..getItemNameById(itemm).." for killing the "..monster..".")
end
return true
end
then go to creature.xml add
Code:
<event type="kill" name="dier" event="script" value="xxxxx.lua"/>

then login.lua
Code:
registerCreatureEvent(cid, "dier")
 
Script 2
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
		--CONFIG
	local itemi = 8710 --Item which you can buy
	local cash = 2160 --item id of "cash"
	local count = 5 --how much cash items you need to buy
	--CONFIG END
	
	if(msgcontains(msg, 'trade')) then
			npcHandler:say("Do you want to buy "..getItemNameById(itemi).." for "..count.." "..cash.."?", cid)
						talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if doPlayerRemoveItem(cid, cash, count) == true then
			npcHandler:say("Ok, there is your item.", cid)
			doPlayerAddItem(cid, itemi, 1)
			talkState[talkUser] = 0
		else
			npcHandler:say("It seems you don\'t have enough "..getItemNameById(cash).."s in your backpack.", cid)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Oh well then.", cid)
		talkState[talkUser] = 0
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top