In this tutorial we’ll set up the grenadier’s flamethrower attack.
The flamethrower is a ranged attack, dealing damage to every combatant staying in it’s damage dealer’s trigger. The flame effect is started and stopped using tragged machines.
We’ll set up:
- schematic to start particle effects
- schematic to stop particle effects
- flamethrower schematic
- flamethrower ability
- flamethrower battle AI
- update the grenadier’s combatant (add the ability and battle AI)
- update the grenadier’s prefab (add the tagged machines)
Let’s start a fire!
Play Effects Schematic #
This’ll be very simple – we just start emiting particles.
Navigate to Schematics and start working on a new schematic.
Emit Particles #
Add Node > Game Object > Component > Emit Particles
We’ll start emiting particle effects on the Machine Object (our tagged machine will be on the game object of the particle effect) and all it’s child objects.
- Emit
Enable this setting. - Object (Target Object)
Select Machine Object. - Scope
Select All In Children.
And that’s it for the schematic. Click on Save Schematic to save it, e.g. as PlayEffects.
Stop Effects Schematic #
The stop effects schematic is pretty much the same, just stop emiting – so we’ll continue working on this schematic.
We’ll simply change what we need to for this variation and use Save Schematic As to save it as a new schematic.
Emit Particles #
Stop emiting particles.
- Emit
Disable this setting
And that’s it for the schematic. Click on Save Schematic As … to save it, e.g. as StopEffects.
Flamethrower Schematic #
The flamethrower schematic is similar to the grenadier’s punch attack schematic – so we’ll just build upon that.
Open the GrenadierPunchAttack schematic.
We’ll simply change what we need to for this variation and use Save Schematic As to save it as a new schematic.
Combatant Animation #
We’ll change the used animation type and the normalized times.
- Animation Type
Select Attack 3. - Normalized Time (Wait)
Set to 0.25. - Normalized Time (Store Duration)
Set to 0.4.
Play Sound #
We’ll play an audio clip instead of a sound type.
- Use Sound Type
Disablethis setting. - Audio Clip Asset
Select flamethrower.
Start Tagged Machine #
Add Node > Machine > Start Tagged Machine
We’ll start the tagged machine that’ll use the PlayEffects schematic – it’ll use the tag flameOn.
This node is added after the Play Sound node.
- Wait
Disable this setting.
We don’t need to wait for the machines to finish. - Object (Machine Object)
Select Machine Object. - Use Same Object
Enable this setting.
Click on Add Tag to add a starting tag.
- Tag
Set to flameOn.
Wait #
Add Node > Base > Wait
We’ll wait for a bit to give the effect time to light up before activating the damage dealer.
This node is added after the Start Tagged Machine node and connects to the first Activate Damage Dealer node.
- Time
Select Value > Value.
Set to 0.5.
Start Tagged Machine #
Copy the first Start Tagged Machine and add it after the 2nd Wait node (i.e. the first one waiting for the stored duration).
We’ll stop the flame using a different tag: flameOff
This node connects to the second Activate Damage Dealer node.
- Tag
Set to flameOff.
And that’s it for the schematic. Click on Save Schematic As … to save it, e.g. as GrenadierFlamethrower.
Flamethrower Ability #
The flamethrower attack is the same as the spin attack, just with a few changes.
Navigate to Status > Abilities and copy the Grenadier Spin Attack.
- Name
Set to Grenadier Flamethrower.
Target Settings > Target Changes > Target Change 0 > Status Change 0 #
This is a ranged attack, so it’ll use the RATK status value for the change value instead of ATK.
- Status Value (Change Value)
Select RATK.
Battle Animation > Battle Animation 0 #
- Schematic Asset
Select GrenadierFlamethrower.
Battle Animation > Damage Dealer Settings #
We’ve already set up the damage dealer using the activation tag flame.
- Tag
Set to flame.
Flamethrower Battle AI #
The flamethrower is used when enemies are away further than 4.5 world units – just like the spit battle AI.
Navigate to Battles > Battle AIs and copy the Spit battle AI.
Battle AI Settings #
- Name
Set to Flamethrower.
Check Distance #
- Check Value
Select Value > Value:
Set the value to 4.5.
Ability #
- Ability
Select Grenadier Flamethrower.
Updating the Grenadier #
And once again, we’ll update the grenadier’s combatant.
Navigate to Combatants > Combatants and select the Grenadier.
Attacks & Abilities > Ability Development #
We’ll add the flamethrower ability.
Click on Add Ability.
- Learn at Level
Set to 1. - Ability
Select Grenadier Flamethrower.
Battle Settings > Battle AI #
We also need to add the Flamethrower battle AI, we also want to use it with a higher priority than the melee attacks, so we need to add it before the already added Grenadier Melee battle AI.
Copy the Battle AI 0 and keep editing Battle AI 0 instead of the new copy.
- Battle AI
Select Flamethrower.
Save Changes #
That’s it for the editor setup.
Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.
Updating the Prefab #
Finally, we’ll add the tagged machines to the grenadier’s prefab.
Open the Grenadier Variant prefab for editing – you can find it in Assets/Tutorial Assets/Prefabs/Combatants/.
Select the FlameStream child object (where we already added the flame damage dealer).
Flame On Tagged Machine #
Add a Tagged Machine component to the FlameStream child object using the component menu.
Start Settings #
Click on Add Starting Tag.
- Tag
Set to flameOn.
Machine Execution Settings #
- Schematic Asset
Select the PlayEffects schematic.
Flame Off Tagged Machine #
Add another Tagged Machine component to the FlameStream child object using the component menu.
Start Settings #
Click on Add Starting Tag.
- Tag
Set to flameOff.
Machine Execution Settings #
- Schematic Asset
Select the StopEffects schematic.
And that’s it for the prefab – save the changes.
Testing #
Hit play and check in on a grenadier.
Yeah … burn it to the ground!
Next, we’ll add item pickups dropped by enemies.