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

Add storage after monster's dead.

shor

New Member
Joined
Jan 2, 2011
Messages
137
Reaction score
0
Location
Poland
I need a script which will add player storage when monster die.

Everyone who deal damage to boss will get storage when boss die (or people who stay in defined area- it's good too).

Repp++
 
I know function onKill(cid, target, lastHit), but it will give storage only for person who made last damage and here is the problem ;s
 
I know function onKill(cid, target, lastHit), but it will give storage only for person who made last damage and here is the problem ;s

then
Lua:
function onDeath(cid, corpse, killers)
and in monster file
XML:
	<script>
		<event name="eventname"/>
	</script>
 
I tried with it.

Lua:
function onDeath(cid, corpse, killers)
      if  getCreatureName(cid) == "Boss" then
      doPlayerSetStorageValue(cid, 63536, 1)
      end
return TRUE
end

But player doesn't get storage.
 
Lua:
function onKill(cid, target)
	if (getCreatureName(target) == "Name") then
		-- action/s
	end
	return true
end
Register for all players in login.lua.
 
I added

to login.lua
Lua:
registerCreatureEvent(cid, "Boss")

to creaturescripts.xml
XML:
<event type="kill" name="Boss" event="script" value="boss.lua"/>

to boss.xml
XML:
	<script>
        	<event name="Boss"/>
	</script>



and when I kill Boss, I get error in console:
Code:
[Warning - Monster::Monster] Unknown event name - Boss

What did I miss?
 
Now I don't see any errors in console, but it doesn't give storage, here is my boss.lua

Lua:
function onKill(cid, target)
	if (getCreatureName(target) == "Boss") then
	setPlayerStorageValue(cid,63536,1)
	end
	return true
end
 
Now I don't see any errors in console, but it doesn't give storage, here is my boss.lua

Lua:
function onKill(cid, target)
	if (getCreatureName(target) == "Boss") then
	setPlayerStorageValue(cid,63536,1)
	end
	return true
end
You cant use onKill because with onKill cid = killer, and there can't be multiple cids rewarded. You'll have to use onDeath and loop through the deathlist and reward them
 
StorageMonster.lua
Lua:
function onDeath(cid, corpse, killer)
local monstName,Storage = "Boss",63536  -- monster name, storage
if isMonster(cid) and string.lower(getCreatureName(cid)) == string.lower(monstName) then
doCreatureSay(cid, "you received a storage!", TALKTYPE_ORANGE_1)
if isInParty(killer[1]) == true then
local players = getPartyMembers(getPartyLeader(killer[1]))
for i, k in ipairs(players) do
setPlayerStorageValue(k, Storage, 1)
end
else
setPlayerStorageValue(killer[1], Storage, 1)
end  
end
return true
end

creaturescript.xml

Code:
<event type="death" name="StoraGe" event="script" value="StorageMonster.lua"/>


in file.xml from your monster add

Code:
<script>
<event name="StoraGe"/>
</script>
 
Back
Top