How to stop a transport

Hi, I’m trying to put The SkyBreaker/ Orgrim’ Hammer at the end of instance Halls of Reflection.

So far I have succeeded in putting the right boat and move from its initial position to be placed in the right spot where to shoot. But either the movement is continuous and when it reaches the final point reappears in the beginning and repeat the journey continously, or can’t move at all.

Here is the code:

Halls_of_reflection.h


NPC_JAINA_OUTRO = 36955,

NPC_SYLVANA_OUTRO = 37554,

GO_SKYBREAKER = 201598,

GO_ORGRIM_HAMMER = 201599,

In the script, in the final performance when she leaves the cave and just before the Lich King will launch the spell, I activate the boat, selecting this depending on whether the NPC is Jaina (Team Alliance) or Sylvanas (Horde team)

Halls_of_reflection.cpp


CreateTransport(me->GetEntry() == NPC_JAINA_OUTRO ? GO_SKYBREAKER : GO_ORGRIM_HAMMER, 9000, me->GetMap);

And the function is:


void CreateTransport(uint32 goEntry, uint32 period, Map* tMap)

{


const GameObjectTemplate *goInfo = sObjectMgr->GetGameObjectTemplate(goEntry);


Transport* t = new Transport(period, goInfo->ScriptId);

std::set<uint32> mapsUsed;

t->GenerateWaypoints(goInfo->moTransport.taxiPathId, mapsUsed);

uint32 transportLowGuid = sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT);

t->Create(transportLowGuid, goEntry, t->m_WayPoints[0].mapid, t->m_WayPoints[0].x, t->m_WayPoints[0].y, t->m_WayPoints[0].z, 0.0f, 100, 0);

t->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

t->SetGoState(GO_STATE_READY);

t->SetMap(tMap);

t->AddToWorld();

t->BuildStartMovePacket(tMap);

t->SetGoState(GO_STATE_ACTIVE);

t->Update(1);

}

With this function, appears the correct boat and moves it… but never stops /emoticons/default_sad.png

In theory, the next code is necessary, but if i put this at end of this function, the boat doesn’t move:


t->BuildStopMovePacket(tMap);

Please, someone know how to stop this boat at the end of its travel?

I have had a similar issue with the Gunship Battle. I don’t know if you can assign a TransportScript to a GameObject, and if you could, that could help a lot :S.

With a TransportScript, it does all become easy. I don’t remember well but there’s a hook OnWaypointReached I think.

Any information ?

I have the same probelem in HOR, when i creatre the transport


CreateTransport(GO_SKYBREAKER, SKYBREAKER_PERIOD, me->GetMap());

The skybreaker appair, and loop the transport …

How to run the transport one time, how to stop it in the 1st stop for an X period, then run the next step of the transport ?

HoR. When i remember right there is a multi event. I mean when the ship came, some npc say’s a dialogue and fires at the hole that collapse than and gave the achievement (for the first run). After that, the ship lower hes angle and if you watch it carefully that can be a phase switch or a simple respawn of the ship with the ramp. But i think it is a phase switch.

Acid, this code is only a example… the question is: How stop a transport at end of its travel?.

If you use GO_STATE_READY, the boat appear at first position. If you use GO_STATE_ACTIVE, the boat move… but i think if you use GO_STATE_ACTIVE_ALTERNATIVE should stop at the end point or at least to the point that is currently… but GO_STATE_ACTIVE_ALTERNATIVE is working as GO_STATE_ACTIVE and don’t stop the boat /emoticons/default_sad.png

Ident, yes, some npc (Jaina/Sylvannas and Linch King) say’s a dialogue… Linch King cast a spell over Jaina/Sylvannas and, at this moment the boat appear from below, and boat fire to collapse cave. After this happens, more dialogues (Jaina/Sylvannas and boat’s Captain) and appear the ramp to get on the boat, loot chest and a portal to Dalaran. But i’m talking about the movement boat from below to fire position.

You can use a horrible hack and when finish the boat waypoints make a delete or a phase switch for this transport and put a simple object created with the boat’ displayid at end position… but i don’t like this, I think is incredible not exist a command/order/state to transport stop at end of travel, necessary to this, Ulduar’ train, ICC batleship, etc. /emoticons/default_wacko.png

But if you play at offi, you must see that many times blizz solve some things with phase switching and i think it is just the same situation. You know, emulation is about 98% guesses /emoticons/default_smile.png Even if you find this nasty, my guess is that. There isn’t always a command for something, even blizz can go on the easier road. The more elegant way is what you try to do and maybe thats the proper way. To make the situation clear, someone with the right skills needs to go there and sniff the needed data. I had sniffer for 4.2 but for the 4.2a i dont have.

ps.: what if you just delay the movement of the ship at a new waypoint (this also triggers the spawn of the ramp) and the wait time is read from the db/dbc or w/e (sry, long time didn’t used TC) where it saves the instances reset time, or make it a static - high - value?

