A Development Tutorial: Chapter 08: Difference between revisions

From FOnline: Reloaded Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
| authors = Slowhand
| authors = Slowhand
| chapter = 08: Scenery Scripts
| chapter = 08: Scenery Scripts
| 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>'''Scenery Scripts'''<br>[[A Development Tutorial: Chapter 09|Dialogue-to-Quest Location]]<br>Chapter 10<br>[[A Development Tutorial: Chapter 11|Setup of 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]]
| 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>'''Scenery Scripts'''<br>[[A Development Tutorial: Chapter 09|Dialogue-to-Quest Location]]<br>Chapter 10<br>[[A Development Tutorial: Chapter 11|Setup of 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>[[A Development Tutorial: Chapter 17|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]]
}}
}}



Revision as of 04:46, 21 January 2017

A Development Tutorial: Chapter 8
Get the developer tools and try building new content for this game!
Season {{{season}}}
Status Progress Stopped
Completion 75%
Authors Slowhand
This Chapter 08: Scenery Scripts
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
Setup of 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
Advanced Kill Quest
Mysterious Stranger Perk
Perk Installation
Black Jack Game
Black Jack Installation
Sound Effects
Notes {{{notes}}}


Creating and using some basic scripts: Scenery scripts.

A quest complexity will usually require us to use scripts. At this point we will dive into one of the most simple scripts, the Scenery scripts, or scripts associated with scenery objects on the map. For this we will need a Scenery object on our map and a new script we want to call when the user interact with it.

Step by Step:

  • Create a new scriptfile:
    • Create a new textfile named "quest_tut1.fos" in "Server\scripts\"
    • Copy paste the content from the code part below
  • Bind the script file to the Scenery in Mapper:
    • Launch Mapper and the load the map
    • If you haven't add a Scenery object to the map. (I used some defected robot.)
    • Set the ScriptName value of the Scenery object to your script files name. (quest_tut1.fos)
    • Set the FuncName value of the Scenery object to the function to be called when player interaction. (s_RefillRobot)
    • Save the map and exit
  • Run the server to compile your script:
    • To test if your script compiles error free, you can use: Server\scripts\compile.bat quest_tut1.fos
    • Delete previous script file binaries of your modified script file if they exist. (quest_tut1.fosb, quest_tut1.fosp)
    • Run the server
  • Understand the script:
    • Study the script file, pretty straightforward, comments are useless but I left them there anyways
    • If the player tries to use the Repair Skill on the robot, it will say that he can't do that without Small Energy Cells
    • If the players tries to use the Science Skill on the robot, the system will say that the robot is out of energy
    • Finally, if the player tries to use Small Energy Cells on the robot, the system will notify about the success and set the quest variable to the desired value. This is how the quest is progressed in this case
    • Also one Small Energy Cell is removed from the backpack of the player
    • If the player tries to use the Repair or Science skills on the robot, the notification will tell, that it is already done. This is ensured by the quest variable check at the start.

(image soon)