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

Lua npc atack player (example, ajax or queen eloise) REQUEST

Xavicrak

New Member
Joined
Mar 23, 2010
Messages
186
Reaction score
4
Hi otlanders
As you know, whe a player say fuck to queen eloise, she hit you all life until 1hp. I think this is easy, just add to npc: if msgcontains(msg,"fuck") then doPlayerAddHealth(cid,-getPlayerMaxHealth(cid)+1) end...

but the problem come when you dont need it, you need TO SET CONDITION FIRE, like Ajax.

I tried to do this:

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t = {}

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 combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)

local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 2000, -10)
setCombatCondition(combat, condition)

local STORAGE_BARBARIAN1 = 3020
local EXHAUST_BARBARIAN1 = 3021
local STORAGE_BARBARIAN2 = 3023
local STORAGE_ENTREGA2 = 3024
local EXHAUST_BARBARIAN2 = 3025

function greetCallback(cid)
    if getCreatureStorage(cid,STORAGE_BARBARIAN1) <= 1 then
		npcHandler:setMessage(MESSAGE_GREET, "Whatcha do in my place?")
		doCombat(cid, combat, var)
    elseif getCreatureStorage(cid,STORAGE_BARBARIAN1) == 2 then
        if exhaustion.get(cid,EXHAUST_BARBARIAN1) == FALSE then 
            npcHandler:setMessage(MESSAGE_GREET,"NEVER EVER COME BACK HERE!!",cid)
            npcHandler:releaseFocus(cid)
        elseif exhaustion.get(cid,EXHAUST_BARBARIAN1) == TRUE then
            npcHandler:setMessage(MESSAGE_GREET,"You back. You know, you right. Brother is right. Fist not always good. Tell him that!",cid)
            doCreatureSetStorage(cid, STORAGE_BARBARIAN1,3) 
        end
    elseif getCreatureStorage(cid,STORAGE_BARBARIAN1) >= 3 then
        npcHandler:setMessage(MESSAGE_GREET, "Whatcha do in my place?")
    end
return true
end

BUT IT DOESN'T WORK!

So any of you know how to do this? I mean: when you say "hi" to Ajax, it must setcondition on you, FIRE! YOU ARE BURNING WHILE YOU SPEAK WITH AJAX.

did you understand?
 
under:
Code:
NpcSystem.parseParameters(npcHandler)
add:
Code:
local fire = createConditionObject(CONDITION_FIRE)
addDamageCondition(fire, 10, 2000, -10)

under:
Code:
npcHandler:setMessage(MESSAGE_GREET, "Whatcha do in my place?")
add:
Code:
doTargetCombatCondition(0, cid, fire, 4)
doSendMagicEffect(getThingPos(getNpcCid()), CONST_ME_YELLOW_RINGS)
 
Back
Top