A Development Tutorial: Chapter 08

From FOnline: Reloaded Wiki
Revision as of 20:02, 20 January 2017 by Henry (talk | contribs)
Jump to navigation Jump to search
A Development Tutorial: Chapter 8
Get the developer tools and try building new content for this game!
Season {{{season}}}
Status wip
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
Locations: Public to Private
Setup of Scripting Environment
Understanding Quest Scripts
A Simple Quest
Dialogue: The "SAY" Menu
Basic Mechanics
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)