Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: MastaRyan on February 20, 2010, 10:05:03 am

Title: Weapon Ranges
Post by: MastaRyan on February 20, 2010, 10:05:03 am
OK, so I made a new ballistic weapon called the Vulcan, (In this case "made" means made a table entry and then stole the effect from the Procyon insurgency. I'm going to need to ask permission to use it.) And I want it to have a range of 1800 meters. But, currently it can hit an Aten from 2400 metres out. How do I make it have a range of 1800 meters? (I know it has to do with a combination of life and velocity, i just don't have a formula for figuring this out.

Table Entry:
Code: [Select]
; ----------------------------------------------------------------------------------
; Vulcan
;
$Name:                                  Vulcan
+Title:                                 XSTR("GTW-84 Vulcan", -1)
+Description:
XSTR(
"Ballistic Weapon
Level 2 Hull Damage
Level 1 Shield Damage
Power Use 1W Very High ROF 2.5/s", -1)
$end_multi_text
+Tech Title:    XSTR("GTW-84 Vulcan", -1)
+Tech Anim:                     Tech_GTW_ML-70
+Tech Description:
XSTR(
"GTW-84 Vulcan description: write me!", -1)
$end_multi_text
$Model File: none
@Laser Bitmap: newglo10
@Laser Glow: 2_laserglow03
@Laser Color: 125, 125, 125
@Laser Color2: 10, 10, 10
@Laser Length: 10.0
@Laser Head Radius: 0.2
@Laser Tail Radius: 0.2
$Mass: 0.2
$Velocity: 2500.0 ;; speed of the weapon (initially) -- may or may not

change
$Fire Wait: 0.1 ;; in seconds
$Damage: 9
$Armor Factor: 1.2
$Shield Factor: 0.5
$Subsystem Factor: 0.6
$Lifetime: 2.0 ;; How long this thing lives
$Energy Consumed: 0.10 ;; Energy used when fired
$Cargo Size: 0.01 ;; Amount of space taken up in weapon cargo
$Homing: NO
$LaunchSnd: 163 ;; The sound it makes when fired
$ImpactSnd:                                                             162 ;; The sound it makes when it hits something
$Rearm Rate: 12.0
$Flags: ("in tech database" "player allowed" "stream" "ballistic")
$Trail:
    +Start Width:0.2
    +End Width:0.2
    +Start Alpha:0.8
    +End Alpha: 0.0
    +Max Life: 0.25
    +Bitmap: newmiss6  
$Icon: iconflail
$Anim: flail2
$Impact Explosion: none
(I know there's no Vulcan D: I only need one Vulcan.)
Title: Re: Weapon Ranges
Post by: Herra Tohtori on February 20, 2010, 10:09:28 am
Distance = Lifetime * Velocity

+Weapon Range is the distance where AI starts using the weapon.

EDIT: ...and you don't seem to be using that either. If you have 2500 m/s as velocity and 2 seconds of life time, what did you expect the range to be? :p
Title: Re: Weapon Ranges
Post by: starwolf1991 on February 20, 2010, 10:12:02 am
There are two things you can do to specify the range of a weapon.

First, take a look at the lifetime of your weapon and its velocity. Usually, the range is determined by how long it lasts and its velocity. For example, a weapon that last 2.5 seconds and has a velocity of 600 could cover a total of 1500.

Second, check the weapon range section of the weapon data. It'll usually tell you how far a weapon can go, regardles of velocity or lifetime. Take the above and say your maximum range is 1200. If your lifetime or velocity goes higher, it'll go up to 1200. Go below this and it'll be back to the top again.

Took me a while to figure out back when I began restoring Cerberus. You'll get the hang of it.

Title: Re: Weapon Ranges
Post by: The E on February 20, 2010, 10:13:48 am
There are two things you can do to specify the range of a weapon.

First, take a look at the lifetime of your weapon and its velocity. Usually, the range is determined by how long it lasts and its velocity. For example, a weapon that last 2.5 seconds and has a velocity of 600 could cover a total of 1500.

Second, check the weapon range section of the weapon data. It'll usually tell you how far a weapon can go, regardles of velocity or lifetime. Take the above and say your maximum range is 1200. If your lifetime or velocity goes higher, it'll go up to 1200. Go below this and it'll be back to the top again.

Took me a while to figure out back when I began restoring Cerberus. You'll get the hang of it.

Sorry to say this, but as Herra pointed out, $Range: is only significant for the AI.
Title: Re: Weapon Ranges
Post by: Wanderer on February 20, 2010, 10:19:27 am
Well.. if the weapon requires a lock on then  range is important for the player as well.

And the weapon range thing is only used if it is smaller than the velocity x lifetime
Title: Re: Weapon Ranges
Post by: Herra Tohtori on February 20, 2010, 10:24:08 am
Reading the wiki (http://www.hard-light.net/wiki/index.php/Weapons.tbl#.2BWeapon_Range:) tends to help you on the way of modding.

And I misremembered the entry name, it's +Weapon Range instead of $Range, but anyway.
Title: Re: Weapon Ranges
Post by: MastaRyan on February 20, 2010, 10:38:28 am
Thanks, it works fine now.
Title: Re: Weapon Ranges
Post by: Spoon on February 20, 2010, 11:08:39 am
Setting a weapon range for a player primary will determine the range the lead indicator appears on the hud.
While I don't really see the point of it, you could in theory set the lead indicator to appear at a range of 2000 while the actual effective range of the weapon is 3000
Title: Re: Weapon Ranges
Post by: SpardaSon21 on February 20, 2010, 11:11:11 am
You could use it as a gameplay element by saying 2km is the maximum range targeting computers can generate a profile for the targeted craft.