@Xikini @Snavy thanks for the help, this is the script
Lua:local outfits = { [PLAYERSEX_MALE] = 1270, [PLAYERSEX_FEMALE] = 1271 } local cEvent = CreatureEvent("killPaleWorm") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if not creature:hasOutfit(outfits[creature:getSex()]) and creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have received Poltergeist outfit.') then creature:addOutfit(outfits[creature:getSex()]) end end return true end cEvent:register()
local outfits = {
[PLAYERSEX_MALE] = 1270,
[PLAYERSEX_FEMALE] = 1271
}
local cEvent = CreatureEvent("killPaleWorm")
function...
tfs 1.3 otbrTell us which tfs version you are using?
local cEvent = CreatureEvent("killBoss")
function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
for cid, _ in pairs(creature:getDamageMap()) do
local creature = Player(cid)
if creature then
player:addOutfit(128) -- change
end
end
return true
end
cEvent:register()
If I place this line like this it gives male and female?try
Lua:local cEvent = CreatureEvent("killBoss") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if creature then player:addOutfit(128) -- change end end return true end cEvent:register()
player:addOutfit(1270, 1271) -- change
If I place this line like this it gives male and female?
Code:player:addOutfit(1270, 1271) -- change
local outfits = {
[PLAYERSEX_MALE] = 128,
[PLAYERSEX_FEMALE] = 136
}
player:addOutfit(outfits[creature:getSex()])
Error ConsoleLua:local outfits = { [PLAYERSEX_MALE] = 128, [PLAYERSEX_FEMALE] = 136 }
Lua:player:addOutfit(outfits[creature:getSex()])
Lua Script Error: [Scripts Interface]
/home/forgottenserver/data/scripts/creaturescripts/pale_worm_outfit.lua:callback
...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: in function <...server/data/scripts/creaturescripts/pale_worm_outfit.lua:7>
local outfits = {
[PLAYERSEX_MALE] = 1270,
[PLAYERSEX_FEMALE] = 1271
}
local cEvent = CreatureEvent("killPaleWorm")
function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
for cid, _ in pairs(creature:getDamageMap()) do
local creature = Player(cid)
if creature then
player:addOutfit(outfits[creature:getSex()])
end
end
return true
end
cEvent:register()
changeError Console
Lua:Lua Script Error: [Scripts Interface] /home/forgottenserver/data/scripts/creaturescripts/pale_worm_outfit.lua:callback ...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: attempt to index global 'player' (a nil value) stack traceback: [C]: in function '__index' ...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: in function <...server/data/scripts/creaturescripts/pale_worm_outfit.lua:7>
so put the script
Code:local outfits = { [PLAYERSEX_MALE] = 1270, [PLAYERSEX_FEMALE] = 1271 } local cEvent = CreatureEvent("killPaleWorm") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if creature then player:addOutfit(outfits[creature:getSex()]) end end return true end cEvent:register()
player:addOutfit(outfits[creature:getSex()])
creature:addOutfit(outfits[creature:getSex()])
hey bro, can you place it only once when you kill him? since I put a message and says it every time they kill the bosschange
toLua:player:addOutfit(outfits[creature:getSex()])
Lua:creature:addOutfit(outfits[creature:getSex()])
hey bro, can you place it only once when you kill him? since I put a message and says it every time they kill the boss
local outfit = outfits[creature:getSex()]
if not creature:hasOutfit(outfit) then
creature:addOutfit(outfit)
end
local outfits = {
[PLAYERSEX_MALE] = 1270,
[PLAYERSEX_FEMALE] = 1271
}
local cEvent = CreatureEvent("killPaleWorm")
function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
for cid, _ in pairs(creature:getDamageMap()) do
local creature = Player(cid)
if not creature:hasOutfit(outfits[creature:getSex()]) and creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have received Poltergeist outfit.') then
creature:addOutfit(outfits[creature:getSex()])
end
end
return true
end
cEvent:register()
@Xikini @Snavy thanks for the help, this is the script
Lua:local outfits = { [PLAYERSEX_MALE] = 1270, [PLAYERSEX_FEMALE] = 1271 } local cEvent = CreatureEvent("killPaleWorm") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if not creature:hasOutfit(outfits[creature:getSex()]) and creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have received Poltergeist outfit.') then creature:addOutfit(outfits[creature:getSex()]) end end return true end cEvent:register()
local outfits = {
[PLAYERSEX_MALE] = 1270,
[PLAYERSEX_FEMALE] = 1271
}
local cEvent = CreatureEvent("killPaleWorm")
function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
for cid, _ in pairs(creature:getDamageMap()) do
local creature = Player(cid)
if creature and creature:isPlayer() then
local outfit = outfits[creature:getSex()]
if not creature:hasOutfit(outfit) then
creature:addOutfit(outfit)
creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received Poltergeist outfit.")
end
end
end
return true
end
cEvent:register()
^ ...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: unexpected symbol near '`'Lua:local outfits = { [PLAYERSEX_MALE] = 1270, [PLAYERSEX_FEMALE] = 1271 } local cEvent = CreatureEvent("killPaleWorm") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if creature and creature:isPlayer() then local outfit = outfits[creature:getSex()] if not creature:hasOutfit(outfit) then creature:addOutfit(outfit) creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received Poltergeist outfit.") end end end return true end cEvent:register()
Try re-copying it.^ ...server/data/scripts/creaturescripts/pale_worm_outfit.lua:11: unexpected symbol near '`'
any idee why it dont work for me ?Lua:local outfits = { [PLAYERSEX_MALE] = 1270, [PLAYERSEX_FEMALE] = 1271 } local cEvent = CreatureEvent("killPaleWorm") function cEvent.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified) for cid, _ in pairs(creature:getDamageMap()) do local creature = Player(cid) if creature and creature:isPlayer() then local outfit = outfits[creature:getSex()] if not creature:hasOutfit(outfit) then creature:addOutfit(outfit) creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received Poltergeist outfit.") end end end return true end cEvent:register()
did you register it to the monster's xml?any idee why it dont work for me ?
i dont get a error in console and also no addon for killing the pale worm
i use the latest Canary ;D
Thanks in advance
<script>
<event name="killPaleWorm"/>
</script>
i dont have monster's xmldid you register it to the monster's xml?
XML:<script> <event name="killPaleWorm"/> </script>