• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.0] Guard NPC onKill Creatures/PKs

Eldin

Eldin Projects
Joined
Jun 12, 2008
Messages
1,334
Reaction score
615
Location
Sweden
Greets again! ^^

From what I understand, its not yet possible to create a Guard NPC that protects the Town from raids?
I haven't really figured it out how Icould use it on TFS 1.0. (So I don't Think it'll work)

A Guard NPC:
*Attacks Creatures (Would be AWESOME if they attack him as a player!)
*Attacks anyone with Skull.
*Behave in the way you make, like attack, heal, shoot spells etc.
*Can die and will then respawn after X time.

This (With attack back) could make perfect raid defend systems and much more.
Thanks in advance.

Kind Regards,
Eldin.
 
It is possible... but it requires a great deal of coding.
It wouldn't be an NPC but a monster which will be given his own AI (hard coded) via creaturescripts and onThink functions.

Someone made those kind of monsters years ago... can't remember who it was though :p

There's another way though, you could make NPCs vulnerable to attacks via source editing npc.h file
(there's a line like "ConditionImmuneCombat" or something, it is there :) )

Edit: after checking some functions, it's better to hard code it, forget source editing
 
Last edited:
Thanks alot, really appriciate it, would be used on all my servers.
Hmm, not possible to make a "Friendly" monster that only attacks other creatures and people with skull then?
Trying to find a solution as well...

Kind Regards,
Eldin.
 
Thanks alot, really appriciate it, would be used on all my servers.
Hmm, not possible to make a "Friendly" monster that only attacks other creatures and people with skull then?
Trying to find a solution as well...

Kind Regards,
Eldin.
Yes, you can do it. Tfs 1.0 have monster scripting and you can make one AI for monster become a guard, but i think it's better you code a advanced npc...
 
Okey, thank you for that.
How about the NPCs attacking them as well as skulled players then? ;)

Kind Regards,
Eldin.
 
NPCs attacking monsters and skulled players is not a big deal, but the monsters won't attack back and a player has to run respectively since NPCs are nonattackable.

As soon as I get MY FUCKING TFS1.0 FIXED I'll get to it :D

Maybe someone else has it done in the meantime, we'll see.
 
You acutally CAN make an NPC attackable.... as simple as that

here's the c++
Code:
bool isImmune(CombatType_t) const {
       return true;
     }
     bool isImmune(ConditionType_t) const {
       return true;
     }
     virtual bool isAttackable() const {
       return attackable;

Thing is, he doesn't take any dmg, since "isIummune" to combat dmg always returns true, haven't found a way around that, else then
function onAttack(cid, attacker,..)
if getCreatureName(target) == "NPC Name" then
addhealth(-100)
end
end
or something like that..

any new suggestions?
 
Back
Top