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

NPCs killables?

Rayeko

Programmer
Joined
Apr 9, 2008
Messages
185
Reaction score
3
Hi

I just wanted to know if it was possible to make NPCs vulnerable, so they can be killed by players. I made it possible to attack NPCs, but nothing inflicts them damage.. Just a poff. Here is my NPC script:

Code:
<?xml version="1.0"?>

<npc name="Eryn" script="data/npc/scripts/default.lua" access="0" attackable="1" walkinterval="7000" lookdir="2">
	<health now="1000" max="1000"/>
<look type="335" head="0" body="57" legs="114" feet="0" addons="3"/>
<parameters>
        <parameter key="message_greet" value="Welcome here, |PLAYERNAME|." />
    </parameters>
</npc>

Thanks in advance!
 
Edit:
LOL Just changed "type=target" to "type=attack" and it worked xDD But, now I must figure out how to make so that the damage inflicted to the NPC is obtained from a formula, depending on the spell the player used or from the weapon he used :/ and that can be a little bit complicated, I think u,u

Edit2: It only works when attacking with weapon. If spells are used, nothing happens xD

Edit3: Also, when the NPC is killed with the script, it doesn't dies. It stands there without HP. Althought I put "corpse=6080" in the npc.xml file u,u
add this part to the one u used:
Code:
local corpse = doCreateItem(corpse_ids[getPlayerSex(target)], 1, getThingPos(cid))
local corpse_ids = {
	[0] = 3065,
	[1] = 3058
}
doItemSetAttribute(corpse, "specialdescription", "You recognize " .. getCreatureName(target) .. ". " .. (getPlayerSex(cid) == 0 and "She" or "He") .. " was killed by " .. getCreatureName(cid) .. ".")
 
Thanks both for the help x)

But, anyway I won't use this, finally.. Because I can't realize how to make all the formulas in the script too, so that it inflict the damage depending on the spell or weapon the player used.. u,u
 
I will give u the source edit when I get back on my laptop. Send me a pm so I don't forget. Btw u may want to try onstatschange
 
Back
Top