UserFunction; SobGroup_ModifiySelected - HWRM/KarosGraveyard GitHub Wiki

SobGroup_ModifySelected()

Description

Aplies modifiers to the players currently selected units based upon a key press. Similar to HW1s unit aggression settings. Used in conjunction with innate subsystems any modifiable value or ability can be modified with a key press ( FunctionSobGroup_IsDoingAbility , ModifiableValues ) since the calculation is triggered and not a timed event it has a much smaller performance impact

Uses the SobGroup_ModifySelected Functions to operate on the ships that a player has currently selected, these must be referenced for the script to work.

Example

in The oninit() or ruleinit() function

UI_BindKeyEvent(F1KEY, "SobGroup_ModifySelected")

Arguments

None right now but could be passed arguments on which modes to set

Future Work
Currently the following ideas are being tested (many of them involve innate subsystems on the target ships that are not attackable and invisible, but provide abilities and modifiers to the parent ships. According to mecha this is more efficient than purely scripting the data since no external storage needs to be used and the subsystem is not being included in the combat model or the render)

F1
A travel mode, ships have increased speed but have poor sensors, are unable to attack(or very reduced damage and accuracy) and show up on enemy sensors more easily, they also cannot use special abilities or docking.

F2
in addition to passive stance this functions as a sensor stealth mode. the SHip will move slower, will be unable to attack (since weapons are powered down) Its sensor signature will be reduced but it will have better sensors itself

F3
In addition to passive stance this functions as a 'hold ground' mode, the ship will move much slower or not move at all and have possibly increased damage and accuracy

F4
This is the normal mode. It seems Relic defaults to this stance with the AI anyway so this mode resets all the other modifiers

F9
Repair mode, the ship cannot move or fire, but benefits from and increased hull and EMP recharge rate

??KEY
Launch all ships from selected ships

??KEY
set selected ships to have all docked ships stay docked

??KEY
Gravwell enable, allows grav wells to be turned on after the enemy is inside the field, trapping them

??KEY
Kamikazie, causes ship to move into the nearest attacker weapons blazing

??KEY
Retreat, selected ships enter travel mode and head towards the nearest mothership

Notes

should be called with UI_BindKeyEvent(), another UIBind function or an AI player script
May not work in Multiplayer games, this has not been tested, a workaround is available, at a performance cost.
If used in conjunction with an external array of current ship values this could be used for many things such as ship crews, experience, ship names etc.

possibly can reimplement kamikazie functionality with this (find the nearest attackers position, move ship to that position and turn off collision avoidance)

Declaration

This example puts the ship into a travel mode that increases speed but turns of the ability to attack, dock and use a HS inhibitor.

function SobGroup_ModifySelected()
  --print("setting mode XXXX")
   

  local playerIndex = Universe_CurrentPlayer()
  --print("current player is"..Universe_CurrentPlayer())
  SobGroup_Create("Selected"..playerIndex)
  SobGroup_Clear("Selected"..playerIndex)
  SobGroup_Create("SelectedTemp")
  SobGroup_Clear("SelectedTemp")

  local Num = SobGroup_SplitGroup("SelectedTemp", "Player_Ships"..playerIndex, SobGroup_Count("Player_Ships"..playerIndex))
  local i=0
  while (i<Num) do   
    if (SobGroup_Selected("SelectedTemp"..i) ==1)then
        SobGroup_SobGroupAdd("Selected"..playerIndex,"SelectedTemp"..i)
        end
        i=i+1
  end

  SobGroup_SetSpeed("Selected"..playerIndex, 2)


  --turn abilities on and off
  SobGroup_AbilityActivate("Selected"..playerIndex, AB_Targeting, 0)


  --use the following to selectivly scale subsystem attributes
  SobGroup_SetHardPointHealth("Selected"..playerIndex, "Hardpoint_Accuracy", 0)
 
  --sets ship specific abilities on and off
  if(SobGroup_CanDoAbility("Selected"..playerIndex, AB_HyperspaceInhibitor)==1) then
        print("disable gravwell")
        SobGroup_AbilityActivate("Selected"..playerIndex, AB_HyperspaceInhibitor, 0)
  end
  if(SobGroup_CanDoAbility("Selected"..playerIndex, AB_AcceptDocking)==1) then
        print("Enable gravwell")
        SobGroup_AbilityActivate("Selected"..playerIndex, AB_AcceptDocking , 0)
  end
  Rule_Remove("SobGroup_ModifySelected")
end

This example makes all selected ships launch their shipholds

function LAUNCHALL_EN()
print("performing LAUNCH ALL")
local playerIndex = Universe_CurrentPlayer()
print("current player is "..Universe_CurrentPlayer())
SobGroup_Create("Selected"..playerIndex)
SobGroup_Clear("Selected"..playerIndex)
SobGroup_Create("SelectedTemp")
SobGroup_Clear("SelectedTemp")

local Num = SobGroup_SplitGroup("SelectedTemp", "Player_Ships"..playerIndex, SobGroup_Count("Player_Ships"..playerIndex))
local i=0
while (i<Num) do   
    if (SobGroup_Selected("SelectedTemp"..i) ==1)then
        SobGroup_SobGroupAdd("Selected"..playerIndex,"SelectedTemp"..i)
        end
        i=i+1
end

SobGroup_SetAutoLaunch("Selected"..playerIndex, ShipHoldLaunch)

Rule_Remove("LAUNCHALL_EN")
end

Authors

  • EvilleJedi

Related Pages

UserFunctionReferenceThis example makes all selected ships launch their shipholds

Comments

According to evillejedi, this function will cause MP games to de-sync.

--Mikali (2006-04-28 03:26:48)

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial