Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: The E on September 12, 2010, 07:44:16 am

Title: Tertiary Weapons and scripting enhancements
Post by: The E on September 12, 2010, 07:44:16 am
So, I and other people on BP talked a bit about introducing "Equipment" type weapons.

Basic concept would be that you would equip these just as you would a primary or secondary weapon, only that instead of shooting bolts of plasma, beams, or other go-boom type stuff at people, these would basically alter bits and pieces of gameplay by calling scripts.

To that end, I present these test builds. There are several alterations to weapons.tbl and scripting.tbl, detailed below.

weapons.tbl

To define a piece of equipment, the following additions to weapons.tbl have been made. After the "#Primary Weapons" list, you can now define a list of equipment to be mounted in a primary slot by using "#Primary Mount Equipment". To define a piece of equipment that uses a secondary slot, use "#Secondary Mount Equipment", to be inserted after "#Secondary Weapons".

Example:
Code: [Select]
#Primary Weapons
    [List of weapons]
#End

#Primary Mount Equipment
    [List of weapons]
#End

#Secondary Weapons
    [List of weapons]
#End

#Secondary Mount Equipment
    [List of weapons]
#End

scripting.tbl

The meat of this Equipment system is to be found here. I have added a "$Equipment" conditional hook to that end. Here's how to use it:

Code: [Select]
#Conditional Hooks

$Equipment: <Equipment name as defined in weapons.tbl>

There are also several new actions available, which can be used both with "$Equipment", as well as the old "$Weapon Class" hooks.


For easy access to the ship that carries the equipment, you can access the "User" object from the hv array. There is also a "Target" object available there, which contains the ship's current target.

Test builds can be found here: http://blueplanet.fsmods.net/E/FSO%20Tertiaries.7z

Code patch:
Code: [Select]
Index: object/object.cpp
===================================================================
--- object/object.cpp (revision 6461)
+++ object/object.cpp (working copy)
@@ -1408,6 +1408,20 @@
 
  // move post
  obj_move_all_post(objp, frametime);
+
+ //Equipment script processing
+ if (objp->type == OBJ_SHIP) {
+ ship* shipp = &Ships[objp->instance];
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPEQUIPPED, 0, NULL, objp);
+ }
  }
  objp = GET_NEXT(objp);
  }
Index: parse/scripting.cpp
===================================================================
--- parse/scripting.cpp (revision 6461)
+++ parse/scripting.cpp (working copy)
@@ -38,6 +38,7 @@
  {"KeyPress", CHC_KEYPRESS, 0},
  {"Version", CHC_VERSION, 0},
  {"Application", CHC_APPLICATION, 0},
+ {"Equipment", CHC_EQUIPMENT, 0}
 };
 
 int Num_script_conditions = sizeof(Script_conditions)/sizeof(flag_def_list);
@@ -66,6 +67,10 @@
  {"On Death", CHA_DEATH, 0},
  {"On Mission End", CHA_MISSIONEND, 0},
  {"On Weapon Delete", CHA_ONWEAPONDELETE, 0},
+ {"On Weapon Equipped", CHA_ONWPEQUIPPED, 0},
+ {"On Weapon Fired", CHA_ONWPFIRED, 0},
+ {"On Weapon Selected", CHA_ONWPSELECTED, 0},
+ {"On Weapon Deselected", CHA_ONWPDESELECTED, 0}
 };
 
 int Num_script_actions = sizeof(Script_actions)/sizeof(flag_def_list);
@@ -245,6 +250,54 @@
  if(stricmp(Ships[objp->instance].ship_name, scp->data.name))
  return false;
  break;
+ case CHC_EQUIPMENT: {
+ if(objp == NULL || objp->type != OBJ_SHIP)
+ return false;
+
+ ship* shipp = &Ships[objp->instance];
+ switch (action) {
+ case CHA_ONWPSELECTED:
+ if( !((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].name == scp->data.name) || (Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name == scp->data.name)) )
+ return false;
+ break;
+ case CHA_ONWPDESELECTED:
+ if ( !( ((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].name == scp->data.name) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].name != scp->data.name)) || ((Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.previous_secondary_bank]].name == scp->data.name) && (Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.previous_secondary_bank]].name != scp->data.name)) ))
+ return false;
+ break;
+ case CHA_ONWPEQUIPPED: {
+ bool equipped = false;
+ for(int i = 0; i < 3; i++) {
+ if (!equipped) {
+ if ( !stricmp(Weapon_info[shipp->weapons.primary_bank_weapons[i]].name, scp->data.name) )
+ equipped = false;
+ else {
+ equipped = true;
+ break;
+ }
+ }
+ }
+
+ if (!equipped) {
+ for(int i = 0; i < 4; i++) {
+ if (!equipped) {
+ if ( !stricmp(Weapon_info[shipp->weapons.primary_bank_weapons[i]].name, scp->data.name) )
+ equipped = false;
+ else {
+ equipped = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!equipped)
+ return false;
+
+ break;
+ }
+ }
+ break;
+ }
  case CHC_MISSION:
  {
  //WMC - Get mission filename with Mission_filename
@@ -270,12 +323,63 @@
  return false;
  break;
  }
- case CHC_WEAPONCLASS:
- if(objp == NULL || objp->type != OBJ_WEAPON)
- return false;
- if(stricmp(Weapon_info[Weapons[objp->instance].weapon_info_index].name, scp->data.name))
- return false;
- break;
+ case CHC_WEAPONCLASS:
+ {
+ if (!(action == CHA_ONWPSELECTED || action == CHA_ONWPDESELECTED || action == CHA_ONWPEQUIPPED || action == CHA_ONWPFIRED)) {
+ if(objp == NULL || objp->type != OBJ_WEAPON)
+ return false;
+ else if(stricmp(Weapon_info[Weapons[objp->instance].weapon_info_index].name, scp->data.name) != 0)
+ return false;
+ } else if(objp == NULL || objp->type != OBJ_SHIP) {
+ return false;
+ } else {
+
+ // Okay, if we're still here, then objp is both valid and a ship
+ ship* shipp = &Ships[objp->instance];
+ switch (action) {
+ case CHA_ONWPSELECTED:
+ if( !((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].name == scp->data.name) || (Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name == scp->data.name)) )
+ return false;
+ break;
+ case CHA_ONWPDESELECTED:
+ if ( !( ((Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].name == scp->data.name) && (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.previous_primary_bank]].name != scp->data.name)) || ((Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.previous_secondary_bank]].name == scp->data.name) && (Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.previous_secondary_bank]].name != scp->data.name)) ))
+ return false;
+ break;
+ case CHA_ONWPEQUIPPED: {
+ bool equipped = false;
+ for(int i = 0; i < 3; i++) {
+ if (!equipped) {
+ if ( !stricmp(Weapon_info[shipp->weapons.primary_bank_weapons[i]].name, scp->data.name) )
+ equipped = false;
+ else {
+ equipped = true;
+ break;
+ }
+ }
+ }
+
+ if (!equipped) {
+ for(int i = 0; i < 4; i++) {
+ if (!equipped) {
+ if ( !stricmp(Weapon_info[shipp->weapons.primary_bank_weapons[i]].name, scp->data.name) )
+ equipped = false;
+ else {
+ equipped = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!equipped)
+ return false;
+
+ break;
+ }
+ }
+ } // case CHC_WEAPONCLASS
+ break;
+ }
  case CHC_OBJECTTYPE:
  if(objp == NULL)
  return false;
@@ -1190,6 +1294,7 @@
  case CHC_OBJECTTYPE:
  case CHC_VERSION:
  case CHC_APPLICATION:
+ case CHC_EQUIPMENT:
  default:
  stuff_string(sct.data.name, F_NAME, NAME_LENGTH);
  break;
Index: parse/scripting.h
===================================================================
--- parse/scripting.h (revision 6461)
+++ parse/scripting.h (working copy)
@@ -36,6 +36,7 @@
 #define CHC_KEYPRESS 8
 #define CHC_VERSION 9
 #define CHC_APPLICATION 10
+#define CHC_EQUIPMENT 11
 
 //Actions
 #define CHA_NONE -1
@@ -61,6 +62,10 @@
 #define CHA_ONSTATESTART 19
 #define CHA_ONSTATEEND 20
 #define CHA_ONWEAPONDELETE 21
