The script ka_hotspot_click is the most basic world map script from the Official Campaign. It is meant to go in the "ActionScript" field for a hotspot in the world map plugin interface. At end of the script, notice that this calls SaveRosterLoadModule (located in ginc_companion). This function takes two parameters: the name of the module to load and the name of the waypoint the party will jump to. Here are the parameters for this script: string sModule - The file name of the module string sHotspot - The name of the hotspot clicked for the purposes of checking for a special case int nProbSpecial - Percentage chance for a special encounter int nProbRandom - Percentage chance for a random encounter string sDestinationOverride - The waypoint to go to intead of the default for a module string sCustomScript - Name of a custom script to execute There is a percent chance per transition that the party will have an encounter, but it only happens once. I think that the encounter area sends the party along to where they were going after they have completed the encounter. Note the use of GetIsObjectValid(oDest) to determine if the transition is in the current module and SinglePartyTransition( oPC, oDest ) to jump to the waypoint if it is in the current module.
// ka_hotspot_click
//
// Action script for when a hotspot is clicked on the worldmap. Determines the location to send
// the party to.
// BMA-OEI 4/12/06 - replaced LoadNewModule() with SaveRosterLoadModule()
#include "kinc_worldmap"
#include "ginc_debug"
#include "ginc_companions"
#include "ginc_transition"
void JumpParty(object oPartyMember, object oDestination)
{
object oThisArea = GetArea(oPartyMember);
object oJumper = GetFirstFactionMember(oPartyMember);
while (GetIsObjectValid(oJumper))
{
PrettyDebug("Jumping " + GetName(oJumper) + " to " + GetTag(oDestination));
AssignCommand(oJumper, JumpToObject(oDestination));
oJumper = GetNextFactionMember(oPartyMember);
}
}
void main(string sModule, string sHotspot, int nProbSpecial, int nProbRandom, string sDestinationOverride, string sCustomScript)
{
string sDestination;
object oDestination;
int nRoll;
object oPC = OBJECT_SELF;
if(!GetIsSinglePlayer())
{
if(GetWorldMapLocked())
{
SendMessageToPC(oPC, GetStringByStrRef(STRING_REF_MAP_LOCKED));
return;
}
else
{
SetWorldMapLocked();
}
}
//we only want one map encounter per player attempt to travel --
//prevents the player getting barraged by module cutscenes
//when he just wants to get to point B.
if(!GetGlobalInt("bPlayedEncounterOnThisClick"))
{
sDestination = GetModuleEncounter(sModule, sHotspot);
PrettyMessage(sHotspot + " clicked.");
if (sHotspot == "1302OldOwlWell")
{
if (GetGlobalInt("10_met_grobnar") != 1)
{
object oDest = GetObjectByTag("wp_1003_enter");
SetGlobalInt("10_met_grobnar", 1);
if (GetIsObjectValid(oDest))
{
ForceRestParty( oPC );
// BMA-OEI 6/14/06
SinglePartyTransition( oPC, oDest );
//JumpPartyToArea(oPC, oDest);
}
else
{
ForceRestParty( oPC );
//LoadNewModule("1000_Neverwinter_A1", "wp_1003_enter");
SaveRosterLoadModule("1800_Skymirror", "wp_1003_enter");
}
return;
}
}
if(sCustomScript != "")
{
ExecuteScript(sCustomScript, OBJECT_SELF);
}
if(sDestination == "")
{
nRoll = Random(100);
if(nRoll < nProbSpecial)
{
sDestination = GetSpecialEncounter(sModule, sHotspot);
}
else if(nRoll < nProbSpecial + nProbRandom)
{
sDestination = GetRandomEncounter(sModule, sHotspot);
}
}
}
if(sDestination == "")
{
SetGlobalInt("bPlayedEncounterOnThisClick",FALSE);
if(sDestinationOverride == "")
{
sDestination = GetDefaultDestination(sHotspot);
PrettyMessage("Sending to default destination " + sDestination);
}
else
{
sDestination = sDestinationOverride;
}
}
else //we're doing a special, module, or random encounter
{
SetGlobalInt("bPlayedEncounterOnThisClick",TRUE);
// unless our present encounter overrides the message with a global variable, we play it
// and return.
if(!GetGlobalInt(ENCOUNTER_MESSAGE_OVERRIDE))
{
ShowEncounterMessage(sDestination, sModule);
return;
}
SetGlobalInt(ENCOUNTER_MESSAGE_OVERRIDE, FALSE);
}
//this variable handles origin-dependent redirection, like changing the point of
//entry in the docks district depending on whether you came from blacklake
//or the merchant quarter. We reset it to its default here. It is set in the
//cliententer scripts of applicable areas.
SetGlobalInt("OriginArea",0);
oDestination = GetObjectByTag(sDestination);
if(GetIsObjectValid(oDestination))
{
ForceRestParty( oPC );
// BMA-OEI 6/14/06
SinglePartyTransition( oPC, oDestination );
//JumpPartyToArea(oPC, oDestination);
}
else
{
ForceRestParty( oPC );
PrettyDebug("Unable to find waypoint in current module. Initiating module transition.");
PrettyDebug("Loading module. Destination = " + sDestination);
//LoadNewModule(sModule, sDestination);
SaveRosterLoadModule(sModule, sDestination);
}
}