Merge pull request #9 in SWGNXT/dsrc from storytellerFixes to nge-content

* commit 'dd5a9ba1f0a32652edd8210d22a7fefd83d6d121':
  Fixed issue with multiple Event Promoters Spawm by not utilizing the event promoter object.
  Storyteller Vendors are no longer so aloof; they will now turn to face you when addressed. Changed the process of the spawning for the storyteller vendor so it can face the player.
  You can no longer place multiple NPCs if player is on a player structure roof. You can now examine Storyteller Tokens to see whether the token can be placed on a roof-top or not.
  You can no longer use blueprints inside player buildings. You can no longer use blueprints on top of player buildings.
  You can no longer use blueprints inside player buildings. You can no longer use blueprints on top of player buildings.
  Added code for reading the new roof column on Storyteller datatable. Storyteller objects can now be placed on player structure roofs if object is flagged as allowed on roofs. When making a blueprint, objects inside buildings or on player structure roofs do not get added to the blueprint.
  Added a new column for whether objects can be placed on house roofs or not. Added many more objects to be allowed inside interiors and on roofs.
This commit is contained in:
prisoncamp
2014-10-20 04:15:49 -04:00
7 changed files with 1893 additions and 1753 deletions
File diff suppressed because it is too large Load Diff
+29 -3
View File
@@ -492,6 +492,17 @@ boolean allowTokenPlacementInInteriors(string tokenName)
return allowInInteriors == 1;
}
boolean allowTokenPlacementOnRoofs(obj_id token)
{
return allowTokenPlacementOnRoofs(getStaticItemName(token));
}
boolean allowTokenPlacementOnRoofs(string tokenName)
{
int allowOnRoofs = dataTableGetInt(STORYTELLER_DATATABLE, tokenName, "allow_roof");
return allowOnRoofs == 1;
}
obj_id getStorytellerBeingAssisted(obj_id player)
{
obj_id storytellerBeingAssisted = null;
@@ -787,11 +798,24 @@ boolean canDeployStorytellerToken(obj_id player, location here, string tokenName
// block storyteller object placement on player structure roofs and balconies
// unless the object is flagged as allowed in interiors
// UPDATE 9/14/14: Storyteller objects can now be placed on player structure
// roofs if the object is flagged as allowed on roofs
obj_id whatAmIStandingOn = getStandingOn(player);
if( isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn) )
{
sendSystemMessage(player, new string_id("storyteller", "placement_not_on_a_building"));
return false;
if( !allowTokenPlacementOnRoofs(tokenName) )
{
sendSystemMessage(player, new string_id("storyteller", "placement_not_on_a_building"));
return false;
}
else
{
if ( !player_structure.isAdmin(whatAmIStandingOn, player) && !player_structure.isAdmin(whatAmIStandingOn, storytellerBeingAssisted) )
{
sendSystemMessage(player, new string_id("storyteller", "placement_not_building_admin"));
return false;
}
}
}
// city or outpost
@@ -1015,9 +1039,11 @@ string[] recordBlueprintData(obj_id blueprint, obj_id[] storytellerObjects, obj_
string[] excludedTokens = { "st_fn_storyteller_vendor" };
boolean isExcludedToken = false;
location tokLoc = getLocation(object);
obj_id whatAmIStandingOn = getStandingOn(object);
for ( int q=0; q<excludedTokens.length; q++ )
{
if ( tokenName.equals(excludedTokens[q]) || storyteller.getTokenType(tokenName) == storyteller.OTHER )
if ( tokenName.equals(excludedTokens[q]) || storyteller.getTokenType(tokenName) == storyteller.OTHER || isIdValid(tokLoc.cell) || (isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn)) )
{
isExcludedToken = true;
}
@@ -33,7 +33,11 @@ void spawnStorytellerVendor(obj_id self)
{
obj_id entrance = getCellId (self, "entrance");
location storytellerVendorLoc = new location (6.6f, 0.6f, -3.5f, "tatooine", entrance);
obj_id storytellerVendor = create.staticObject ("storyteller_vendor", storytellerVendorLoc);
obj_id storytellerVendor = create.object ("storyteller_vendor", storytellerVendorLoc);
create.addDestroyMessage (storytellerVendor, "storytellerVendorDied", 10f, self);
string name = getName (storytellerVendor);
setCreatureStatic (storytellerVendor, true);
setInvulnerable(storytellerVendor, true);
setYaw(storytellerVendor, -179);
return;
}
@@ -215,4 +219,10 @@ messageHandler choreographerDied()
{
spawnChoreographer(self);
return SCRIPT_CONTINUE;
}
messageHandler storytellerVendorDied()
{
spawnStorytellerVendor(self);
return SCRIPT_CONTINUE;
}
@@ -22,34 +22,74 @@ trigger OnInitialize()
{
return SCRIPT_CONTINUE;
}
obj_id template = create.object("object/tangible/spawning/static_npc/event_promoter_neutral.iff", spawnPoint);
// 10/16/14: Fixed issue with multiple Event Promoters Spawning
// by not utilizing the event promoter object. The script itself
// now deals with attaching the objvars/script to the blank object.
// This is to prevent the persisting of the event promoter object
// and to get only one npc to spawn, rather than multiple on top of
// each other.
obj_id template = create.object("object/tangible/ground_spawning/area_spawner.iff", spawnPoint);
setObjVar(self, "event_perk.promoter", template);
setObjVar(template, "spawns", "commoner");
setObjVar(template, "npc_name", "An Event Promoter");
setObjVar(template, "quest_script", "systems.event_perk.promoter");
setObjVar(template, "promoter_type", "neutral");
string spawnerObjName = "spawning: hotel_promoter_spawner_neutral";
setName(template, spawnerObjName);
attachScript(template, "systems.event_perk.promoter_spawner");
return SCRIPT_CONTINUE;
/******** All promoters are neutral and spawn everywhere now so we don't need this.
// 10/16/14: Fixed these issue npc spawns as well.
// Although this code is commented out, went ahead and
// fixed it anyway just in case we want to do something
// with it in the future.
if(!myPlanet.equals("tatooine") && !myPlanet.equals("corellia") && !myPlanet.equals("naboo") )
return SCRIPT_CONTINUE;
if(myCity.equals("bestine") || myCity.equals("theed") || myCity.equals("kor_vella") ) // Imp
{
obj_id template = create.object("object/tangible/spawning/static_npc/event_promoter_imp.iff", spawnPoint);
obj_id template = create.object("object/tangible/ground_spawning/area_spawner.iff", spawnPoint);
setObjVar(self, "event_perk.promoter", template);
setObjVar(template, "spawns", "commoner");
setObjVar(template, "npc_name", "An Event Promoter");
setObjVar(template, "quest_script", "systems.event_perk.promoter");
setObjVar(template, "promoter_type", "imp");
string spawnerObjName = "spawning: hotel_promoter_spawner_imperial";
setName(template, spawnerObjName);
attachScript(template, "systems.event_perk.promoter_spawner");
return SCRIPT_CONTINUE;
}
if(myCity.equals("mos_entha") || myCity.equals("keren") || myCity.equals("doaba_guerfel") ) // Neutrals
{
obj_id template = create.object("object/tangible/spawning/static_npc/event_promoter_neutral.iff", spawnPoint);
obj_id template = create.object("object/tangible/ground_spawning/area_spawner.iff", spawnPoint);
setObjVar(self, "event_perk.promoter", template);
setObjVar(template, "spawns", "commoner");
setObjVar(template, "npc_name", "An Event Promoter");
setObjVar(template, "quest_script", "systems.event_perk.promoter");
setObjVar(template, "promoter_type", "neutral");
string spawnerObjName = "spawning: hotel_promoter_spawner_neutral";
setName(template, spawnerObjName);
attachScript(template, "systems.event_perk.promoter_spawner");
return SCRIPT_CONTINUE;
}
if(myCity.equals("mos_espa") || myCity.equals("moenia") || myCity.equals("coronet") ) // Rebels
{
obj_id template = create.object("object/tangible/spawning/static_npc/event_promoter_reb.iff", spawnPoint);
obj_id template = create.object("object/tangible/ground_spawning/area_spawner.iff", spawnPoint);
setObjVar(self, "event_perk.promoter", template);
setObjVar(template, "spawns", "commoner");
setObjVar(template, "npc_name", "An Event Promoter");
setObjVar(template, "quest_script", "systems.event_perk.promoter");
setObjVar(template, "promoter_type", "reb");
string spawnerObjName = "spawning: hotel_promoter_spawner_rebel";
setName(template, spawnerObjName);
attachScript(template, "systems.event_perk.promoter_spawner");
return SCRIPT_CONTINUE;
}
********************************************/
+29
View File
@@ -1,4 +1,5 @@
include library.colors_hex;
include library.player_structure;
include library.prose;
include library.static_item;
include library.storyteller;
@@ -84,6 +85,20 @@ trigger OnObjectMenuSelect(obj_id player, int item)
sendSystemMessage(player, new string_id("storyteller", "blueprint_no_trial_accounts"));
return SCRIPT_CONTINUE;
}
// UPDATE 9/14/14: Can no longer use blueprints inside player building
location yourLoc = getLocation(player);
if(isIdValid(yourLoc.cell))
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_inside"));
return SCRIPT_CONTINUE;
}
// UPDATE 9/14/14: Can no longer use blueprints on top of player building
obj_id whatAmIStandingOn = getStandingOn(player);
if( isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn) )
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_on_buildings"));
return SCRIPT_CONTINUE;
}
if (item == MENU_BLUEPRINT_OPTIONS)
{
@@ -290,6 +305,20 @@ trigger OnGroundTargetLoc(obj_id player, int menuItem, float x, float y, float z
return SCRIPT_CONTINUE;
}
location yourLoc = getLocation(player);
if(isIdValid(yourLoc.cell))
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_inside"));
return SCRIPT_CONTINUE;
}
// UPDATE 9/14/14: Can no longer use blueprints on top of player building
obj_id whatAmIStandingOn = getStandingOn(player);
if( isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn) )
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_on_buildings"));
return SCRIPT_CONTINUE;
}
float yaw = getYaw(player);
location newLoc = new location(x, y, z);
+15 -3
View File
@@ -1,3 +1,4 @@
include library.player_structure;
include library.utils;
include library.storyteller;
include library.trial;
@@ -30,6 +31,20 @@ trigger OnObjectMenuSelect(obj_id player, int item)
sendSystemMessage(player, new string_id("storyteller", "blueprint_no_trial_accounts"));
return SCRIPT_CONTINUE;
}
// UPDATE 9/14/14: Can no longer use blueprints inside player building
location yourLoc = getLocation(player);
if(isIdValid(yourLoc.cell))
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_inside"));
return SCRIPT_CONTINUE;
}
// UPDATE 9/14/14: Can no longer use blueprints on top of player building
obj_id whatAmIStandingOn = getStandingOn(player);
if( isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn))
{
sendSystemMessage(player, new string_id("storyteller", "blueprint_not_on_buildings"));
return SCRIPT_CONTINUE;
}
if (item == menu_info_types.ITEM_USE)
{
@@ -84,6 +99,3 @@ boolean createBlueprint(obj_id blueprint, obj_id player)
sendSystemMessage(player, new string_id("storyteller", "blueprint_saved"));
return true;
}
+25 -2
View File
@@ -1,4 +1,5 @@
include library.create;
include library.player_structure;
include library.static_item;
include library.storyteller;
include library.sui;
@@ -44,8 +45,19 @@ trigger OnObjectMenuRequest(obj_id player, menu_info mi)
{
placeMultiMenuLabel = "place_all_npcs";
}
mi.addSubMenu(menuPlacement, menu_info_types.SERVER_MENU1, new string_id("storyteller", placeMultiMenuLabel));
mi.addRootMenu (menu_info_types.ITEM_USE_OTHER, new string_id("storyteller", "set_npc_level"));
// UPDATE 9/14/14: Cannot place multiple npcs if on roof
obj_id whatAmIStandingOn = getStandingOn(player);
// Player is on roof. Do not give them option to place multiple npcs
if( isIdValid(whatAmIStandingOn) && player_structure.isBuilding(whatAmIStandingOn) )
{
mi.addRootMenu (menu_info_types.ITEM_USE_OTHER, new string_id("storyteller", "set_npc_level"));
}
else
// Player is not on roof. Give them option to place multiple npcs
{
mi.addSubMenu(menuPlacement, menu_info_types.SERVER_MENU1, new string_id("storyteller", placeMultiMenuLabel));
mi.addRootMenu (menu_info_types.ITEM_USE_OTHER, new string_id("storyteller", "set_npc_level"));
}
return SCRIPT_CONTINUE;
}
@@ -270,6 +282,17 @@ trigger OnGetAttributes(obj_id player, string[] names, string[] attribs)
if (idx >= names.length)
return SCRIPT_CONTINUE;
}
// UPDATE 9/19/14: Can now examine token to see
// whether or not token can be used on roofs
if ( storyteller.allowTokenPlacementOnRoofs(self) )
{
names[idx] = "storyteller_allow_roof_deploy";
attribs[idx] = "True";
idx++;
if (idx >= names.length)
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}