+#define CHA_ONWPEQUIPPED 22
+#define CHA_ONWPFIRED 23
+#define CHA_ONWPSELECTED 24
+#define CHA_ONWPDESELECTED 25
 
 
 struct script_condition
Index: ship/ship.cpp
===================================================================
--- ship/ship.cpp (revision 6461)
+++ ship/ship.cpp (working copy)
@@ -75,6 +75,7 @@
 #include "autopilot/autopilot.h"
 #include "cmdline/cmdline.h"
 #include "object/objcollide.h"
+#include "parse/scripting.h"
 
 
 
@@ -4532,10 +4533,13 @@
  swp->current_primary_bank = -1;
  swp->current_secondary_bank = -1;
 
+ swp->previous_primary_bank = -1;
+ swp->previous_secondary_bank = -1;
 
  if ( sip->num_primary_banks > 0 ) {
  if ( swp->primary_bank_weapons[BANK_1] >= 0 ) {
  swp->current_primary_bank = BANK_1;
+ swp->previous_primary_bank = BANK_1;
  } else {
  swp->current_primary_bank = -1;
  }
@@ -4547,6 +4551,7 @@
  if ( sip->num_secondary_banks > 0 ) {
  if ( swp->secondary_bank_weapons[BANK_1] >= 0 ) {
  swp->current_secondary_bank = BANK_1;
+ swp->previous_secondary_bank = BANK_1;
  } else {
  swp->current_secondary_bank = -1;
  }
@@ -9423,8 +9428,12 @@
  }
 
  // now handle the energy as usual
- // deplete the weapon reserve energy by the amount of energy used to fire the weapon
- shipp->weapon_energy -= points*numtimes * winfo_p->energy_consumed;
+ // deplete the weapon reserve energy by the amount of energy used to fire the weapon
+ // Only subtract the energy amount required for equipment operation once
+ if (winfo_p->subtype == WP_TERTIARY_LASER)
+ shipp->weapon_energy -= winfo_p->energy_consumed;
+ else
+ shipp->weapon_energy -= points*numtimes * winfo_p->energy_consumed;
  // note for later: option for fuel!
 
  // Mark all these weapons as in the same group
@@ -9752,6 +9761,17 @@
  }
  }
 
+ object *objp = &Objects[shipp->objnum];
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPFIRED, 0, NULL, objp);
+
  return num_fired;
 }
 
@@ -10260,7 +10280,10 @@
  }
 
  int pnt_index=start_slot;
- for ( j = start_slot; j <= end_slot; j++ ) {
+ //If this is a tertiary weapon, only subtract one piece of ammo
+ if (wip->subtype == WP_TERTIARY_MISSILE) {
+ swp->secondary_bank_ammo[bank]--;
+ } else for ( j = start_slot; j <= end_slot; j++ ) {
  int weapon_num;
 
  swp->secondary_next_slot[bank]++;
@@ -10444,6 +10467,17 @@
 
  }
 
+ object *objp = &Objects[shipp->objnum];
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPFIRED, 0, NULL, objp);
+
  return num_fired;
 }
 
@@ -10633,6 +10667,11 @@
  // make sure we're okay
  Assert((swp->current_primary_bank >= 0) && (swp->current_primary_bank < swp->num_primary_banks));
 
+ if(swp->current_primary_bank != original_bank)
+ swp->previous_primary_bank = original_bank;
+ else
+ swp->previous_primary_bank = swp->current_primary_bank;
+
  // if this ship is ballistics-equipped, and we cycled, then we had to verify some stuff,
  // so we should check if we actually changed banks
  if ( (swp->current_primary_bank != original_bank) || ((shipp->flags & SF_PRIMARY_LINKED) != original_link_flag) )
@@ -10642,6 +10681,18 @@
  snd_play( &Snds[SND_PRIMARY_CYCLE], 0.0f );
  }
  ship_primary_changed(shipp);
+ object* objp = &Objects[shipp->objnum];
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPSELECTED, 0, NULL, objp);
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPDESELECTED, 0, NULL, objp);
  return 1;
  }
 
