Karos Graveyard ::
Function Reference :: Scope Reference :: Variable Reference
AddWeaponResult(<rWeapon>, <sCondition>, <sEffect>, <sTarget>, <fMinimumEffect>, <fMaximumEffect>, <sSpawnedWeaponEffect>)

Description
This function is called in a ".wepn" file, and is used to define the effect that will occur when a weapon hits or misses its target. The most common usage is to cause damage to the target, although this function can also be used to disable the target as per the scout's EMP burst, or to push or pull the target closer to or away from the attacker. You may call AddWeaponResult multiple times in one weapon, with each calling being used to add a different effect.

Example
AddWeaponResult(NewWeaponType, "Hit", "SpawnWeaponFire", "Target", 0, 0, "Hgn_BurstCannonBurst")

Arguments
  1. <rWeapon>: Reference to the weapon variable. Generally, this will be NewWeaponType.
  2. <sCondition>: Condition upon which the specified effect will occur. Possible values are "Hit" and "Miss". If set to "Hit", the effect occurs if the weapon hits the target. If set to "Miss", the effect occurs if the weapon misses the target.
  3. <sEffect>: Effect to apply to the target if the specified condition is met. Possible values are "DamageHealth", "Disable", "Push", "SpawnWeaponFire". "DamageHealth" reduces the target's health by a randomly determined value between the fMinimumEffect and fMaximumEffect arguments. "Disable" reduces the target's EMP shields a random amount based on the value of the fMinimumEffect and fMaximumEffect arguments. If the shields are reduced to 0, the ship becomes disabled. "Push" moves the target toward or away from the attacker a random amount based on the value of the fMinimumEffect and fMaximumEffect arguments. Positive numbers push targets away, while negative numbers pull them closer. The actual amount the target is moved depends on the target's mass. If the weapon also has "SpawnWeaponFire" defined, "Push" only has an effect if defined in the spawning weapon, not the weapon that is spawned. "SpawnWeaponFire" causes the specified <sSpawnedWeaponEffect> to be created. This is used to create weapons with a blast radius (e.g., flak frigate guns and the scout's EMP) and other special effects.
  4. <sTarget>: The recipient of the specified Effect. "Target" seems to be the only possible value. It looks that "Owner" is possible too, self-damaging the ship or subsystem where the weapon is mounted. --SunTzu
  5. <fMinimumEffect>: The minimum power of the specified Effect, such as minimum damage. Set this to 0 if sSpawnedWeaponEffect is set.
  6. <fMaximumEffect>: The maximum power of the specified Effect, such as maximum damage. Set this to 0 if sSpawnedWeaponEffect is set.
  7. <sSpawnedWeaponEffect>: This is a weapon effect that is spawned if <sEffect> equals "SpawnWeaponFire" and the Condition is met. Generally, the name of another weapon is input here, most notably those that create areas of effect (e.g., "hgn_smallempburst" and "hgn_burstcannonburst").

Related Pages:
 Comments [Hide comments/form]
Added description of function.
Added link to StartShipWeaponConfig.
-- RangerHW (2003-10-13 11:36:58)
1. Can "sTarget" be the ship itself too?
2. Exactly how many meters does Push move a ship after taking ship-mass into account?
-- PaulTWang (2004-10-26 19:27:50)
:: ::
Max height: 26 of 26
Hide Download Bar
Ctrl + Shift + Z = Show/Hide Download Bar
Downloads
Download Manager (S3)
Clear
Left Click: Clear All Finished
Right Click: Undo last clear
100%
Download History
Download list is empty
FunctionAddShipAbility.html
100%
--:--
498 KB
-.--
FunctionAddShipAbility.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionAddShipAbility.html
Status:
498 KB / 498 KB ( -.-- )
File Size:
498 KB
Virus scan:
Time Start:
2019.08.20 - 18:27:44
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
477 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionAddShipMultiplier.html
100%
--:--
509 KB
-.--
FunctionAddShipMultiplier.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionAddShipMultiplier.html
Status:
509 KB / 509 KB ( -.-- )
File Size:
509 KB
Virus scan:
Time Start:
2019.08.20 - 18:28:45
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
521 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionaddSquadron.html
100%
00:00
514 KB
2.59 MB/s
FunctionaddSquadron.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionaddSquadron.html
Status:
514 KB / 514 KB ( 2.59 MB/s )
File Size:
514 KB
Virus scan:
Time Start:
2019.08.20 - 18:29:36
Time to Complete:
<00:01
Time Left:
00:00
Percent Done:
100%
Average Speed:
2.59 MB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionAddSubSystemAbility.html
100%
--:--
522 KB
-.--
FunctionAddSubSystemAbility.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionAddSubSystemAbility.html
Status:
522 KB / 522 KB ( -.-- )
File Size:
522 KB
Virus scan:
Time Start:
2019.08.20 - 18:30:24
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
509 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop
FunctionaddToSOBGroup.html
100%
--:--
530 KB
-.--
FunctionaddToSOBGroup.html
Source:
From:
To:
G:\HWRMResources\tutorials\hw2wiki.net\Functions_StandAlone\FunctionaddToSOBGroup.html
Status:
530 KB / 530 KB ( -.-- )
File Size:
530 KB
Virus scan:
Time Start:
2019.08.20 - 18:32:28
Time to Complete:
00:01
Time Left:
--:--
Percent Done:
100%
Average Speed:
491 KB/s
mouse double click: download pause/resume
mouse middle click: download cancel
mouse double click: open file
mouse double click + Ctrl: open dir
mouse middle click: delete from list
mouse middle click + Ctrl: delete from system
press mouse button + Ctrl: drag & drop