Or im just almost sleeping and you try to say the problem appears right there, where the ships fireing at the cave, or the ship stays in position when fireing the cave, but moves when it got collapsed?

Mind sharing the whole code?

Would be also interesting to others who have no experience with skripting a transport.

GO_STATE_READY, GO_STATE_ACTIVE, GO_STATE_ACTIVE_ALTERNATIVE do the same thing …


Transport* StartGunshipBattleTransport(uint32 goEntry, uint32 period, Map* tMap)

{

	const GameObjectTemplate* goInfo = sObjectMgr->GetGameObjectTemplate(goEntry);


	if (!goInfo) return NULL;


	Transport *t = new Transport(period, goInfo->ScriptId);


	std::set<uint32> mapsUsed;

	t->GenerateWaypoints(goInfo->moTransport.taxiPathId, mapsUsed);


	uint32 transportLowGuid = sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT);


	t->Create(transportLowGuid, goEntry, t->m_WayPoints[0].mapid, t->m_WayPoints[0].x,t->m_WayPoints[0].y, t->m_WayPoints[0].z, 0.0f, 0, 0);

	t->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

	t->SetGoState(GO_STATE_READY);

	t->SetMap(tMap);

	t->AddToWorld();

	t->SetGoState(GO_STATE_ACTIVE);


	for (Map::PlayerList::const_iterator itr = tMap->GetPlayers().begin(); itr != tMap->GetPlayers().end(); ++itr)


		if (Player* pPlayer = itr->getSource())

		{

			UpdateData transData;

			t->BuildCreateUpdateBlockForPlayer(&transData, pPlayer);

			WorldPacket packet;

			transData.BuildPacket(&packet);

			pPlayer->SendDirectMessage(&packet);

		}


	sMapMgr->m_Transports.insert(t);

	t->Update(1);

	return t;

}

The transport is in my transport table, the player must be on the transport to run the event, and when i run the transport, it create a new one.

It’s very scruffy.

First of all, thanks for your help, but like i said before, this is only an example… the management of transport is similar for all instances and i try to understand how to use it.

Ident, please, look this http://www.youtube.com/watch?v=avCuThwImEg (6:38) and you understand what i’m trying to say

Anonimo & Bizzy, transport management is here, if you ask for a script of complete instance the best code that i found is https://github.com/Locknes/ChaosCore but this part isn’t finish yet.

Acid, this is a typical code of transport… but this is only to create and implement it, the problem is how stop it:

t->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); ->make object not in use

t->SetGoState(GO_STATE_READY); → put object at first waypoint and stop it

t->SetMap(tMap);-> selection default map

t->AddToWorld();-> add to world xD

t->SetGoState(GO_STATE_ACTIVE); ->put the object in motion through waypoints

and now… how to stop?

If you use t->SetGoState(GO_STATE_READY); the object stop… but at first waypoint, not in finish waypoint

In theory if you use t->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); other objects like doors or elevators, stay at end waypoint and stop (the doors are open) , but with this objects GO_STATE_ACTIVE_ALTERNATIVE = GO_STATE_ACTIVE no differences between them.

The next part of your code, Acid, is for transmit the transport insertion into the map to all players located in this map.

Yes suicida we need some help to know how to stop a transport.

Any TC transport wiki ? (http://www.trinitycore.info/Transports_tc2 database only)

Got it now /emoticons/default_smile.png

Sadly noone have a video where you can watch only the ship, maybe i’ll be able today to go back there and fraps it.

btw: at 6:59 watch the big propeller at the left side (when the loot sound appears and the ramp spawns /emoticons/default_tongue.png ) Imo that happens after the cave has been collapsed too, so it must be another spawn of the ship, this way it’s normal if the object stops, but not exactly logical to make a final spawn than when the ramp spawns O.o (just brainstorming loudly /emoticons/default_smile.png)

Then again, can you share the whole HoR code?

t->BuildStopMovepacket()

But when ? How do we know that it’s the end of the waypoint ?


t->BuildStopMovePacket(tMap);

An exemple please.

What about looking at the code that handles the normal boats (Stormwind / Auberdine, etc. etc.)?

They know when to stop and sit at the dock long enough for players to enter/exit, you might be able to get an idea how to handle your particluar issue.

TransportScript::OnUpdate is your love.

xDD read before, please… t->BuildStopMovepacket() or TransportScript::OnUpdate, not work. the boat only stop at first point. I think maybe missing a parameter in the creation of transport to indicate whether this stops at the end of the journey or continue in an infinite loop.

Ident wrote about to put another object at the end, thinking Blizzard made this… but not, if you see the TaxiPathNode of these transports, in the penultimate node (highest point of travel) triggers an event (presumably the cannons firing) and the last node fires another event (deployment ramp, I guess) so makes no sense to remove the transport to place an object fixed in position to stop it.