@@ -10659,6 +10710,18 @@
  }
 
  ship_primary_changed(shipp);
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPSELECTED, 0, NULL, objp);
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPDESELECTED, 0, NULL, objp);
+
  return 1;
 }
 
@@ -10725,11 +10788,28 @@
 
  if ( swp->current_secondary_bank != original_bank )
  {
+ if(swp->current_primary_bank != original_bank)
+ swp->previous_primary_bank = original_bank;
+ else
+ swp->previous_primary_bank = swp->current_primary_bank;
  if ( objp == Player_obj )
  {
  snd_play( &Snds[SND_SECONDARY_CYCLE], 0.0f );
  }
  ship_secondary_changed(shipp);
+
+ object* objp = &Objects[shipp->objnum];
+ object* target;
+ if (Ai_info[shipp->ai_index].target_objnum != -1)
+ target = &Objects[Ai_info[shipp->ai_index].target_objnum];
+ else
+ target = NULL;
+ if (objp == Player_obj && Player_ai->target_objnum != -1)
+ target = &Objects[Player_ai->target_objnum];
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPSELECTED, 0, NULL, objp);
+ Script_system.SetHookObjects(2, "User", objp, "Target", target);
+ Script_system.RunCondition(CHA_ONWPDESELECTED, 0, NULL, objp);
  return 1;
  }
  } // end if
Index: ship/ship.h
===================================================================
--- ship/ship.h (revision 6461)
+++ ship/ship.h (working copy)
@@ -105,6 +105,10 @@
  int current_secondary_bank; // currently selected secondary bank
  int current_tertiary_bank;
 
+ int previous_primary_bank;
+ int previous_secondary_bank; // currently selected secondary bank
+ int previous_tertiary_bank;
+
  int next_primary_fire_stamp[MAX_SHIP_PRIMARY_BANKS]; // next time this primary bank can fire
  int last_primary_fire_stamp[MAX_SHIP_PRIMARY_BANKS]; // last time this primary bank fired (mostly used by SEXPs)
  int next_secondary_fire_stamp[MAX_SHIP_SECONDARY_BANKS]; // next time this secondary bank can fire
Index: weapon/weapon.h
===================================================================
--- weapon/weapon.h (revision 6461)
+++ weapon/weapon.h (working copy)
@@ -22,10 +22,12 @@
 struct object;
 struct ship_subsys;
 
-#define WP_UNUSED - 1
-#define WP_LASER 0 // PLEASE NOTE that this flag specifies ballistic primaries as well - Goober5000
-#define WP_MISSILE 1
-#define WP_BEAM 2
+#define WP_UNUSED -1
+#define WP_LASER 0 // PLEASE NOTE that this flag specifies ballistic primaries as well - Goober5000
+#define WP_MISSILE 1
+#define WP_BEAM 2
+#define WP_TERTIARY_LASER 3
+#define WP_TERTIARY_MISSILE 4
 extern char *Weapon_subtype_names[];
 extern int Num_weapon_subtypes;
 
@@ -109,7 +111,7 @@
 
 #define WIF_HOMING (WIF_HOMING_HEAT | WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
 #define WIF_LOCKED_HOMING           (WIF_HOMING_ASPECT | WIF_HOMING_JAVELIN)
-#define  WIF_HURTS_BIG_SHIPS (WIF_BOMB | WIF_BEAM | WIF_HUGE | WIF_BIG_ONLY)
+#define WIF_HURTS_BIG_SHIPS (WIF_BOMB | WIF_BEAM | WIF_HUGE | WIF_BIG_ONLY)
 
 #define WEAPON_EXHAUST_DELTA_TIME 75 // Delay in milliseconds between exhaust blobs
 
@@ -468,6 +470,7 @@
  float target_lead_scaler;
  int targeting_priorities[32];
  int num_targeting_priorities;
+
 } weapon_info;
 
 // Data structure to track the active missiles
