Post tutorial Report RSS Function addAbility

Description Adds an ability to the ship, such as the ability to attack, cloak, or turn on a defense field. Found in ".ship" files. Most abilities can either start out active or inactive. If inactive, the ability can be activated by researching an upgrade or building a subsystem (or by another ship using the addShipAbility function).

Posted by on - Basic Client Side Coding

Abilities

  • MoveCommand

addAbility(, "MoveCommand", , )
Example
addAbility(NewShipType, "MoveCommand", 1, 0)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: can the ship move only a total of one times (e.g., platforms)? (0 = no, 1 = yes)

  • CanDock

addAbility(, "CanDock", , )
Example
addAbility(NewShipType, "CanDock", 1, 0)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: can the player issue this command (otherwise, it can only be triggered via scripting)? (0 = no, 1 = yes)

  • CanLaunch

addAbility(, "CanLaunch")
Example
addAbility(NewShipType, "CanLaunch")
Arguments
No additional arguments.

  • ShipHold

addAbility(, "ShipHold", , , , , )
Example
addAbility(NewShipType, "ShipHold", 1, 40, 10, "rallypoint", "Fighter, Corvette, Utility", 35, {Fighter = "12"}, {Corvette = "75"})
Arguments
: is the ability active by default? (0 = inactive, 1 = active) Note: this determines whether ships can dock and collectors come to this ship for resource dropoff. Also required for autolaunch.
: the number of RUs that can be unloaded here per second. Note: for Hgn_carrier/Vgr_resourcecollector, 40 -> 5 s, 4 -> 50 s.
: the total number of ships that can dock within the shiphold.
: the name of the effect to use for the rally point.
: a comma-separated list of dock families that may stay in the shiphold when docked.
: the number of HP repaired per second (or per turn. dunno).
thru : exceptions that override for the specified dock family.

  • ParadeCommand

addAbility(, "ParadeCommand", )
Example
addAbility(NewShipType, "ParadeCommand", 1)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)

  • WaypointMove

addAbility(, "WaypointMove")
Example
addAbility(NewShipType, "WaypointMove")
Arguments
No additional arguments.

  • CaptureCommand

addAbility(, "CaptureCommand", , )
Example
addAbility(NewShipType, "CaptureCommand", 1, -50)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: offset from target's latch point.

  • SalvageCommand

addAbility(, "SalvageCommand", )
Example
addAbility(NewShipType, "SalvageCommand", 1)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)

  • HyperspaceCommand

addAbility(, "HyperspaceCommand", , , , , , )
Example
addAbility(NewShipType, "HyperSpaceCommand", 0, 1, 600, 1200, 0, 3)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: multiplier for the cost of hyperspace.
: minimum RU cost of hyperspacing.
: maximum RU cost of hyperspacing.
: hyperspace recovery time. Note: this is kind of vague. -Mikail - this denotes time it takes till the ship responds to orders after arrival - Daton
hyperspace transit time. Note: this is kind of vague. -Mikail - this denotes time it takes for the ship to arrive at the destination once it starts moving - Daton

  • CanAttack

addAbility("NewShipType", "CanAttack", , , , , , , , , , ..., )

Example
addAbility(NewShipType, "CanAttack", 1, 1, 0, 0, 0.35, 1.5, "Fighter, Corvette, Frigate, Utility, SmallCapitalShip, BigCapitalShip", "Frontal", {Fighter = "MoveToTargetAndShoot"}, {Corvette = "MoveToTargetAndShoot"}, {Munition = "MoveToTargetAndShoot"}, {SubSystem = "FrontalVsSubSystem"})

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the number of ships in micro formations that ships form in combat (a value of 2 would cause the fighters to break in pairs).
: can the ship use kamikaze tactics? Note: evillejedi's hotkey functions enable the player to use this in game, see this thread<!-- url png image was here --> : can the ship interpolate targets?
: the delay between formation splitting (in seconds).
: the distance multiplier from target before attack styles get control.
: a comma-separated list of attack families, in order of highest to lowest attack priority.
: the default method (style) that the ship will use to engage all targets.
thru : exceptions that override for the specified family.

  • GuardCommand

addAbility(, "GuardCommand", , , )
Example
addAbility(NewShipType, "GuardCommand", 1, 3000, 1000)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the radius from the guarded ship within which an enemy ship fall for the guarding ship to pursue it.
: the distance from the guarded ship that the guarding ship will hover.

  • Harvest

addAbility(, "Harvest", , , , )
Example
addAbility(NewShipType, "Harvest", 1, 300, 4, 8)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the ship can carry this many RUs before having to go unload.
: the collector can harvest this many RUs per second.
: the distance from the resource object that the ship will hover while harvesting.

  • CanBuildShips

addAbility(, "CanBuildShips", , , )
Example
addAbility(NewShipType, "CanBuildShips", 1, "Fighter_Vgr, Corvette_Vgr, Utility_Vgr, Frigate_Vgr, SubSystem_Vgr, Platform_Vgr, Shipyard_Vgr, Probe_Vgr", "Utility, Fighter, Corvette, Frigate, Platform, SubSystemModule, SubSystemSensors, Capital")
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: a comma-separated list of build families that the ship can build.
: a comma-separated list of display families that the ship can build.

  • FormHyperspaceGateCommand

