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

Solved NPC that can be moved by players

Way20

Well-Known Member
Joined
Sep 29, 2014
Messages
205
Solutions
3
Reaction score
79
Hi to everyone, its there a way to make an npc that can be moved by normal players? Im currently using TFS 0.4.

UP

BUMP
 
Last edited by a moderator:
Under:

C++:
            if(player->isProtected())
            {
                Player* movingPlayer = movingCreature->getPlayer();
                if(movingPlayer && !movingPlayer->isProtected())
                {
                    player->sendCancelMessage(RET_NOTMOVABLE);
                    return false;
                }
            }

add:

C++:
            if(movingCreature->getNpc() && !Spawns::getInstance()->isInZone(movingCreature->masterPos, movingCreature->masterRadius, toPos)){
                player->sendCancelMessage(RET_NOTENOUGHROOM);
                return false;
            }
 
Under:

C++:
            if(player->isProtected())
            {
                Player* movingPlayer = movingCreature->getPlayer();
                if(movingPlayer && !movingPlayer->isProtected())
                {
                    player->sendCancelMessage(RET_NOTMOVABLE);
                    return false;
                }
            }

add:

C++:
            if(movingCreature->getNpc() && !Spawns::getInstance()->isInZone(movingCreature->masterPos, movingCreature->masterRadius, toPos)){
                player->sendCancelMessage(RET_NOTENOUGHROOM);
                return false;
            }

I got this error when trying to compile.

1ef6767fe7af44fab22aa9803e20aafa.png
 
Now it compiled without errors, I'm not at home now when i get there i will test it, anyway thanks for helping me.

It didn't work, need to do anything more with lua?

BUMP

BUMP!!!

BUMP! Someone please.

Bring Up My Post! again

BUMP! :(

Bring Up My Post! again ²

BUMP!
 
Last edited by a moderator:
Whopsi, in npc.h change:
C++:
virtual bool isPushable() const {return false;}
to
C++:
virtual bool isPushable() const {return true;}
 
I think a moderator cleaned your thread. I posted a solution after your message which I'm now quoting, but the reply is still above yours. Try what I posted.

Yeah, some mod moved my BUMP posts and it bugged yours, even with you posting after me, your post go up.

I compiled again and... IT WORKED! thanks a lot man, your were the only one who tried help me and the only one who did it ;)

I have a last request (if you can't do it, no problem, you already helped a lot).

Is it possible make it work only to a specific NPC? I want that players be able to move only a specific NPC.
 
Yeah, some mod moved my BUMP posts and it bugged yours, even with you posting after me, your post go up.

I compiled again and... IT WORKED! thanks a lot man, your were the only one who tried help me and the only one who did it ;)

I have a last request (if you can't do it, no problem, you already helped a lot).

Is it possible make it work only to a specific NPC? I want that players be able to move only a specific NPC.
You could add it as a flag/parameter. Something like pushable="true". But I cannot help you with it right now since I'm at work
 
As a parameter on the NPC xml file would be awesome. No problem, if you have free time later, take a look at it for me.

Someone that knows c++ please put a extra if into onds code to check npc name, to it work only with a specific npc.

BUMP

Solved! @Ziker did it to me, I'm very grateful to him.
 
Last edited by a moderator:
Back
Top