// Script that is attached to every player upon landing at the tutorial station //Library Includes include library.utils; include library.npe; include library.sui; include library.groundquests; //constants const float MAX_DISTANCE = 5.0f; const string_id TOO_FAR = new string_id("npe", "gamma_travel_too_far"); //Triggers trigger OnInitialize() { if(hasObjVar(self, npe.QUEST_REWORK_VAR)) { int reGrantSeries = getIntObjVar(self, npe.QUEST_REWORK_VAR); if(reGrantSeries < npe.QUEST_ENUMERATION) { npe.reGrantReWorkedQuests(self); npe.clearActiveSpaceQuests(self); return SCRIPT_CONTINUE; } return SCRIPT_CONTINUE; } npe.reGrantReWorkedQuests(self); npe.clearActiveSpaceQuests(self); return SCRIPT_CONTINUE; } trigger OnDeath(obj_id killer, obj_id corpseId) { groundquests.sendSignal(self, "npe_elevator_atrium_down"); groundquests.sendSignal(self, "npe_elevator_droid_up"); return SCRIPT_CONTINUE; } trigger OnNewbieTutorialResponse(string strAction) { if(strAction.equals("clientReady")) { if(!utils.hasObjVar(self, "npe.pop_chat")) { setYaw(self, -78.0f); dictionary dic = new dictionary(); dic.put("player", self); messageTo(self,"showChat", null, 1, false); messageTo(self,"showEscape", null, 12, false); utils.setObjVar(self, "npe.pop_chat", true); } } return SCRIPT_CONTINUE; } trigger OnSkillGranted(string skill ) { string playerTemplate = getSkillTemplate(self); if(!utils.isProfession(self, utils.TRADER) && !utils.isProfession(self, utils.ENTERTAINER)) { if (!hasObjVar(self, "npe.firstSkillGranted")) { setObjVar(self, "npe.firstSkillGranted", true); npe.sendDelayed3poPopup(self, 0, 12, "sound/vo_c3po_17c.snd", "npe", "pop_first_ability", "npe.pop_first_ability"); newbieTutorialHighlightUIElement (self, "/GroundHUD.Toolbar.volume.0", 5.0f); } } return SCRIPT_CONTINUE; } trigger OnCombatLevelChanged(int oldCombatLevel, int newCombatLevel) { if ( newCombatLevel == 2 ) { if (!hasObjVar(self, "npe.secondLevelGranted")) { setObjVar(self, "npe.secondLevelGranted", true); npe.sendDelayed3poPopup(self, 0, 11, "sound/vo_c3po_18c.snd", "npe", "pop_first_level", "npe.pop_first_level"); } } return SCRIPT_CONTINUE; } //Message Handlers messageHandler showChat() { newbieTutorialHighlightUIElement (self, "/GroundHUD.ChatWindow", 7.0f); npe.giveChatPopUp(self); return SCRIPT_CONTINUE; } messageHandler showEscape() { newbieTutorialHighlightUIElement (self, "/GroundHUD.ButtonBar.bigMenuPage", 7.0f); npe.giveEscPopUp(self); return SCRIPT_CONTINUE; } //this handles the transfer of the player off the station. messageHandler handTransfer() { int btn = sui.getIntButtonPressed(params); obj_id player = sui.getPlayerId(params); if(btn == sui.BP_OK) { //sendSystemMessageTestingOnly(player, "Going to staging area..."); npe.removeAllQuests(player); npe.movePlayerFromSharedStationToFinishLocation(player); } return SCRIPT_CONTINUE; } messageHandler makeUiElementAnimate() { //obj_id player = params.getObjId("player"); int location = params.getInt("location"); float time = params.getFloat("time"); newbieTutorialHighlightUIElement (self, "/GroundHUD.Toolbar.volume."+location, time); return SCRIPT_CONTINUE; } messageHandler doDelayed3POMessage() { string strFile = params.getString("strFile"); string strMessage = params.getString("strMessage"); string scriptVarName = params.getString("scriptVarName"); string soundFile = params.getString("soundFile"); int duration = params.getInt("duration"); obj_id player = params.getObjId("player"); string_id threePioMessage = new string_id(strFile, strMessage); int hadNotif = utils.getIntScriptVar(player, scriptVarName); if(hadNotif == 0) { obj_id building = getTopMostContainer(player); obj_id droid = utils.getObjIdScriptVar(building, "objDroidInvis"); npe.commTutorialPlayer(droid, player, duration, threePioMessage, soundFile, "object/mobile/c_3po.iff"); utils.setScriptVar(player, scriptVarName, 1); return SCRIPT_CONTINUE; } return SCRIPT_CONTINUE; } messageHandler groupPopUp1() { if(!utils.hasObjVar(self, "npe.pop_group_1")) { npe.giveGroupPopUp1(self); setObjVar(self, "npe.pop_group_1", true); } return SCRIPT_CONTINUE; } messageHandler groupPopUp2() { if(!utils.hasObjVar(self, "npe.pop_group_2")) { npe.giveGroupPopUp2(self); setObjVar(self, "npe.pop_group_2", true); } return SCRIPT_CONTINUE; } messageHandler npeGammaTransfer() { int btn = sui.getIntButtonPressed(params); obj_id player = sui.getPlayerId(params); location terminalLoc = utils.getLocationScriptVar(player, "npe.gamma_travel.term_loc"); location playerLoc = getLocation(player); if(btn == sui.BP_OK) { if(getDistance(terminalLoc, playerLoc) < MAX_DISTANCE) { //sendSystemMessageTestingOnly(player, "Going to staging area..."); npe.movePlayerFromSharedStationToOrdMantellDungeon(player); groundquests.sendSignal(player, "leaving_station"); } else sendSystemMessage(self, TOO_FAR); utils.removeScriptVarTree(player, "npe.gamma_travel"); } if(btn == sui.BP_CANCEL) utils.removeScriptVarTree(player, "npe.gamma_travel"); utils.removeScriptVarTree(player, "npe.gamma_travel"); return SCRIPT_CONTINUE; } messageHandler npeStationTransfer() { int btn = sui.getIntButtonPressed(params); obj_id player = sui.getPlayerId(params); location terminalLoc = utils.getLocationScriptVar(player, "npe.gamma_travel.term_loc"); location playerLoc = getLocation(player); if(btn == sui.BP_OK) { if(getDistance(terminalLoc, playerLoc) < MAX_DISTANCE) { //sendSystemMessageTestingOnly(player, "Going to staging area..."); npe.movePlayerFromOrdMantellDungeonToSharedStation(player); groundquests.sendSignal(player, "leave_station"); } else sendSystemMessage(self, TOO_FAR); utils.removeScriptVarTree(player, "npe.gamma_travel"); } if(btn == sui.BP_CANCEL) utils.removeScriptVarTree(player, "npe.gamma_travel"); utils.removeScriptVarTree(player, "npe.gamma_travel"); return SCRIPT_CONTINUE; }