A Development Tutorial: Chapter 17
|A Development Tutorial: Chapter 17|
|Get the developer tools and try building new content for this game!|
|This Chapter||17: Floating First Aid Text|
|More Chapters||Title Page|
Development Kit Setup
The World Map Editor
Create a 2-Map Zone
Monsters, Loot, and Scripts
Tracking Quest Progress
The Scripting Environment
Understanding Quest Scripts
Dialogue: The "SAY" Menu
Floating FA Text
Dialogues vs Scripts
Simple Kill Quest
Mysterious Stranger Perk
Black Jack Game
Black Jack Installation
Floating First Aid heal text above the head.
In this tutorial we will use the Reloaded SDK version 2, and will change some RP elements into RNG or whatever it's called. Instead of the usual ***patches wounds***, ***injects stimpack*** healing message a green positive number will show the amount healed by using First Aid or healing drugs. To specify our task, only First Aid, Super Stimpacks, Stimpacks, Hype, Healing Powder and Weak Healing Powder usage will change it's floating text. Also, if the FA is a critical failure the color of the text will be teal, while if it's a critical success, the healing number will be the brightest green possible.
Understanding the Code Changes
- To start, need to search for the text "patches wounds" to find any related code to this text. Fortunately for us, this is not hidden too many layers, we will find it "skills.fos", which we will transform a bit, as shown in the code sections.
- To do that, first we will write a tool function, which will handle the floating texts. This will be added to the "utils.fos" script file. The definitions it requires will be added to "utils_h.fos" header file, also we will import the function there, for easier access. Also a few color definitions will be added to "_colors.fos" script file.
- When this is done, we will search for "injects stimpack" and find a few references in "drugs.fos" script file. This will appear mainly in two functions, one that handles when the critter uses drugs on itself and one that handle when the critter uses drugs on others.
- Remove all floating message related to healing drugs in both functions, but do not replace with anything, as at this point the healing value is not knows. Healing drugs have a random interval, and we need to use the floating text only after that value has been determined.
- The place where we will put in the floating text calls, will be the drug processing function named "ProcessDrug". This function will be a bit fuzzy at first sight, but it's not hard to find the right place to put the code in. To not make a huge mess, a new util function will be implemented for this, which will just call the other util function with the right reasons depending on the drug pid used.
- We test it and basically that is all.
When linking the code from pastebin, I will leave a few lines for context, so you can see what to cut out and what to replace with.
- drugs.fos - follow instruction in code where to cut and replace, also, you will need to remove the old healing powder floating text.
- _colors.fos - add these lines anywhere.
- utils_h.fos - add these lines anywhere.
- utils.fos - add these lines anywhere, I put them near VerboseAction, since that is the functionality we "replace".
- skills.fos - replace these lines as instructed in the code.
Test it, if it does not work, report back on feedback please.