A Development Tutorial: Chapter 22

From FOnline: Reloaded Wiki
Jump to: navigation, search
A Development Tutorial: Chapter 22
AWikiEditor.gif
Get the developer tools and try building new content for this game!
Season All Seasons
Status Progress Stopped
Completion 75%
Authors Slowhand
This Chapter 22: Mysterious Stranger Perk
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
Pro Tips
Notes


Description

If you have this perk, from time to time, a mysterious stranger appears out of the blue and tries to help you. This stranger might be there when you encounter difficulties in your travels, or sometimes even in remote zones, caves, hidden vaults, when you feel ill or are crippled. In the future he might even open locked doors for you, if you fail to do so.

Purpose

The reason for this perk, besides coolness, is to introduce the stat Charisma back into the game (for servers that abandoned it totally PvP wise) The perk should help people who want to role-play with higher Charisma than 1. The perk should be available with lower Charisma as well, but Charisma shall have a great effect on strength of the perk, this is why most of the timers depend on Charisma. Of course, RP logic can surface as well, I leave to everyone's imagination why someone would help a charismatic person more often or for longer period of time. Even if the perk is reduced to a minimum of only random encounter appearance, or support perk, I suggest that Charisma dependency shall be dominant. The code is free for everyone to use it as they wish. May the stranger be with you.

Specification

From time to time, a mysterious stranger will help the player, regarding the rules below.

  • The Mysterious Stranger will spawn and act accordingly if the player has the perk and when:
    • The player enters a random encounter, will stay for a duration and help the player.
    • The player is attacked while being crippled, will try to doctor the player and then join the fight.
    • The player is below half health points and is attacked, will try to heal the player and then join the fight.
    • The player fails to open a lock, will try to open the lock and stay for a duration. (not implemented)
  • The Cooldown of the Mysterious Stranger spawn shall be dependent on the player's Charisma, with the suggested formulas:
    • Chance for MS to spawn at random encounter: X + Y * CH + U * LK (Min V, Max Z)
    • Chance for MS to spawn for FA in non Town Control maps: X + CH * LK * U (Min V, Max Z)
    • Chance for MS to spawn for Doctor: X + CH * LK * U (Min V, Max Z)
    • FA and Doctor spawn block mechanic cooldown: X / CHA); (This is mechanic is explained in detail below)
    • Death time of Mysterious Stranger cooldown: X /CHA - and shall be much higher than encounter cooldown.
    • Encounter spawn cooldown shall share the timer with with special spawns.
  • The Duration of the Mysterious Stranger aid shall be also dependent on the player's Charisma, with suggested formulas:
    • Duration of aid for Encounter shall last: X + Y * CH seconds in RT combat.
    • Duration of aid for Encounter shall last: X + Y * CH turns in TB combat. (unavailable due to SDK bugs regarding TB events)
  • The Strength of the Mysterious Stranger shall depend on the Level and the Charisma of the player:
    • Level of the MS shall be the Level of the player + 3.
    • The Level cap of the Mysterious Stranger shall be dependent on the players Charisma.
    • The Perk, Stat and Inventory composition of the Mysterious Stranger shall better with the higher Charisma the player has.
    • A Random factor can be introduced when determining the Strength of the Mysterious Stranger. (not implemented)
    • If the player's luck is very low, the Mysterious Stranger can be Jinxed. Good Luck!
  • AI - The Mysterious Stranger shall behave as:
    • If the player is attacked, the attacker shall be added to the Mysterious Strangers target list, with medium priority.
    • If the player is crippled, the Mysterious Stranger will try to doctor, with high priority, but only once per spawn session.
    • If the player is below half health points, the Mysterious Stranger will try to First Aid, with high priority, but only once per spawn session.
    • If another player is attacking, the Mysterious Stranger shall change target to it. (not implemented)
  • Integration into projects/servers:
    • All of the parameters of the Mysterious Stranger mechanic shall be configurable.
    • Special triggers shall be disableable with macros from header.
    • Solutions shall be chosen, to conflict minimally with optimized code parts, like combat.fos
    • Integration shall be documented in the tutorials as well, just like the mechanics.
  • Testing:
    • Test file shall be supplied with a few scripts written to ease testing.
    • There shall be a use case testing document to follow for testers, or developers after modifications.

Known Bugs

Code Review

  • Wipe: What is the point of checking if object is valid() when it's passed by reference?
  • Wipe: A lot of unfinished stuff at least from 2238/reloaded pov - own MS_LOG when you could use debug@WLog(), own get/set lvar instead of utils@Get/SetetLvar(),
  • Wipe: perkeditor and reloaded...ha-ha!
  • Wipe: Or better yet, return( chance >= Random(0,100) ); !