Index: weapon/weapons.cpp
===================================================================
--- weapon/weapons.cpp (revision 6461)
+++ weapon/weapons.cpp (working copy)
@@ -1107,6 +1107,10 @@
  wip->subtype = WP_LASER;
  } else if(!stricmp("Secondary", fname)) {
  wip->subtype = WP_MISSILE;
+ } else if(!stricmp("Primary Equipment", fname)) {
+ wip->subtype = WP_TERTIARY_LASER;
+ } else if(!stricmp("Secondary Equipment", fname)) {
+ wip->subtype = WP_TERTIARY_MISSILE;
  } else {
  Warning(LOCATION, "Unknown subtype on weapon '%s'", wip->name);
  }
@@ -1189,7 +1193,6 @@
  if ( optional_string("$Submodel Rotation Acceleration:") )
  stuff_float(&wip->weapon_submodel_rotate_accell);
 
-
  // No POF or AVI file specified, render as special laser type.(?)
  ubyte r,g,b;
 
@@ -2563,6 +2566,16 @@
  required_string("#End");
  }
 
+ if(optional_string("#Primary Mount Equipment"))
+ {
+ while (required_string_either("#End", "$Name:"))
+ {
+ if ( parse_weapon(WP_TERTIARY_LASER, Parsing_modular_table) < 0 )
+ {
+ continue;
+ }
+ }
+ }
 
  if(optional_string("#Secondary Weapons"))
  {
@@ -2575,6 +2588,17 @@
  required_string("#End");
  }
 
