-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Adding a new Weapon
Creating a new weapon is very easy in OpenRA. In this tutorial we are going to copy a weapon and explain what everything is for.
First of all open the missiles.yaml
from this location:
OpenRA\mods\ra\weapons
Then search for the SCUD
entry and copy this part of the code:
SCUD:
Inherits: ^AntiGroundMissile
ReloadDelay: 240
Range: 10c0
MinRange: 3c0
Report: missile1.aud
After that, paste it at the bottom of the file (however you can paste it at any place). Now we will make little changes here to make it separate.
First of all we change the name. In this tutorial, we call it LRSCUD
(Long Range Scud).
Now, we are looking into the first lines of code:
Trait | Description |
---|---|
Inherits | From which weapon definition are traits inherited (e.g. from ^AntiGroundMissile ). |
ReloadDelay | How long it takes to reload the weapon in ticks. |
Range | How far the weapon can fire. |
MinRange | How close the target can be to the actor to shoot the weapon. |
Report | Soundfile to play when the weapon is firing. |
(See World-Coordinate-System for more information about cells.)
In our tutorial, we change the values like that:
LRSCUD:
Inherits: ^AntiGroundMissile
ReloadDelay: 400
Range: 24c0
MinRange: 7c512 # 0c512 is the half of a cell.
Report: missile7.aud # make sure the audio file you choose exists.
Let's look on the next part. Copy and paste it too:
Projectile: Bullet
Speed: 170
Blockable: false
TrailImage: smokey
TrailDelay: 5
Inaccuracy: 213
Image: V2
Shadow: True
LaunchAngle: 62
Again, we look on every single trait:
Trait | Property | Description |
---|---|---|
Projectile | - | The Projectile of the weapon. (e.g. Bullet , Missile and some others). |
Projectile | Speed | Speed of the projectile. |
Projectile | Blockable | The projectile is blockable (e.g. by walls). |
Projectile | TrailImage | A sequence/image given as trail. |
Projectile | TrailDelay | How long the trail is / how long it exists (! This has nothing to do with TrailImage !) |
Projectile | Inaccuracy | How much the weapon can differ from the target. |
Projectile | Image | Image of the projectile. |
Projectile | Shadow | If true, a shadow will be generated. |
Projectile | LaunchAngle | In which angle the projectile will be fired. |
We are also changing the values a bit:
Projectile: Bullet
Speed: 150
Blockable: false
TrailImage: smokey
TrailDelay: 10
Inaccuracy: 512
Image: V2
Shadow: True
LaunchAngle: 70
After that, we are looking into the last part of the SCUD
. Again, copy and paste the code.
Warhead@1Dam: SpreadDamage
Spread: 341
Damage: 45
Falloff: 1000, 368, 135, 50, 18, 7, 0
ValidTargets: Ground, Water, Trees
Versus:
None: 90
Light: 70
Heavy: 40
Concrete: 100
DamageTypes: Prone50Percent, TriggerProne, SmallExplosionDeath, Incendiary
Warhead@3Eff: CreateEffect
Explosions: napalm
ImpactSounds: firebl3.aud
Warhead@4EffWater: CreateEffect
Explosions: large_splash
Warhead | Type | Property | Description |
---|---|---|---|
Warhead | SpreadDamage | - | A Warhead. It will be triggered when the weapon reached its target (e.g. SpreadDamage , CreateEffect , LeaveSmudge and many others. |
Warhead | SpreadDamage | Spread | How wide the damage affects actors. |
Warhead | SpreadDamage | Damage | The damage to add to the hitted actors. |
Warhead | SpreadDamage | Falloff | The damage percentage at each range step. |
Warhead | SpreadDamage | ValidTargets | What actors are affected by the warhead. |
Warhead | SpreadDamage | Versus | The damage percentage at each armor (the armor is given at the actors definition). |
Warhead | SpreadDamage | DamageTypes | If the actor dies, this will trigger it to e.g. play a specified animation (e.g. FlameDeath of the flamethrowers weapon). |
Warhead | CreateEffect | Explosions | Image of the explosion. |
Warhead | CreateEffect | ImpactSounds | The sound of the explosion. |
We are changing the values a bit:
Warhead@1Dam: SpreadDamage
Spread: 2c256 # you can also use cell values here.
Damage: 75
Falloff: 1000, 768, 535, 250, 118, 17, 0
ValidTargets: Ground, Water, Trees
Versus:
None: 140
Light: 110
Heavy: 90
Concrete: 150
DamageTypes: Prone50Percent, TriggerProne, ExplosionDeath, FireDeath
Warhead@3Eff:: CreateEffect
Explosions: nuke
ImpactSounds: kaboom1.aud
Warhead@4EffWater: CreateEffect
Explosions: large_splash
If you want to, you can copy other warheads and paste them here.
After that, you can save the file.
Now go to:
OpenRA\mods\ra\rules
Open the vehicles.yaml
file and search for V2RL:
(It will most likely be at the top for just find it using Ctrl + F). now look for Armament:
and change SCUD
to LRSCUD
:
V2RL:
# ...
Armament:
Weapon: LRSCUD
Now if you run the game, the V2 Rocket Launcher will fire your long range missiles.
You can also change the values of the other fields, copy parts of other weapons and look whats happening then.
Players ๐ฒ
- FAQ โ
-
Installation ๐ฆ
- Game Content ๐ฟ
- Hotkeys and Stances ๐ฎ
- Strategies ๐
- Settings ๐ง
-
Dedicated Server โพ
- RaspberryPi ๐
- Docker ๐
- Badges & Icons ๐ฅ
- Changelog ๐
- Donating ๐ช
Modders โ๏ธ
- Tools ๐งฐ
- Audio guide ๐
- Traits ๐
- Palettes and Remaps ๐จ
- World Coordinate System ๐
-
Map scripting
- Lua-API ๐
- Conditions ๐
- Mapping ๐ง
- Modding Guide
- Pixelart ๐
- Utility
Developers ๐ง
- Contributing โค๏ธ
- Compiling
- Hacking
- Coding Standard ๐
- Branches and Releases ๐
- Release Checklist โ
- Sequences
- Glossary
- Reverse engineering ๐
- License ยฉ๏ธ