[General Tutorials] Coding Custom Weapons
-
@Lancer:
The HpBayDoor stuff is used when ejecting cargo. As I discovered recently these 2 HPs can’t be the same HP or in the same position or you run the risk of a crash when jettisoning cargo.
…yes - the cargo is thrown out via HpBayDoor01 -> HpBayDoor02.
You will usually find
–--------------
…
HP_bay_surface = HpBayDoor01
HP_bay_external = HpBayDoor02
…in your shiparch.ini.
So your models should have a HpBayDoor01 on the surface of the model and HpBayDoor02 a bit outside in the space.
Otherwise you will have crashes, when jettison cargo.And a additional note about (ship!) hardpoints:
Usually you can name you HP in the model, what you like.
You just have to define in the shiparch, what you want to use the HP for.
So 4 example someone might want to use the HpCM01 to mount an additional minedropper oder a turret. -
@F!R:
Otherwise you will have crashes, when jettison cargo.
90% of the models we have would CTD a mod every time if that was true, it does throw up internal errors, but FL will jettison things from either the HpMount or 0,0,0 of the model if it can’t find a baydoor hardpoint.
-
…… you r right (tested atm) - missing HPBayDoor doesn’t crash client or server,
even with HpBayDoor entries in the shiparch. -
It is true that you don’t have to have the HpBayDoor hardpoints, alot of my ships don’t have it either. But if you do have them and the are either the same point or occupy the same position, it will crash everytime. I can’t speak for other MODs but that is exactly what happens in mine. I move them to separate positions and the crashing stops.
-
toughness is responsible for NPCs. It tells them how powerful your equipment is. If it is too powerful, NPCs will retreat.
Freelancer default calculation:
toughness = hull_damage / 100 / ( 1 * refire_delay) -
Returning to the fine arts of Milkshape and all things mod. Created and collected textures. Watched a few tutorials to get a better grip on extruding. Time for a line-up worth sharing for sake of future feedback. It’s ineffable to be at Starport.
-
Meaning what?
-
_There is a lot of good info in the first post by Roo Avery so I decided to clean it up to make it a bit more readable, despite its age and subsequent findings.
I didn’t check all the content for errors but just corrected the ones which were evident as I reformatted it.
Here it is:_
Files you will need
All are in the DATA\EQUIPMENT directory of Freelancer:-
weapon_equip.ini - all specifications of weapons
weapon_good.ini - here you make the guns available for sale
market_misc.ini - location of guns/stuff being soldA bit of theory:
All guns and ammo types are specified in weapon_equip.ini.Sections are:
[Motor] - this is the “engine” of the missile
[Explosion] - this specifies if your gun has area effect. Only works if you also have a [Motor] section.
[Munition] - this is the actual shot of your gun, damage values, ranges… are all defined here
[Mine] - use this instead of [Munition] for Mines
[Gun] - this is the gun/launcher mounted on your ship
[MineDropper] - use this instead of [Gun] for mines
[LOD] - defines LevelOfDetail ranges for bigger gun models[Munition] and [Gun] are required, the others are optional.
You can make a missile without an explosion, a gun with an explosion…
I’m not sure if you can change the order how they are defined, I would always keep it as they were.
A simple weapon only needs the [Munition] and [Gun] sections.This example is based on the energy missiles I made. I added an explosion effect to make this tutorial as complete as possible. Below that you can also find a Mine example.
Weapon_Equip.ini
Explanation of all entries:
[Motor]
Optional, specifies if your weapon will have some form of “engine”.nickname=energy_missile01_motor
lifetime=3.000000
accel=200.0000
delay=0nickname
Reference for [Munition]. Pick a name of your choice that fits to the general scheme <gunname>_motor.lifetime
Time in seconds where the engine will be active.accel
Acceleration provided by the engine (not the gun).
I think this is a meter/sec^2 value.delay
Time in seconds after launch where the engine will activate.[Explosion]
Optional, specifies if the impact of the projectile is followed by an explosion.nickname=energy_missile01_explosion
effect=gf_piratestationexplode
lifetime=0.000000, 0.000000
process=disappear
strength=100
radius=50
hull_damage=100.000000
energy_damage=20.00
impulse=0nickname
Reference for [Explosion]. Pick a name of your choice that fits to the general scheme <gunname>_explosion.effect
Visual effect of the explosion. You can basically use every impact/explosion effect in the game. Example: battleship explosions for guns-impacts.lifetime
Two values, both in seconds - min max duration of explosion FX.process
??? always has ‘disappear’ as a value. I guess this is the effect after the explosion, i.e. it vanishes after blowing upstrength
???radius
Area effect of damage values in meters.hull_damage
The explosion damage. This also adds shield damage, according to the [ShieldEquipConsts] HULL_DAMAGE_FACTOR=0.500000 entries in constants.ini.energy_damage
Extra shield damage. Can have a negative value to make hull-only damaging weapons.
The total shield damage is calculated by:
total emp damage=energy_damage + HULL_FACTOR_DAMAGE * hull_damageSee constants.ini for the entry.
impulse
Kinetic effect on the target. Depends also on target’s mass.
?
Required. This will specify the projectile of your weapon.[Munition]
Optional - Ammunition definition if usednickname=energy_missile01_ammo
explosion_arch=energy_missile01_explosion
loot_appearance=ammo_crate
units_per_container=10
hp_type=hp_gun
requires_ammo=false
hit_pts=2 hull_damage=400
energy_damage=200
weapon_type=W_Photon01
one_shot_sound=fire_plasma2
detonation_dist=2.00000
munition_hit_effect=li_missile01_impact
lifetime=3.0000
Motor=energy_missile01_motor
force_gun_ori=false
const_effect=li_missile01_drive
HP_trail_parent=HPExhaust
seeker=LOCK
time_to_lock=0
seeker_range=2000
seeker_fov_deg=35
max_angular_velocity=5.000000
cruise_disruptor=true
ids_name=459791
ids_info=459721
mass=1
volume=0.000000nickname
Reference for [Munition]. Pick a name of your choice that fits to the general scheme <gunname>_ammo.explosion_arch
Optional. Reference from [Explosion]loot_appearance
Specifies how ‘dropped ammo’ will look like.units_per_container
Number of ammo units in a container.hp_type
Use hp_gun for guns & missiles, hp_torpedo for torpedoes.requires_ammo
true/false - Specifies if the Gun uses ammo or not.hit_pts
Damage required to shoot down the projectile. Only important for missiles and torpedoes.hull_damage
The damage caused on impact. Same calculations for emp damage as in [Explosion]energy_damage
Extra shield damage. Can have a negative value to make hull-only damaging weapons. same calculations for emp damage as in [Explosion]weapon_type
Type of the weapon to create different affectivity against the shield types. See list below.detonation_dist
Only important if the Weapon has an [Explosion]. At this distance (in meters) to the target the projectile will blow up.munition_hit_effect
The visual effect of the projectile impact. See list below.lifetime
The lifetime of the projectile in seconds. This combined with the speed will specify the range of the gun.motor
Optional. Reference from [Motor]force_gun_ori
true/false Specifies if the launcher is swivel or not.const_effect
Visual look of the projectile. See list below.HP_trail_parent
??? is always HPExhaustseeker
Optional, only for seekers. Set to ‘LOCK’ if you want to make a homing projectile. “DUMB” for nonseeking weapons.time_to_lock
Optional, only for seekers. Changes have no effect here.seeker_range
Optional, only for seekers. Within this range, the projectile will home in.seeker_fov_deg
Optional, only for seekers. Field of view of the seeker where it will lock in degree.max_angular_velocity
Optional, only for seekers. This is the “agility” of the projectile.cruise_disruptor
Optional. The projectile will disrupt cruise engines on impact.ids_name
ID referenceids_info
infocard referencemass
Mass of the projectile. You can increase this to have a kinetic effect on impact.volume
Amount of cargo space the ammo will use in the cargo hold per unit.[Gun]
This is the launcher/gun itself.Gun nickname=energy_missile01
ids_name=459789
ids_info=459790
DA_archetype=equipment\models\weapons\li_rad_launcher.cmp
material_library=equipment\models\li_equip.mat
HP_child=HPConnect
hit_pts=400
explosion_resistance=1.000000
debris_type=debris_normal
parent_impulse=20
child_impulse=80
volume=0.000000
mass=10
hp_gun_type=hp_gun_special_7
damage_per_fire=0
power_usage=200
refire_delay=1.000
muzzle_velocity=300.000000
toughness=2.400000
flash_particle_name=ci_capgun_01_flash
flash_radius=15
light_anim=l_gun01_flash
projectile_archetype=energy_missile01_ammo
dry_fire_sound=fire_dry
separation_explosion=sever_debris
auto_turret=false
turn_rate=90
lootable=true
LODranges=0,20,60,100nickname
Reference for market_misc.ini. Pick a name of your choice that fits to the general scheme <gunname>.ids_name
ID referenceids_info
infocard referenceDA_archetype
Visual look of the launcher/gun. See list below.material_library
Skin for the launcher/gun. You have to take one that fits to the DA_archetype you chose.HP_child
??? all guns have HPConnect here.hit_pts
The damage the gun can take until it is destroyed.explosion_resistance
Value 0-1. Explosion damage reduction. 1 means complete immunity, all built in guns have 1.debris_type
??? all guns have debris_normal here. Guess this is the remaining debris when the gun was destroyed.parent_impulse
???child_impulse
???volume
Amount of cargo space the gun will need.mass
Mass of the gun. This will be added to the total mass of the ship. Units are unknown.hp_gun_type
This specifies the mount-type and/or level of the gun. See list below.damage_per_fire
??? Probably damage to the gun itself per shot. Didn’t work at first tests.power_usage
Energy used per shot.refire_delay
Delay between two shots in seconds.muzzle_velocity
Speed of the projectile at launch. A [Motor] can change the speed after launch.toughness
???flash_particle_name
The flash effect at firing the gun (can be deleted if not used), a list will be added later as this is not that important. Until then, look up the effect of your favourite gun.flash_radius
Flash radius in meters.light_anim
Flash animation.projectile_archetype
Reference to the [Munition] that the gun will use.dry_fire_sound
Sound the gun makes when it is fired but it cant fire (on cruise, in lanes)separation_explosion
Explosion when destroyed.auto_turret
Turrets have all true. Seems to be a part of a not-finished autoturret function. NPCs will use this as an autoturret if set to true.turn_rate
The turn-speed of the launcher/gun in degree/second.lootable
Is the launcher/gun lootable? true/falseLODranges
Level of detail entries for the launcher. Use the same values as a gun with the same DA_archetype.Very similar to [Munition] / [Gun]. Most have an [Explosion] section ahead, it’s the same as for guns, so i leave that away here. I will only comment the things here that are different to [Munition] or [Gun]
[Mine]
Almost the same as [Munition]Mine
nickname=mine01_mark01_ammo
explosion_arch=mine01_mark01_explosion
loot_appearance=ammo_crate
units_per_container=10
requires_ammo=true
hit_pts=2
one_shot_sound=fire_mine_regular
detonation_dist=4
lifetime=10
force_gun_ori=true
DA_archetype=equipment\models\mines\r_plasma_mine.3db
material_library=equipment\models\r_equip.mat
ids_name=265165
ids_info=266165
mass=0.100000
volume=0.000000
owner_safe_time=4
linear_drag=0.400000
seek_dist=400
top_speed=60
acceleration=200
const_effect=li_mine01owner_safe_time
The time in seconds where the owner can’t trigger the mine.linear_drag
This is the ‘agility’ of the mine.seek_dist
The distance in meters where the mine will start to move.top_speed
The top-speed of the mine. This is independent from the ships’s speed. (‘normal’ projectile speeds are added to the current moving speed of the firing ship)acceleration
Acceleration of the mine in meters/secs^2 until it reaches top_speed.[Minedropper]
Almost the same as [Gun]MineDropper
nickname=mine01_mark01
ids_name=263165
ids_info=264165
DA_archetype=equipment\models\weapons\li_cm_dropper01.cmp
material_library=equipment\models\li_equip.mat
HP_child=HPConnect
hit_pts=400
explosion_resistance=1.000000
debris_type=debris_normal
parent_impulse=20
child_impulse=80
volume=0.000000
mass=10
damage_per_fire=0
power_usage=0
refire_delay=1
muzzle_velocity=20
toughness=3.300000
projectile_archetype=mine01_mark01_ammo
dry_fire_sound=fire_dry
separation_explosion=sever_debris
lootable=true
LODranges=0,20,60,100Difference to a normal gun:
no ‘hp_gun_type=’ entry
The hardpoint type is hardcoded in the section name, so FL knows that it is mounted on Minedropper hardpoints by the [Mine] section itself.Now the hard work is finished. To the easy part:
weapon_good.ini[Good]
The gun as an item on the market.Good
nickname=energy_missile01
equipment=energy_missile01
category=equipment
price=400000
item_icon=equipment\models\commodities\n_icons\EQUIPICON_torplauncher.3db
combinable=false
free_ammo=energy_missile01_ammo, 10
ids_name=459789
ids_info=459790
shop_archetype=equipment\models\weapons\li_rad_launcher.cmp
material_library=equipment\models\ge_equip.matnickname
Name reference to market_misc.ini.equipment
Weapon-nickname from weapon_equip.ini.category
Location where it is sold: ‘equipment’ is equipment dealer, ‘commodity’ is the market.price
Price of the gun. Note that the price of the ammo specified in free_ammo will be added to this.item_icon
The icon of the weapon in the shop.combinable
Stackable or not? true/falsefree_ammo
Amount of ammo that comes with the launcher when you buy it.ids_name
ID-referenceids_info
Infocard referenceshop_archetype
Model of the launcher.material_library
Skin of the launcher.; energy_missile ammo (only needed if ‘requires_ammo=true’ in [Munition)
[Good]
The ammo on the market.nickname=energy_missile01_ammo
equipment=energy_missile01_ammo
shop_archetype=equipment\models\weapons\li_rad_missile.3db
material_library=equipment\models\li_equip.mat
category=equipment
price=1000.00
item_icon=equipment\models\commodities\n_iconsEQUIPICON_missiles.3db
combinable=trueIt is getting easier and easier, now we just have to add it to a base that should sell the stuff.
market_misc.ini
Look up your favourite base, take Ca01_01_base for Ottawa.
Add following lines under the listed items:MarketGood=energy_missile01, 0, -1, 10, 10, 0, 1
MarketGood=energy_missile01_ammo, 0, -1, 50, 50, 0, 1To the format:
MarketGood=<package>,<min. player=“” level=“”>, <min. reputation=“”>, < unknown >, < unknown >, <0=sell item>, <price multiplier=“”>To the < unknown >
Set these to 10 if it is a gun, 50 if it’s ammo. I guess this specifies where at the equipment dealer it is sold (Weapons, ammo, equipment…)Now activate your mod, start a FLserver, start FL, join your server and enjoy!!!
- Very useful lists of variable values -
A note to the format: <1-4> means enter a value here, in this case 1 to 4, i.e.: fire_photon1 is a valid entry for fire_photon<1-5>, while fire_photon6 is not.
[Munition]
‘one_shot_sound=’
This is the soundeffect used if you pull the triggerfire_missile_regular
fire_missile_homing
fire_missile_emp
fire_cruise_disruptor
fire_torpedo
fire_mine_regular
fire_mine_tracking
fire_photon<1-5>
fire_laser<1-5>
fire_tachyon<2-5> (1 is never used)
fire_particle<1-5>
fire_neutron<2-5> (1 isnever used)
fire_pulse<1-5>
fire_plasma<1-5>
fire_capship
fire_capship_forward_gun
fire_no1
fire_no_cruise_disruptor
fire_no_torpedo
fire_no_capship
[Munition]
‘munition_hit_effect=’
This is the effect of the impact.
These all can also be used in the [Explosion section in the ‘effect=’ entry.Pirates:
pi_photon_<01-04>impact
pi_laser<01-04>impact
pi_tachyon<01-04>impact
pi_particle<01-04>impact
pi_neutron<01-04>impact
pi_pulse<01-03>impact
pi_plasma<01-03>_impact
pi_capgun_01_impactLiberty:
li_laser_<01-04>impact
li_plasma<01-04>_impact
li_capgun_01_impactBretonia:
br_tachyon_<01-04>impact
br_particle<01-03>_impact
br_capgun_01_impactKusari:
ku_neutron_<01-04>impact
ku_photon<01-04>impact
ku_capgun_01_impact
Rheinland:
rh_tachyon<01-04>impact
rh_plasma<01-04>_impact
rh_capgun_01_impactCivilian:
ci_laser_<01-03>impact
ci_pulse<01-04>impact
ci_photon<01-04>impact
ci_tachyon<01-04>_impact
ci_capgun_01_impactNomad:
rtc_nomadtorpedo_impact
no_capgun01_impact
no_gun01_rank01_impactcodenames:
sp_annihilator_<01-03>impact
sp_bloodhound<01-03>impact
sp_destabilizer<01-03>impact
sp_distortion<01-03>impact
sp_doomsday<01-03>_impact
[Munition]
‘const_effect=’
This is the “look” of the projectile, mostly you will only notice this one in a firefight.Liberty:
li_laser_<01-04>proj
li_plasma<01-04>_proj
li_missile<01-02>_drive
li_empmissile_drive
li_cruisedis01_drive
li_torpedo01_drive
li_mine<01-02>
li_capgun_01_proj
li_cruiser_maingun
li_flakcannon01_projBretonia:
br_tachyon_<01-04>proj
br_particle<01-04>_proj
br_missile<01-02>_drive
br_empmissile_drive
br_mine<01-02>
br_gunboat_maingun
br_capgun_01_proj
br_flakcannon01_projKusari:
ku_neutron_<01-04>proj
ku_photon<01-04>_proj
ku_missile<01-02>_drive
ku_empmissile_drive
ku_cruisedis01_drive
ku_torpedo01_drive
ku_mine<01-02>
ku_gunboat_maingun
ku_capgun_01_proj
ku_flakcannon01_projRheinland:
rh_tachyon_<01-04>proj
rh_plasma<01-04>_proj
rh_missile<01-02>_drive
rh_empmissile_drive
rh_mine<01-02>
rh_gunboat_maingun
rh_capgun_01_proj
rh_flakcannon01_projPirate:
pi_missile<01-02>drive
pi_mine<01-02>
pi_photon<01-04>proj
pi_laser<01-04>proj
pi_tachyon<01-04>proj
pi_particle<01-04>proj
pi_neutron<01-04>proj
pi_pulse<01-03>proj
pi_plasma<01-03>_proj
pi_capgun_01_projCivilian:
ci_photon_<01-04>proj
ci_tachyon<01-04>proj
ci_laser<01-04>proj
ci_pulse<01-04>_proj
ci_capgun_01_projNomad:
no_gun01_rank01_proj
no_cruisedis01_drive
rtc_nomadtorpedo_proj
no_capgun01_projCodenames:
sp_annihilator_<01-03>proj
sp_bloodhound<01-03>proj
sp_destabilizer<01-03>proj
sp_distortion<01-03>proj
sp_doomsday<01-03>_proj
[Munition]
‘DA_archetype=’(.3db files) and ‘material_library=’(.mat files)
These are the icons for ammo in the stores. Don’t mix these!equipment\models\weapons\li_rad_missile.3db
equipment\models\li_equip.matequipment\models\torpedoes\ge_torpedo.3db
equipment\models\ge_equip.matequipment\models\mines\r_plasma_mine.3db
equipment\models\r_equip.mat
[Gun]
‘DA_archetype=’(.cmp files) and ‘material_library=’(.mat files)
This is the model and skin of the gun. Don’t mix these!
Note: one .mat file can contain skins for several guns!Liberty:
equipment\models\weapons\li_rad_launcher.cmp
equipment\models\weapons\li_cm_dropper01.cmp
equipment\models\weapons\li_auto_cannon.cmp
equipment\models\weapons\li_laser_beam.cmp
equipment\models\weapons\li_smlturret.cmp
equipment\models\weapons\li_heavy_ion_blaster.cmp
equipment\models\weapons\li_plasma_blaster.cmp
equipment\models\li_equip.mat
equipment\models\turret\li_turret<01-04>.cmp
equipment\models\turret\li_turret04b.cmp
equipment\models\turret\li_turret05.cmp
equipment\models\turret\li_turret05b.cmp
equipment\models\turret\li_cruiser_gun01.cmp
equipment\models\li_turret.matGeneric:
equipment\models\weapons\co_proton_cooker.cmp , these have funny names
equipment\models\weapons\co_raildaddy.cmp
equipment\models\weapons\co_shock_therapy.cmp
equipment\models\weapons\ge_shredder_shotgun.cmp
equipment\models\ge_equip.mat
equipment\models\turret\utility_turret<01-03>.cmp
equipment\models\turret\prison_turret01.cmp
equipment\models\turret\liner_turret01.cmp
equipment\models\turret\weapons_platform_turret.cm p
equipment\models\turret\weapons_platform_mturret.c mp
equipment\models\ge_turret.mat
equipment\models\turret\sp_turret<01-02>.cmp ;station turrets
equipment\models\sp_turret.mat
equipment\models\weapons\no_fighter_gun.cmp
equipment\models\hardware.matBretonia:
equipment\models\weapons\r_mass_driver.cmp
equipment\models\weapons\r_railgun.cmp
equipment\models\r_equip.mat
equipment\models\turret\r_turret<01-04>.cmp
equipment\models\turret\r_turret04b.cmp
equipment\models\turret\r_gunboat_gun01.cmp
equipment\models\r_turret.matKusari:
equipment\models\weapons\ku_ion_blaster.cmp
equipment\models\ku_equip.mat
equipment\models\turret\ku_turret<01-04>.cmp
equipment\models\turret\ku_gunboat_gun01.cmp
equipment\models\ku_turret.matRheinland:
equipment\models\weapons\rh_gamma_beamer.cmp
equipment\models\weapons\rh_proton_blaster.cmp
equipment\models\rh_equip.mat
equipment\models\turret\rh_turret<01-04>.cmp
equipment\models\turret\rh_gunboat_gun01.cmp
equipment\models\rh_turret.matWeird stuff:
Equipment\models\turret\dyson_turret01.cmp ;now it’s getting freaky
SolarSolar_mat_dyson_city.matSolar\dockable\nomad_lair_turret<01-02>.cmp
material_library=solar\nomad.mat
solar\nomad.mat
Hardpoints
‘hp_gun_type=’hp_gun_special_<1-10> ; ‘normal’ gun/missile hardpoints. You set level of the gun here. hp_turret_special_<1-10> ; ‘normal’ turret hardpoint. You set level of the turret here. hp_torpedo_special_1 ; torpedo hp_torpedo_special_2 ; cruise disruptor
Weapon types
‘weapon_type=’
This specifies as what kind of projectile your ammo will be treated. Important for different effectivity against different shield types.W_Photon01
W_Laser01
W_Tachyon01
W_Particle01
W_Neutron01
W_Pulse01
W_Plasma01
Also a quick HP tutorial and the functions;
HpMount - It’s for the height of the ship about this kind of hover pad when landed.
HpContrails - It’s for this dust trails which are created when you fly through space.
HpRunningLight - It’s for the blinking or glowing lights all over your ship.
HpWeapon - It’s for the place where a weapon is attached to the ship ans the weapons orientation.
HpTurret - Same as Weapons, but fpr turrets.
HpShield - It’s to define the place where the shield generator is mounted.
HpCockpit - It’s for the point where you look from if you are in cockpit view.
HpHeadlight - It’s for the headlight on your ship.
HpCM - This defines the place where a countermeasure dropper can be mounted.
HpMine - Same as HpCM, but for mine layers.
HpTorpedo - Defines the place where a torpedo or cruise disruptor can be mounted.
HpCloak - Defines the place where a cloak generator can be mounted.
HpDocklight - This is for the lights which only glows or blink when you dock to a base.
HpEngine - This defines where an engine exhaust is.
HpFX - Effects form effects.ini can be applied to this HP.
HpPilot - This is where the pilot model is mounted into the ship.
HpThruster - This HP defines the place where a thruster can be mounted.
HpTractor_Source=This is the place, where the tractor beam is mounted. The graphical effect, when tractoring is also coming from here.
HpBayDoor=This has something to do with Baydoors (animated?), but I’m not sure, what it is needed for. However in the shiparch.ini are also references to the HpBaydoors, so that they might be useful.The only other hardpoint, which the original FL ships have is a HpEngineGlow hardpoint, but I’m again not sure, what it is needed for.
Most of the custom ships I know do not have HpBayDoor and HpEngineGlow hardpoints, but they function perfectly. Therefore it seems, as if these hardpoints are not absolutely necessary!
One more thing: If you have ships with several parts, which can be destroyed partly (like flying around with only one wing, because the other one was blown up) need to have some Dpzzz hardpoints (For parts that can be damaged or blown off).
Original by Roo Avery, 2008/5/16</price></min.></min.></package></gunname></gunname></gunname></gunname>
- Very useful lists of variable values -