addAbility(, "FormHyperspaceGateCommand", , , , , )

Example
addAbility(NewShipType, "FormHyperspaceGateCommand", 1, 1000, 500, 1000, 0)

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the radius from the gate that ships will enter.
: the radius from the gate that ships will exit.
: the cost to link two gates.
: the cost to jump, per squadron.

  • HyperspaceViaGateCommand

addAbility(, "FormHyperspaceGateCommand", , , , )

Example
addAbility(NewShipType, "HyperspaceViaGateCommand", 1, 3, 1, 0.3)

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: hyperspace transit time.
: multiplier for the cost of using a gate. Multiply this by the gate's cost to work out how much using a gate costs.
: damage due to gate destruction. Multiply this by the max health to ge the damage taken if we are in hyperspace and the gate blows up.

  • CanBeCaptured

addAbility(, "CanBeCaptured", , )
Example
addAbility(NewShipType, "CanBeCaptured", 160, 0.1)
Arguments
: the amount of time it takes for the ship to be captured.
: the ship is slowed by this factor when being captured.

  • CanBeSalvaged

addAbility(, "CanBeSalvaged")
Example
Note: Function used in single player mission to salvage offline Mover. See file kpr_mover_salvage.ship for example. Also note that dock family is set to large salvage. not sure if that makes a difference to functionality though. -nyram
Arguments
No additional arguments.

  • SensorPing

addAbility(, "SensorPing", , , , )
Example
addAbility(NewShipType, "SensorPing", 0, 1, 10, 2.5)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: Set this to true if sensor-ping extends the ship's primary sensor range to infinity. Set this to false if the primary sensor range is only extended to the secondary sensor range.
: the amount of time the ping lasts (in seconds).
: the anti-cloak detection strength.

  • CanBeRepaired

addAbility(, "CanBeRepaired")
Example
addAbility(NewShipType, "CanBeRepaired")
Arguments
No additional arguments.

  • RepairCommand

addAbility(, "RepairCommand", , , , , ..., )
Example
addAbility(NewShipType, "RepairCommand", 0, 500, 9, {SuperCap = "18",}, {Flagship = "18",})
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the ship will remain this far from the target when not repairing.
: number of HP restored per turn (1 turn = 0.1 seconds).
thru : overrides for the named dock family.

  • CloakAbility

addAbility(, "CloakAbility", , , , , , , , )
Example
addAbility(NewShipType, "CloakAbility", 1, 2, 2000, 0, 1, 100, 0.6, 200)

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: value of cloaking. note: this is kind of vague. -Mikail In tuning.xls, they say it is assessed against the enemy sensor detection strength to determine if the ship is detected -SunTzu
: the radius within which other ships will also be cloaked.
: if the remaining energy is this much or lower, the ship will decloak.
: amount of energy used per second while cloaked.
: amount of energy used to initiate cloak.
: amount of energy recharged per second.
: minimum amount of energy required for the ship to cloak.

  • SpecialAttack

addAbility(, "SpecialAttack", , )
Example
addAbility(NewShipType, "SpecialAttack", 0, "EMP")

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the name of the special attack.

  • RetireAbility

addAbility(, "RetireAbility", , )
Example
addAbility(NewShipType, "RetireAbility", 1, 1)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: is the ability disabled when in the possession of a player of another race? (0 = no, 1 = yes)

  • MinelayerAbility

addAbility(, "MinelayerAbility", , )
Example
addAbility(NewShipType, "MinelayerAbility", 1, 3.5)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the amount of time required to lay a mine (in seconds).
Note: this ability must be enable if you want the ship able to shoot attackable missile

  • DefenseFieldAbility

addAbility(, "DefenseFieldAbility", , , , , , , , , )
Example
addAbility(NewShipType, "DefenseFieldAbility", 1, 0, 1200, 200, 200, 1, 0.6, 0, "defensefield_sphere_spray")

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: is the defense field turned on by default? (0 = field begins off, 1 = field begins on)
: the radius within which other ships will be defended.
: amount of energy.
: if the remaining energy is <=[maximum - this] , you can disengage manually the ability.
: amount of energy used per second (if set to 1, it uses 10 per second).
: amount of energy recharged per second when ability is off.(if set to 1 it recharges 10 per second)
: if the remaining energy is >=[maximum - this] , you can engage the ability.
: the name of the effect that determines the appearance of the field.

  • DefenseFieldShieldAbility

addAbility(, "DefenseFieldShieldAbility", , , , )
Example
addAbility(NewShipType, "DefenseFieldShieldAbility", 0, 1200, 0, 0)

Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the radius within which other ships are protected (should be the same as the of the defense field ability.
: the amount of damage the ship receives fron dust clouds is factored by this amount.
: the amount of damage the ship receives from nebulae is factored by this amount.

  • HyperspaceInhibitorAbility

addAbility(, "HyperspaceInhibitorAbility", , )
Example
addAbility(NewShipType, "HyperspaceInhibitorAbility", 0, 12000)
Arguments
: is the ability active by default? (0 = inactive, 1 = active)
: the radius within which other ships are affected by the ability.

| Sources Here: Hw2wiki.net |

Post comment Comments
Robots!
Robots! - - 1,751 comments

theres a tool for modding homeworld 2.

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: