| Author: | Phalzyr |
| Author Website: | n/a |
| Script Name: | Multiple Portals |
| Description: | This script allows you to activate a portal and be given a selection of
portal destinations once a portal has been activated.
It does not portal henchmen with you. NOTE: If you want the script to work with henchmen go to Script 2 below and replace the functions in Script 1 with those in Script 2. If the PC is in battle they will not be given a selection but instead be taken to the primary portal location. |
| Instructions on Use: | See instructions in script comments. |
Script 1:
*Note: There are many scripts contained in the below text
box not just one. Read through the comments to determine where new scripts
are located.
| //First i should say most of this script
are attached //to conversation events, and in my case I made the //conversation name "recallchoices" and also any object //name below starting with RP_ is recall portal and you //should alter names as needed. // //Z1_activateportal //This function goes in the first conversation line //as an action wish I could post my conersation also //it simply sets the portal so that you can use it. void main() { SetLocalInt(OBJECT_SELF,"M1_PORTAL_ACTIVATED",TRUE); } //z1_include //I used this in my include file so I wouldn't //have to retype in every other script. //This will send the user to the selected //portal, and set the recall location. // void mygotoportal(string stag) { object oPC = GetPCSpeaker(); object oPortal = GetObjectByTag(stag); if (GetIsObjectValid(oPortal) == TRUE) { if (GetObjectType(OBJECT_SELF) != OBJECT_TYPE_PLACEABLE) { SetLocalInt(oPC,"NW_L_USED_RECALL",1); SetLocalLocation(oPC,"NW_L_LOC_RECALL",GetLocation(oPC)); } AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,PlaySound("as_mg_telepout1")); AssignCommand(oPC,JumpToObject(oPortal)); AssignCommand(oPC,ActionDoCommand(ClearAllActions())); } else { AssignCommand(oPC,ActionSpeakStringByStrRef(10614)); } } //This will send the user to the selected //portal during battle, and set the recall location. //notice I have a separate storage for battle recall //and conversation recall :) void mygotoportalb(string stag) { object oPC = GetItemActivator(); object oPortal = GetObjectByTag(stag); if (GetIsObjectValid(oPortal) == TRUE) { SetLocalInt(oPC,"NW_L_USED_RECALLB",1); SetLocalLocation(oPC,"NW_L_LOC_RECALLB",GetLocation(oPC)); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,PlaySound("as_mg_telepout1")); AssignCommand(oPC,JumpToObject(oPortal)); AssignCommand(oPC,ActionDoCommand(ClearAllActions())); } else { AssignCommand(oPC,ActionSpeakStringByStrRef(10614)); } }
|
Script 2 (Updates for allowing Henchmen to portal as well):
| //z1_include //replace the same functions in my earlier script with these void mygotoportal(string stag) { object oPC = GetPCSpeaker(); object oPortal = GetObjectByTag(stag); if (GetIsObjectValid(oPortal) == TRUE) { if (GetObjectType(OBJECT_SELF) != OBJECT_TYPE_PLACEABLE) { SetLocalInt(oPC,"NW_L_USED_RECALL",1); SetLocalLocation(oPC,"NW_L_LOC_RECALL",GetLocation(oPC)); } AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,PlaySound("as_mg_telepout1")); AssignCommand(oPC,JumpToObject(oPortal)); object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC); object oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oPC); object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oPC); object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED,oPC); object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED,oPC); if (GetIsObjectValid(oHenchman)) AssignCommand(oHenchman,JumpToObject(oPortal)); if (GetIsObjectValid(oAnimal)) AssignCommand(oAnimal,JumpToObject(oPortal)); if (GetIsObjectValid(oFamiliar)) AssignCommand(oFamiliar,JumpToObject(oPortal)); if (GetIsObjectValid(oDominated)) AssignCommand(oDominated,JumpToObject(oPortal)); if (GetIsObjectValid(oSummoned)) AssignCommand(oSummoned,JumpToObject(oPortal)); AssignCommand(oPC,ActionDoCommand(ClearAllActions())); } else { AssignCommand(oPC,ActionSpeakStringByStrRef(10614)); } } // mygotoportalb - onused/activated item - This will send the user to the selected //portal during battle, and set the recall location. // void mygotoportalb(string stag) { object oPC = GetItemActivator(); object oPortal = GetObjectByTag(stag); if (GetIsObjectValid(oPortal) == TRUE) { SetLocalInt(oPC,"NW_L_USED_RECALLB",1); SetLocalLocation(oPC,"NW_L_LOC_RECALLB",GetLocation(oPC)); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,PlaySound("as_mg_telepout1")); AssignCommand(oPC,JumpToObject(oPortal)); object oHenchman = GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oPC); object oAnimal = GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oPC); object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oPC); object oDominated = GetAssociate(ASSOCIATE_TYPE_DOMINATED,oPC); object oSummoned = GetAssociate(ASSOCIATE_TYPE_SUMMONED,oPC); if (GetIsObjectValid(oHenchman)) AssignCommand(oHenchman,JumpToObject(oPortal)); if (GetIsObjectValid(oAnimal)) AssignCommand(oAnimal,JumpToObject(oPortal)); if (GetIsObjectValid(oFamiliar)) AssignCommand(oFamiliar,JumpToObject(oPortal)); if (GetIsObjectValid(oDominated)) AssignCommand(oDominated,JumpToObject(oPortal)); if (GetIsObjectValid(oSummoned)) AssignCommand(oSummoned,JumpToObject(oPortal)); AssignCommand(oPC,ActionDoCommand(ClearAllActions())); } else { AssignCommand(oPC,ActionSpeakStringByStrRef(10614)); } } |