-
Notifications
You must be signed in to change notification settings - Fork 5
Weapons
A large range of upgradable weapons is important in a game like Rogue Wave. This document outlines how to build them.
An easy upgrade for weapons is to enable them to fire more powerful ammunition. Let's work through creating an upgrade to provide Assault Rifle ammo that does an extra 10% damage.
- Right click in
Assets/_Dev/Resources/Recipes/Ammoand selectCreate -> Rogue Wave -> Recipe -> Ammunition Damage Multiplier - Give your new Scriptable Object a name, such as
RW 556mm Damage + 10% - Check
Is Power Upso that it will be offered as a power up recipe in game and as a permanent upgrade. - Set the dependency to (at least) the lowest mag size for this ammo type
- Check
Is Stackableif you intend the player to be able to purchase more than one of these upgrades. - Set the Ammo Type to
Rogue Wave AmmoType_556mm - Set other values as you see fit
That's it. Your recipe will now be offered alongside all other recipes in the game.
Passive Weapons are ones that are equipped but do not need to be fired. They auto-fire in specific patterns, in game terms they are fired by Synthos, the small humanoid incarnation of the Nanobots. Passive weapons are ideal for keeping hordes of enemies at bay.
In this section we will create a Passive Destruction Beam weapon. This will fire a beam in two directions every x seconds. Destroying the first enemy they come into contact with.
This is the actual weapon object that will be attached to the player when equipped.
- Create a new script called
PassiveDestructorBeamwhich extendsPassive WeaponinAssets/_Dev/Runtime/Passive - Open up
Assets/_Dev/Scenes Dev/Weapon Dev - Open the prefab
Assets/_Dev/Resources/Prefabs/Player/Synthos - Nanobot Pawn.prefab - Create an empty game as a child of the root object, rename it to
Passive Destruction Beam - Add
Neo Serialized Game Object - Add
Audio Sourceand set the Output toSpatial Effectsin theRogueWave_AudioMixer, turn offPlay On Awake - Add
PassiveDestructorBeamcomponent, configure the settings (paying special attention to the layers used, probably this needs to be "Enemy") - Create a prefab of the weapon in
Assets/_Dev/Prefabs/Weapons/Passive - Click the
Register Prefab With SaveGameManagerbutton on the prefab
At this point you can startup the scene and you should see the following error message appearing periodically in the console:

We now need to add the Weapon effects. If you use the NeoFPS modular firearm system you then configure the weapon as you would any other NeoFPS weapon and the PassiveWeapon will pull the trigger periodically for you.
Alternatively, you can override the Fire method in the PassiveDestructorBeam class and implement the weapon effects there. If you override the Fire method you will want to include the following two lines:
PlayFireSFX();
For either approach any model objects you need should be immediately below the root of the weapon prefab.
You can see examples of passive weapons in Assets/_Dev/Resources/Prefabs/Weapons/Passive.
Once you have a working weapon it is time to integrate it is time to insert it into the game. Delete the weapon from the Synthos prefab (being sure to apply any changes to the prefab first). Then move on to the next section.
The pickup is the object that will be created by the nanobots or found in the level during play. Once collected the Passive Weapon will be equipped.
- Create an Empty Object and call it "Passive Destruction Beam Pickup"
- Set the layer to
Trigger Zones - Add
Audio Sourceand set the Output toSpatial Effectsin theRogueWave_AudioMixer, turn offPlay On Awake, add a pickup sound such asAudio Pickup Weapon - Add
Neo Serialized Game Object - Add a Sphere Collider trigger of radius 0.5
- Add Pickup Trigger Zone
- Add Passive Pickup, Add the Passive Weapon Prefab and a suitable display mesh for this item (we will add the Recipe value in the next section)
- Add a model or billboard as a child
- Make it into a prefab in
Assets/_Dev/Resources/Prefabs/Pickups/Weapons/Passive - Click the
Register Prefab With SaveGameManagerbutton on the prefab
The recipe is needed to enable the nanobots to build the weapon.
- in
Assets/_Dev/Resources/Recipes/Weapon/Passiveright click and selectCreate -> Rogue Wave -> Recipe -> Passive Item Pickupname itPassive Destruction Beam Pickup - Setup the pickup as needed (minimal settings are below)
- Is Power Up
- Is Consumble
- Is not Stackable
- Set the Item Pickup to the passive item pickup created above
- in the item pickup set the recipe to this one
You should now be able to create a scene with a pickup already in it and collect the weapon. The Nanobots should now offer to build it when possible.