Forum > Serverside Modding

[QUESTION] Opening/Closing door system

<< < (2/2)

fearless_wind:
I saw these doors on Mythia server. They really work. Both players see it. So, ask Filipsons how to do it.

Daweo:
Hi guys!
It really works. I have this system on my server quite long time, but I didnt want to share.
Nowadays, many servers have this system, so I will share.
Its really easy.

I was inspired by .gob activate command...
This work only for unlocked door. Locked door can be opened, but not closed. I didnt have time to rework it and find solution.
Status of door is reseted by server restart.


--- Code: ---#include "ScriptPCH.h"
#include "ScriptMgr.h"
#include "GameObject.h"

class door_script : public GameObjectScript
{
    public:

        door_script()
            : GameObjectScript("door_script")
{
}
bool OnGossipHello(Player* player, GameObject* go)
{
if (go->GetGoState() == GO_STATE_READY) //if closed -> open
{
go->SetGoState(GO_STATE_ACTIVE);
}
else //if open -> close
{
go->SetGoState(GO_STATE_READY);
}
return true;
}
};

void AddSC_door_script()
{
    new door_script();
}
--- End code ---

Zorak:
hi there, thanks a lot, I will try :)

Navigation

[0] Message Index

[*] Previous page

Go to full version