A Development Tutorial: Chapter 17: Difference between revisions

From FOnline: Reloaded Wiki
Jump to navigation Jump to search
(Created page with "{{Guide | name = A Development Tutorial: Chapter 17 | image = AWikiEditor.gif | description = Get the developer tools and try building new content for this game! | status = Pr...")
 
No edit summary
Line 7: Line 7:
| authors = Slowhand
| authors = Slowhand
| chapter = 17: Floating First Aid Text
| chapter = 17: Floating First Aid Text
| chapters = [[A Development Tutorial|Title Page]]<br>[[A Development Tutorial: Chapter 01|Development Kit Setup]]<br>[[A Development Tutorial: Chapter 02|Making Maps]]<br>[[A Development Tutorial: Chapter 03|The World Map Editor]]<br>[[A Development Tutorial: Chapter 04|NPC Dialogues]]<br>[[A Development Tutorial: Chapter 05|Create a 2-Map Zone]]<br>[[A Development Tutorial: Chapter 06|Monsters, Loot, and Scripts]]<br>[[A Development Tutorial: Chapter 07|Tracking Quest Progress]]<br>[[A Development Tutorial: Chapter 08|Scenery Scripts]]<br>[[A Development Tutorial: Chapter 09|Dialogue-to-Quest Location]]<br>Chapter 10<br>[[A Development Tutorial: Chapter 11|The Scripting Environment]]<br>[[A Development Tutorial: Chapter 12|Understanding Quest Scripts]]<br>Chapter 13<br>[[A Development Tutorial: Chapter 14|Dialogue: The "SAY" Menu]]<br>Chapter 15<br>[[A Development Tutorial: Chapter 15.01|Lockpick Cooldown]]<br>[[A Development Tutorial: Chapter 16|Repeatable Locations]]<br>'''Floating FA Text'''<br>[[A Development Tutorial: Chapter 18|Roulette Game]]<br>[[A Development Tutorial: Chapter 19|Dialogues vs Scripts]]<br>[[A Development Tutorial: Chapter 20|Simple Kill Quest]]<br>[[A Development Tutorial: Chapter 21|Advanced Kill Quest]]<br>[[A Development Tutorial: Chapter 22|Mysterious Stranger Perk]]<br>[[A Development Tutorial: Chapter 23|Perk Installation]]<br>[[A Development Tutorial: Chapter 24|Black Jack Game]]<br>[[A Development Tutorial: Chapter 25|Black Jack Installation]]<br>[[A Development Tutorial: Chapter 26|Sound Effects]]
| chapters = [[A Development Tutorial|Title Page]]<br>[[A Development Tutorial: Chapter 01|Development Kit Setup]]<br>[[A Development Tutorial: Chapter 02|Making Maps]]<br>[[A Development Tutorial: Chapter 03|The World Map Editor]]<br>[[A Development Tutorial: Chapter 04|NPC Dialogues]]<br>[[A Development Tutorial: Chapter 05|Create a 2-Map Zone]]<br>[[A Development Tutorial: Chapter 06|Monsters, Loot, and Scripts]]<br>[[A Development Tutorial: Chapter 07|Tracking Quest Progress]]<br>[[A Development Tutorial: Chapter 08|Scenery Scripts]]<br>[[A Development Tutorial: Chapter 09|Dialogue-to-Quest Location]]<br>Chapter 10<br>[[A Development Tutorial: Chapter 11|The Scripting Environment]]<br>[[A Development Tutorial: Chapter 12|Understanding Quest Scripts]]<br>Chapter 13<br>[[A Development Tutorial: Chapter 14|Dialogue: The "SAY" Menu]]<br>Chapter 15<br>[[A Development Tutorial: Chapter 15.01|Lockpick Cooldown]]<br>[[A Development Tutorial: Chapter 16|Repeatable Locations]]<br>'''Floating FA Text'''<br>[[A Development Tutorial: Chapter 18|Roulette Game]]<br>[[A Development Tutorial: Chapter 19|Dialogues vs Scripts]]<br>[[A Development Tutorial: Chapter 20|Simple Kill Quest]]<br>Chapter 21<br>[[A Development Tutorial: Chapter 22|Mysterious Stranger Perk]]<br>[[A Development Tutorial: Chapter 23|Perk Installation]]<br>[[A Development Tutorial: Chapter 24|Black Jack Game]]<br>[[A Development Tutorial: Chapter 25|Black Jack Installation]]<br>[[A Development Tutorial: Chapter 26|Sound Effects]]
}}
}}



Revision as of 04:26, 26 January 2017

A Development Tutorial: Chapter 17
Get the developer tools and try building new content for this game!
Season {{{season}}}
Status Progress Stopped
Completion 75%
Authors Slowhand
This Chapter 17: Floating First Aid Text
More Chapters Title Page
Development Kit Setup
Making Maps
The World Map Editor
NPC Dialogues
Create a 2-Map Zone
Monsters, Loot, and Scripts
Tracking Quest Progress
Scenery Scripts
Dialogue-to-Quest Location
Chapter 10
The Scripting Environment
Understanding Quest Scripts
Chapter 13
Dialogue: The "SAY" Menu
Chapter 15
Lockpick Cooldown
Repeatable Locations
Floating FA Text
Roulette Game
Dialogues vs Scripts
Simple Kill Quest
Chapter 21
Mysterious Stranger Perk
Perk Installation
Black Jack Game
Black Jack Installation
Sound Effects
Notes {{{notes}}}


Floating First Aid heal text above the head.

Specification

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.

The Code

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.

(image soon)