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

monsters attack one team

Post more information, server version etc.
Do you want a specific monster, for example a demon, to only attack people who are in a guild or party or people who are in a specific guild or party?
 
He wants some specific monsters to only be hostile towards party 1 while party 2 is allied with the monsters, making the monsters not able to attack party 2 and party 2 can't kill the monsters.
 
/\ YES!!

imagine a summoned monster, like fire devil, his shots will not attack members of party
but i want this in wild monsters
nobody need to convince them

i guess the difficulty is to understand my idea
sorry for bad english =/

------
portugues:
esse monstro teria uma inteligencia artificial para determinar quem atacar
imagine um servidor de war; azul contra vermelho
teria um monstro de cada lado que ajudaria o time
por exemplo, ghazbaran atacando o time vermelho
e o morgaroth atacando o time azul

lembrando que pode ser tanto por guilds, partys, cor de outfit, o que estiver à disposição do 0.3.6 ou tfs 1.0
e eu encaixarei em minha ideia


google translator:
this monster would have artificial intelligence to determine who attack
imagine a war server; red vs blue
would have a monster on each side would help the team
for example, Ghazbaran attacking the red team
and the Morgaroth attacking the blue team
recalling that can be a system of guilds, partys, outfit color, which is available to the 0.3.6 or 1.0 tfs
and Ill develop in my idea


obrigado, thanks!!
 
What do you think a monster is?
Can you play a monster?
No you can't otherwise they wouldn't be called an NPC they would be called players.

You people have no imagination what so ever.. everything has to spelled out for you.
 
monster is a .xml non playabe character
"npc" is a .lua non playable character

I honestly do not know how to attack an NPC

by the way, thanks for intolerance to my ignorance ;):p
 
Your welcome..

I don't want to give you the answer, I want you to think about it and find the answer for yourself.

Always check the sources
in Npc.cpp
What do you see in this block of code that allows you to kill an npc?
Code:
bool Npc::loadFromXml(const std::string& filename)
{
    xmlDocPtr doc = xmlParseFile(filename.c_str());
    if(doc)
    {
        xmlNodePtr root, p;
        root = xmlDocGetRootElement(doc);

        if(xmlStrcmp(root->name,(const xmlChar*)"npc") != 0)
        {
            std::cerr << "Malformed XML" << std::endl;
            return false;
        }

        int32_t intValue;
        std::string strValue;

        p = root->children;

        std::string scriptfile = "";
        if(readXMLString(root, "script", strValue))
            scriptfile = strValue;

        if(readXMLString(root, "name", strValue))
            name = strValue;
        else
            name = "";

        if(readXMLInteger(root, "speed", intValue))
            baseSpeed = intValue;
        else
            baseSpeed = 110;

        if(readXMLInteger(root, "attackable", intValue))
            attackable = (intValue != 0);

        if(readXMLInteger(root, "autowalk", intValue))
        {
            //Deprecated attribute.
            std::cout << "[Notice - Npc::Npc] NPC Name: " << name << " - autowalk has been deprecated, use walkinterval." << std::endl;
            walkTicks = 2000;
        }

        if(readXMLInteger(root, "walkinterval", intValue))
            walkTicks = intValue;

        if(readXMLInteger(root, "walkradius", intValue))
            masterRadius = intValue;

        if(readXMLInteger(root, "floorchange", intValue))
            floorChange = (intValue != 0);

        while(p)
        {
            if(xmlStrcmp(p->name, (const xmlChar*)"health") == 0)
            {
                if(readXMLInteger(p, "now", intValue))
                    health = intValue;
                else
                    health = 100;

                if(readXMLInteger(p, "max", intValue))
                    healthMax = intValue;
                else
                    healthMax = 100;
            }
            else if(xmlStrcmp(p->name, (const xmlChar*)"look") == 0)
            {
                if(readXMLInteger(p, "type", intValue))
                {
                    defaultOutfit.lookType = intValue;

                    if(readXMLInteger(p, "head", intValue))
                        defaultOutfit.lookHead = intValue;

                    if(readXMLInteger(p, "body", intValue))
                        defaultOutfit.lookBody = intValue;

                    if(readXMLInteger(p, "legs", intValue))
                        defaultOutfit.lookLegs = intValue;

                    if(readXMLInteger(p, "feet", intValue))
                        defaultOutfit.lookFeet = intValue;

                    if(readXMLInteger(p, "addons", intValue))
                        defaultOutfit.lookAddons = intValue;
                }
                else if(readXMLInteger(p, "typeex", intValue))
                    defaultOutfit.lookTypeEx = intValue;

                if(readXMLInteger(p, "mount", intValue))
                    defaultOutfit.lookMount = intValue;

                currentOutfit = defaultOutfit;
            }
            else if(xmlStrcmp(p->name, (const xmlChar*)"parameters") == 0)
            {
                for(xmlNodePtr q = p->children; q != NULL; q = q->next)
                {
                    if(xmlStrcmp(q->name, (const xmlChar*)"parameter") == 0)
                    {
                        std::string paramKey;
                        std::string paramValue;
                        if(!readXMLString(q, "key", paramKey))
                            continue;

                        if(!readXMLString(q, "value", paramValue))
                            continue;

                        m_parameters[paramKey] = paramValue;
                    }
                }
            }
            else if(xmlStrcmp(p->name, (const xmlChar*)"interaction") == 0)
            {
                if(readXMLInteger(p, "talkradius", intValue))
                    talkRadius = intValue;

                if(readXMLInteger(p, "idletime", intValue) || readXMLInteger(p, "idletimeout", intValue))
                    idleTimeout = intValue;

                if(readXMLInteger(p, "defaultpublic", intValue))
                    defaultPublic = intValue != 0;

                responseList = loadInteraction(p->children);
            }
            p = p->next;
        }

        xmlFreeDoc(doc);

        if(!scriptfile.empty())
        {
            m_npcEventHandler = new NpcScript(scriptfile, this);
            if(!m_npcEventHandler->isLoaded())
                return false;
        }
        return true;
    }
    return false;
}
 
Last edited:
hmmm...
<npc name="Buddel" script="default.lua" walkinterval="1500" floorchange="0" attackable="1">

THANK YOU VERY MUCH
It's not quite as simple as just making an NPC attackable. Doing things this way is going to force you to only be able to use certain weapons that you can't normally obtain throughout the server, then you'll have to make individual scripts for each one as well. There's actually a much simpler way to do it with monsters if you stop thinking everything has to be so complicated.
 
@owned
dont has to be complicated

@Colors
i think onStatsChange may solve it
the creature will do exactly what I want, just using storages for example
thank you!!
You're the one making it complicated. Onstatschange won't solve your problem, the monsters will still shoot at the targets. Lol
 
the monster NEED to shoot at the target
My question is CHOOSE which target
like this:

if (getPlayerStorageValue(target,x))~= 1 then
doMonsterChangeTarget(cid)
end


to not shoot at the target, simple set hostile=0
 
Back
Top