local storage, kills, reward = 6435, getPlayerStorageValue(cid, storage), 50
local maleoutfit, femaleoutfit = 336, 337
function onKill(cid, target, lastHit)
if(isPlayer(target) && kills > reward) then
return FALSE
elseif(isPlayer(target) && kills < reward) then
setPlayerStorageValue(cid, storage, kills+1)
elseif(isPlayer(target) && kills == reward) then
if(getPlayerSex(cid) == male) then
doPlayerAddOutfit(cid, maleoutfit, 2)
else
doPlayerAddOutfit(cid, femaleoutfit, 2)
end
setPlayerStorageValue(cid, storage, kills+1)
doPlayerSendTextMessage(cid, 19, "Congratulations! You have just recieved both Warmaster Addons.")
end
return TRUE
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local storage, kills, reward = 6435, getPlayerStorageValue(cid, storage), 50
local maleoutfit, femaleoutfit = 336, 337
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, "hello") or msgcontains(msg, "hi")) and not npcHandler:isFocused(cid) then
npcHandler:say("Hello, "..getCreatureName(cid)..". Are you here to recieve your {addon}?", cid, TRUE)
npcHandler:addFocus(cid)
return true
end
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
npcHandler:say("Farewell, " .. getCreatureName(cid) .. "!", cid, TRUE)
npcHandler:releaseFocus(cid)
end
if(not npcHandler:isFocused(cid)) then
return false
elseif msgcontains(msg, "addon") then
if getPlayerStorageValue(cid, storage) < reward then
npcHandler:say("You still need ".. reward - getPlayerStorageValue(cid, storage) .." to recieve your addon.", cid, TRUE)
elseif getPlayerStorageValue(cid, storage) == reward then
npcHandler:say("Congratulations, here are your Warmaster Addons!", cid, TRUE)
if(getPlayerSex(cid) == male) then
doPlayerAddOutfit(cid, maleoutfit, 2)
else
doPlayerAddOutfit(cid, femaleoutfit, 2)
end
setPlayerStorageValue(cid, storage, kills+1)
else
npcHandler:say("You have already recieved your Addons!", cid, TRUE)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_WALKAWAY, "Ya. Bye.", cid, TRUE)
local storage, kills, reward = 6435, getPlayerStorageValue(cid, storage), 50
local maleoutfit, femaleoutfit = 336, 337
function onKill(cid, target, lastHit)
if(isPlayer(target) && kills >= reward) then
return FALSE
elseif(isPlayer(target) && kills < reward) then
setPlayerStorageValue(cid, storage, kills+1)
return TRUE
end
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Warmaster NPC" script="warmasternpc.lua" walkinterval="0" floorchange="0" speed="900">
<health now="150" max="150"/>
<look type="336" head="19" body="19" legs="19" feet="19" addons="2"/>
</npc>
And how can i put it? In creaturescript right?
But how can i put in creaturescript.xml?
What event type is?
<event type="kill" name="WarMaster" event="script" value="warmaster.lua"/>
registerCreatureEvent(cid, "WarMaster")