Modcraft - The community dedicated to quality WoW modding!
Wrath of the Lich King Modding => Serverside Modding => Topic started by: Zorak on September 07, 2013, 01:01:48 pm
-
Hi there,
I would like to ask, if someone has some experience with creating door system. I saw (on another server) doors, which were able to just open on one click, and on second click close itself, no matter who clicked on them (one player opens it, another closes).
I tried to go through the code, but even if I am able to understand the code in general, I am not able edit it.
Now, there is a timer, which closes the door in time (which is load from object's record in DB).
After the timer comes to zero, it resets the door (closes).
Maybe, I would be able to edit it myself, but I cannot find any click function.
now it is something like
case GO_activated (but it says only IS activated, not HOW)
> if door with the right activate state
>set timer
>reset door
but I need something like
if activated
onclick deactivate
if deactivated
onclick activated
So, is here somebody, who is willing to help me?
I am uploading the source file now. If you go CTRL+F "door" (od "DOOR" if your editor need exact letter), you will find any functions attacched to this problem.
Thanks a lot :)
[attachment=0:1s0flh33]GameObject.cpp[/attachment:1s0flh33]
-
Generally the gameobjects that are flagged to open and close on click are client side. So other players won't see the change when you open the door.
What you could do is listen for the event firing on gameobject activate, then see if what the current gameobject bytes are set to. If bytes are set to open, close the object, else open.
*shrug* On which gameobject type the event fires and whether it produces the desirable effects will require testing.
-
Orientate around the instancescripts regarding doors, maybe it helps.
-
Shadow labyrinth door is not character specific iirc.
-
Shadow labyrinth door is not character specific iirc.
Neither is the door in front of the PvP place in Stormwind’s Old Town. During the zombie invasion, zombies were the only one that could click on it, so when they closed the door they locked everybody who wasn’t a zombie out. It made for a lot of angry players who couldn’t get in to buy their BG and arena gear.
EDIT: wouldn’t BG gates also qualify as non-character-specifc doors?
-
I saw these doors on Mythia server. They really work. Both players see it. So, ask Filipsons how to do it.
-
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.
#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();
}
-
hi there, thanks a lot, I will try :)