mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
464 lines
13 KiB
Plaintext
464 lines
13 KiB
Plaintext
|
|
include library.sui;
|
|
include library.create;
|
|
include library.ship_ai;
|
|
include library.utils;
|
|
|
|
//=======================================================================
|
|
// OnSpeaking
|
|
//=======================================================================
|
|
|
|
trigger OnSpeaking(string text)
|
|
{
|
|
location playerLocation = getLocation (self);
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// newbie tutorial test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "newbieZoomCamera")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "zoomCamera");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieOpenInventory")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "openInventory");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieCloseInventory")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "closeInventory");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieOpenCharacterSheet")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "openCharacterSheet");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieCloseCharacterSheet")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "closeCharacterSheet");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieChangeMouseMode")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "changeMouseMode");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieEquipToolbar")
|
|
{
|
|
boolean result = newbieTutorialRequest (self, "equipToolbar");
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieEnableRadar")
|
|
{
|
|
boolean result = newbieTutorialEnableHudElement (self, "radar", true, 5);
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
if (text == "newbieDisableRadar")
|
|
{
|
|
boolean result = newbieTutorialEnableHudElement (self, "radar", false, 0);
|
|
if (result)
|
|
debugSpeakMsg(self, "success");
|
|
else
|
|
debugSpeakMsg(self, "fail");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// SUI test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "suitest")
|
|
{
|
|
int temp = sui.msgbox (self, text);
|
|
}
|
|
|
|
if (text == "warptest")
|
|
{
|
|
warpPlayer (self, playerLocation.area, playerLocation.x, playerLocation.y, playerLocation.z + 100, null, 0, 0, 0);
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// weather test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "weather0")
|
|
{
|
|
boolean set = setWeatherData (0, 1.0f, 0.0f);
|
|
if (set)
|
|
debugSpeakMsg(self, text + "set");
|
|
else
|
|
debugSpeakMsg(self, text + "not set");
|
|
}
|
|
|
|
if (text == "weather1")
|
|
{
|
|
boolean set = setWeatherData (1, 0.0f, 1.0f);
|
|
if (set)
|
|
debugSpeakMsg(self, text + "set");
|
|
else
|
|
debugSpeakMsg(self, text + "not set");
|
|
}
|
|
|
|
if (text == "weather2")
|
|
{
|
|
boolean set = setWeatherData (2, -1.0f, 0.0f);
|
|
if (set)
|
|
debugSpeakMsg(self, text + "set");
|
|
else
|
|
debugSpeakMsg(self, text + "not set");
|
|
}
|
|
|
|
if (text == "weather3")
|
|
{
|
|
boolean set = setWeatherData (3, 0.0f, -1.0f);
|
|
if (set)
|
|
debugSpeakMsg(self, text + "set");
|
|
else
|
|
debugSpeakMsg(self, text + "not set");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// ticket purchase test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "addTravelPoints")
|
|
{
|
|
string planet = getCurrentSceneName ();
|
|
location location = getLocation (self);
|
|
|
|
location.x -= 50;
|
|
obj_id object1 = createObject ("object/installation/mining_ore/mining_ore_harvester_style_2.iff", location);
|
|
|
|
boolean result = addPlanetTravelPoint (planet, "point 1", location, 100, true, TPT_PC_Shuttleport);
|
|
if (result)
|
|
debugSpeakMsg (self, "addPlanetTravelPoint point1 succeeded");
|
|
else
|
|
debugSpeakMsg (self, "addPlanetTravelPoint point1 failed");
|
|
|
|
location.x += 100;
|
|
obj_id object2 = createObject ("object/installation/mining_ore/mining_ore_harvester_style_2.iff", location);
|
|
|
|
result = addPlanetTravelPoint (planet, "point2", location, 50, true, TPT_PC_Shuttleport);
|
|
if (result)
|
|
debugSpeakMsg (self, "addPlanetTravelPoint point2 succeeded");
|
|
else
|
|
debugSpeakMsg (self, "addPlanetTravelPoint point2 failed");
|
|
}
|
|
|
|
if (text == "purchaseTicket1")
|
|
{
|
|
string planet = getCurrentSceneName ();
|
|
|
|
boolean result = enterClientTicketPurchaseMode (self, planet, "point 1", false);
|
|
if (result)
|
|
debugSpeakMsg (self, "enterClientTicketPurchaseMode succeeded");
|
|
else
|
|
debugSpeakMsg (self, "enterClientTicketPurchaseMode failed");
|
|
}
|
|
|
|
if (text == "purchaseTicket2")
|
|
{
|
|
string planet = getCurrentSceneName ();
|
|
|
|
boolean result = enterClientTicketPurchaseMode (self, planet, "point2", false);
|
|
if (result)
|
|
debugSpeakMsg (self, "enterClientTicketPurchaseMode succeeded");
|
|
else
|
|
debugSpeakMsg (self, "enterClientTicketPurchaseMode failed");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// structure placement test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "place")
|
|
{
|
|
boolean placed = enterClientStructurePlacementMode(self, self, "object/installation/mining_ore/mining_ore_harvester_style_2.iff");
|
|
if (!placed)
|
|
debugSpeakMsg(self, "OnSpeaking: enterClientStructurePlacementMode failed");
|
|
else
|
|
debugSpeakMsg(self, "OnSpeaking: enterClientStructurePlacementMode succeeded");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// poi test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "poiTest")
|
|
{
|
|
debugSpeakMsg(self, "Making lair at your location");
|
|
location locHome = getLocation(self);
|
|
string strLairDifficulty = create.getLairDifficulty( 4, 40, 20);
|
|
obj_id objLair = createObject("object/tangible/lair/npc_lair.iff", locHome);
|
|
setObjVar(objLair, "spawning.intDifficultyLevel", 20);
|
|
setObjVar(objLair, "spawning.lairDifficulty", strLairDifficulty);
|
|
setObjVar(objLair, "spawning.lairType", "evil_tatooine_village");
|
|
messageTo(objLair, "handle_Spawn_Setup_Complete", null, 0, false);
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// height test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "heightTest")
|
|
{
|
|
int i;
|
|
for (i = 0; i < 9; ++i)
|
|
{
|
|
location position = utils.getRandomLocationInRing (playerLocation, 1, 20);
|
|
float height = getHeightAtLocation (position.x, position.z);
|
|
debugSpeakMsg (self, "height = " + height);
|
|
}
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// zeroLots
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "zeroLots")
|
|
{
|
|
adjustLotCount (self, -getAccountNumLots (self));
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// requestLocation test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "requestLocation")
|
|
{
|
|
if (requestLocation (self, "locationId", playerLocation, 200, 32, true, true))
|
|
debugSpeakMsg (self, "requestLocation succeeded");
|
|
else
|
|
debugSpeakMsg (self, "requestLocation failed");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// ship ai test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "enemy_xwing")
|
|
{
|
|
obj_id ship = createObject("object/ship/xwing.iff", playerLocation);
|
|
ship_ai.unitAddDamageTaken(ship, self, 10000.0f);
|
|
}
|
|
|
|
if (text == "enemy_tiefighter")
|
|
{
|
|
obj_id ship = createObject("object/ship/tiefighter.iff", playerLocation);
|
|
ship_ai.unitAddDamageTaken(ship, self, 10000.0f);
|
|
}
|
|
|
|
if (text == "deleteObject")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
destroyObject (target);
|
|
debugSpeakMsg (self, "destroyObject " +target +" succeeded");
|
|
}
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// group mission critical object test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "createTestObjects")
|
|
{
|
|
for (int i = -3; i < 3; ++i)
|
|
{
|
|
for (int j = -3; j < 3; ++j)
|
|
{
|
|
location location = getLocation(self);
|
|
location.x -= 5 * i;
|
|
location.z -= 5 * j;
|
|
obj_id object = createObject("object/tangible/furniture/space/frn_chair_falcon_passenger_s01.iff", location);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (text == "addMissionCriticalObject")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
if (addMissionCriticalObject(self, target))
|
|
debugSpeakMsg(self, "addMissionCriticalObject" + target + " succeeded");
|
|
}
|
|
else
|
|
debugSpeakMsg(self, "no target");
|
|
}
|
|
|
|
if (text == "removeMissionCriticalObject")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
if (removeMissionCriticalObject(self, target))
|
|
debugSpeakMsg(self, "removeMissionCriticalObject" + target + " succeeded");
|
|
}
|
|
else
|
|
debugSpeakMsg (self, "no target");
|
|
}
|
|
|
|
if (text == "isMissionCriticalObject")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
if (isMissionCriticalObject(self, target))
|
|
debugSpeakMsg(self, "isMissionCriticalObject" + target + " yes");
|
|
else
|
|
debugSpeakMsg(self, "isMissionCriticalObject" + target + " no");
|
|
}
|
|
}
|
|
|
|
if (text == "clearMissionCriticalObjects")
|
|
{
|
|
if (clearMissionCriticalObjects(self))
|
|
debugSpeakMsg(self, "clearMissionCriticalObjects succeeded");
|
|
else
|
|
debugSpeakMsg(self, "clearMissionCriticalObjects failed");
|
|
}
|
|
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
// group mission critical object test
|
|
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
if (text == "conditionTest1")
|
|
{
|
|
obj_id object = createObject("object/tangible/ship/interior_components/alarm_interior.iff", playerLocation);
|
|
}
|
|
|
|
if (text == "conditionTest2")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
setCondition(target, CONDITION_ON);
|
|
}
|
|
|
|
if (text == "getConditionOnOff")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
if (hasCondition(target, CONDITION_ON))
|
|
debugSpeakMsg(target, "on");
|
|
else
|
|
debugSpeakMsg(target, "off");
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//=======================================================================
|
|
// OnPlaceStructure
|
|
//=======================================================================
|
|
|
|
trigger OnPlaceStructure (obj_id player, obj_id deed, location position, int rotation)
|
|
{
|
|
debugSpeakMsg(self, "OnPlaceStructure: entered");
|
|
|
|
obj_id structure = createObject("object/installation/mining_ore/mining_ore_harvester_style_2.iff", position);
|
|
if (structure == null || structure == obj_id.NULL_ID)
|
|
{
|
|
debugSpeakMsg(self, "OnPlaceStructure: createObject failed");
|
|
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
|
|
setYaw(structure, (float)(90 * rotation));
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//=======================================================================
|
|
// OnPurchaseTicket
|
|
//=======================================================================
|
|
|
|
trigger OnPurchaseTicket (obj_id player, string departPlanetName, string departTravelPointName, string arrivePlanetName, string arriveTravelPointName, boolean roundTrip)
|
|
{
|
|
debugSpeakMsg (self, "OnPurchaseTicket: entered");
|
|
debugSpeakMsg (self, departPlanetName);
|
|
debugSpeakMsg (self, departTravelPointName);
|
|
debugSpeakMsg (self, arrivePlanetName);
|
|
debugSpeakMsg (self, arriveTravelPointName);
|
|
debugSpeakMsg (self, roundTrip ? "roundtrip" : "not roundtrip");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//=======================================================================
|
|
// OnNewbieTutorialResponse
|
|
//=======================================================================
|
|
|
|
trigger OnNewbieTutorialResponse (string response)
|
|
{
|
|
debugSpeakMsg (self, "Newbie tutorial: " + response);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//=======================================================================
|
|
// OnLocationReceived
|
|
//=======================================================================
|
|
|
|
trigger OnLocationReceived (string locationId, obj_id locationObject, location locationLocation, float locationRadius)
|
|
{
|
|
//-- test
|
|
debugSpeakMsg (self, "OnLocationReceived: " + locationId);
|
|
|
|
//-- see if the object is valid
|
|
if (locationObject == null || locationObject == obj_id.NULL_ID)
|
|
debugSpeakMsg (self, "OnLocationReceived: could not find a valid location");
|
|
else
|
|
{
|
|
//-- create new object
|
|
obj_id object = createObject("object/installation/mining_ore/mining_ore_harvester_style_2.iff", locationLocation);
|
|
if (object == null || object == obj_id.NULL_ID)
|
|
debugSpeakMsg(self, "OnLocationReceived: createObject failed");
|
|
|
|
//-- destroy reserve object
|
|
if (!destroyObject (locationObject))
|
|
debugSpeakMsg (self, "OnLocationReceived: failed to destroy locationObject");
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//=======================================================================
|