how to set different speeds on maps?

Hey at all…i would like to set different speeds into maps…example → continents → speedup like x3 and in battleground/arena/instance/raids i want to use normal speed…ive tried it with this script in player.cpp:

void Player::SetMap(Map * map)
{
Unit::SetMap(map);
m_mapRef.link(map, this);
{
if(!map->Instanceable())
{
this->SetSpeed(MOVE_RUN, 2,true);
}
else
{
this->SetSpeed(MOVE_RUN, 1,true);
}
}
}

It works fine…till i get mounted/stunned or slowed.

Any more Ideas to realise it?

You could possibly add a speed modifier for the player.

Not directly set the speed, but add a speed bonus.

On retail these sort of things would probably be made with spells, and speed bonuses are usually from spells anyways and they dont get messed by mounts etc.

You should find out how spells handle the bonus speed. It can be difficult to add and remove according to maps though. With spells it is easy since you need to just check if the player has the spell aura on.

With no spell aura, you might need to store somewhere else then if the player has the mod on or not and erase it on logout / login as well and so.

You could possibly create a fake aura or use some existing spell to achieve this.

Override the setSpeed() method for Players to account for the current map instead of putting this logic in setMap().

There is a command for modify the speed check if you can reprocude effect via automatic system.