+ if(optional_string("#Secondary Mount Equipment"))
+ {
+ while (required_string_either("#End", "$Name:"))
+ {
+ if ( parse_weapon(WP_TERTIARY_MISSILE, Parsing_modular_table) < 0 )
+ {
+ continue;
+ }
+ }
+ }
+
  if(optional_string("#Beam Weapons"))
  {
  while (required_string_either("#End", "$Name:")) {
@@ -4710,6 +4734,11 @@
  return -1;
  }
 
+ //If this is an "Equipment" type weapon, we're done here
+ if (weapon_type == WP_TERTIARY_LASER || weapon_type == WP_TERTIARY_MISSILE)
+ return -1;
+
+
  num_deleted = 0;
  if (Num_weapons >= MAX_WEAPONS-5) {

Example tbl using the $Weapon Class hook:
Code: [Select]
#Conditional Hooks

$Weapon Class: Subach HL-7
$On Weapon Equipped:
[
subach = {}
target = {}
subach.obj = hv.User

if subach.obj:isValid() then
subach.ship = mn.getObjectFromSignature(subach.obj:getSignature())
end

target.obj = hv.Target
targetname = nil

if target.obj ~= nil then
if target.obj:isValid() then
target.ship = mn.getObjectFromSignature(target.obj:getSignature())
end

if target.ship ~= nil then
targetname = target.ship.Name
end
end

if targetname == nil then
targetname = "Nothing!"
end

ba.print("Ship " .. subach.ship.Name .. " carries a Subach while targeting " .. targetname .. "\n")
]

$On Weapon Fired:
[
subach = {}
target = {}
subach.obj = hv.User

if subach.obj:isValid() then
subach.ship = mn.getObjectFromSignature(subach.obj:getSignature())
end

target.obj = hv.Target
targetname = nil

if target.obj ~= nil then
if target.obj:isValid() then
target.ship = mn.getObjectFromSignature(target.obj:getSignature())
end

if target.ship ~= nil then
targetname = target.ship.Name
end
end

if targetname == nil then
targetname = "Nothing!"
end

ba.print("Ship " .. subach.ship.Name .. " has fired a Subach while targeting " .. targetname .. "\n")
]

$On Weapon Selected:
[
subach = {}
target = {}
subach.obj = hv.User

if subach.obj:isValid() then
subach.ship = mn.getObjectFromSignature(subach.obj:getSignature())
end

target.obj = hv.Target
targetname = nil

if target.obj ~= nil then
if target.obj:isValid() then
target.ship = mn.getObjectFromSignature(target.obj:getSignature())
end

if target.ship ~= nil then
targetname = target.ship.Name
end
end

if targetname == nil then
targetname = "Nothing!"
end

ba.print("Ship " .. subach.ship.Name .. " has selected a Subach while targeting " .. targetname .. "\n")
]

$On Weapon Deselected:
[
subach = {}
target = {}
subach.obj = hv.User

if subach.obj:isValid() then
subach.ship = mn.getObjectFromSignature(subach.obj:getSignature())
end

target.obj = hv.Target
targetname = nil

if target.obj ~= nil then
if target.obj:isValid() then
target.ship = mn.getObjectFromSignature(target.obj:getSignature())
end

if target.ship ~= nil then
targetname = target.ship.Name
end
end

if targetname == nil then
targetname = "Nothing!"
end

ba.print("Ship " .. subach.ship.Name .. " has not selected a Subach while targeting " .. targetname .. "\n")
]

#End
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Shivan Hunter on September 12, 2010, 07:45:57 am
ooooooooh cool
/me wants to play with this one :D
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Dilmah G on September 12, 2010, 08:12:16 am
This is the part where I wish I still had the time to FRED. At least I'll be able to mess around with whatever the rest of you BP lads have cooked up with this soon enough. ;)
Title: Re: Tertiary Weapons and scripting enhancements
Post by: JGZinv on September 12, 2010, 08:27:59 am
Sounds similar to Tachyon's use of ship cards that added "stuff" to the ships,
although not quite that.

Would it be possible to expand this to create a generic "slot" or pool that is neither
primary nor secondary, but the weapons can be cycled from it into and out of either pri/sec slots?
That right there is essentially what FringeSpace needs for weapon behavior to match tach.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 12, 2010, 08:29:48 am
Well, yes, once this is confirmed as working as planned, adding a true "tertiary" slot is mostly a matter of adding an interface for it. Which is going to be a pain.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: sigtau on September 12, 2010, 09:15:55 am
Not as much of a pain as you think with the HUD overhaul code.  At least, that's what I gather.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: General Battuta on September 12, 2010, 09:16:38 am
Not as much of a pain as you think with the HUD overhaul code.  At least, that's what I gather.

HUD =! loadout screen

Believe me, if anybody's on top of the HUD overhaul it's Mr. The_E.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Mobius on September 12, 2010, 09:34:25 am
Seems interesting, looking forward to it. :yes:
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Sushi on September 12, 2010, 09:39:59 am
Sounds similar to Tachyon's use of ship cards that added "stuff" to the ships,
although not quite that.

Would it be possible to expand this to create a generic "slot" or pool that is neither
primary nor secondary, but the weapons can be cycled from it into and out of either pri/sec slots?
That right there is essentially what FringeSpace needs for weapon behavior to match tach.

Could you just use a secondary slot that won't accept anything other than equipment?
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 12, 2010, 09:46:22 am
Yep.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: JGZinv on September 12, 2010, 01:39:21 pm
The only restriction tach had was that what was already in use, couldn't be used by the
other slot too. Otherwise you could hold down pri or sec change keys... and you got a gatling
gun effect of different weps.

Ship cards were simply separate entities fyi.

Loadout screens are an eventuality too for us.


If you eventually need HUD art perhaps to test such things as above, I may have some stuff already or
can make something up.


Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 12, 2010, 01:47:11 pm
Let us make sure this version works first, OK? We can make other adjustments later, right now the priority would be to find out whether it works at all, and if not, why not.

Also, JGZ, there's no need to put in manual linebreaks when a line reaches the far end of the textbox.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Nuke on September 13, 2010, 12:22:40 pm
well you just saved me a bunch of headaches. i had been trying to think of ways to integrate certain features ive scripted into the loadouts. i had been using a system of proxy weapons, which essentially shoot blanks and drain ammo/energy for you and play sound effects. the script detects if these weapons are fired and then does some function. like fires your turrets or activates a special targeting system. you made integrating such features a million times easier if im reading this right.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 13, 2010, 12:59:24 pm
If/When I get this to work correctly. It doesn't do anything atm, unfortunately.

I hope to get a new build out soon that will hopefully work at least partially.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 13, 2010, 09:54:09 pm
First post updated with new build and example tbl.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Backslash on September 13, 2010, 11:34:13 pm
This Is Huge. :eek2:

I've been wanting to make this sort of thing for the longest time, but feared it was far more than I could chew (and was waiting for the new pilot file code).  So glad to see it started properly.  Will watch progress with considerable interest, and will be glad to help contribute.

The only minor problem with doing it this way, for now at least, is we end up being limited to 3 primaries and 4 secondaries if I'm understanding this right.  If so, hopefully this will provide yet another reason to bump those someday ;)  ...or maybe a new list of #Tertiary Equipment used only by this scripting system.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: ssmit132 on September 14, 2010, 01:08:19 am
This is a very nifty feature. I wouldn't mind having a play with it once it's fully implemented. :)
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Nuke on September 14, 2010, 10:17:17 am
This Is Huge. :eek2:

I've been wanting to make this sort of thing for the longest time, but feared it was far more than I could chew (and was waiting for the new pilot file code).  So glad to see it started properly.  Will watch progress with considerable interest, and will be glad to help contribute.

The only minor problem with doing it this way, for now at least, is we end up being limited to 3 primaries and 4 secondaries if I'm understanding this right.  If so, hopefully this will provide yet another reason to bump those someday ;)  ...or maybe a new list of #Tertiary Equipment used only by this scripting system.

i had always assumed the things which were locking those limits down were the interface and hud related (and some interfaces in fred). still making them actual weapons could clutter up the other weapons. i often hate having 3 primaries, because one is usually a special weapon and should be used only by itself yet make it possible to link the other 2 (sorta makes me think about mechwarrior). its less troublesome to put these as secondary weapons, because you only select one at a time. but even then it would eat up a bank. phreak laid down the ground work for tertiary weapons a long time ago, though never actually made them do anything. would be cool to make this system work with those tertiary weapons. would be cool if they could have some of the features of primary and secondary weapons (uses energy and/or ammo, sound effects, and that kind of stuff. so using them could come at a cost (for example a cloaking device would drain energy weapon energy while switched on). sound effects are useful because its one of the weak points of scripting.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 14, 2010, 10:31:21 am
Yeah, the issue with the limited number of primary and secondary slots is more a matter of interface art.
Of course, since that data is also stored in the model files, we would need to alter the specs on those as well.

Tertiary weapons, on the other hand, can be implemented as a tbl thing only, which would simplify things immensely.

Of course, no matter what we do, there is still a need for new interface art and a new interface screen that would allow the use of tertiary weapons.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Nuke on September 14, 2010, 10:36:36 am
i kinda wanted to see things like turret and countermeasures on the loadout selection. then adding tertiaries to that could get pretty cluttered. having all that stuff in loadout would probibly require redesigning it to accommodate everything.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 14, 2010, 10:50:54 am
These are the changes that would have to be made:

(http://blueplanet.fsmods.net/E/2_WeaponLoadoutb.png)
Title: Re: Tertiary Weapons and scripting enhancements
Post by: JGZinv on September 14, 2010, 03:05:11 pm
So is that a request then for HUD art? I could try then to work with Bax to
get you something to test with....
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 14, 2010, 03:18:23 pm
If you can make a mockup, that would be good. However, be aware that implementing it might take some time.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: JGZinv on September 14, 2010, 04:36:47 pm
Well since FS needs this anyway, I'm killing 2 birds w/one stone.
I figured it'd take quite some time anyway.

Sorta busy with some things, but I'll see what we can do.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: Nuke on September 14, 2010, 07:50:02 pm
while were going through the trouble of redesigning the loadout, is there any way of showing which weapons are compatible with which banks? somewhing like clicking on a weapon in the list will highlight bank slots it is compatible with and grey out ones that cant be used with that weapon, likewise clicking on a bank slol would grey out weapons that are not compatible with that slot.

also i think the whole interface in general needs to be setup to accommodate modern resolutions.
Title: Re: Tertiary Weapons and scripting enhancements
Post by: The E on September 14, 2010, 07:58:22 pm
while were going through the trouble of redesigning the loadout, is there any way of showing which weapons are compatible with which banks? somewhing like clicking on a weapon in the list will highlight bank slots it is compatible with and grey out ones that cant be used with that weapon, likewise clicking on a bank slol would grey out weapons that are not compatible with that slot.

Doesn't it do that already? I'm quite certain it does...

Quote
also i think the whole interface in general needs to be setup to accommodate modern resolutions.

WMCoolmon started, but never finished, something that could be used for this. It just needs a few coders to pick it up again.