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>[[A Development Tutorial: Chapter 10|Locations: Public to Private]]<br>[[A Development Tutorial: Chapter 11|Setup of Scripting Environment]]<br>[[A Development Tutorial: Chapter 12|Understanding a Quest Script]]<br>[[A Development Tutorial: Chapter 13|A Simple Quest]]<br>[[A Development Tutorial: Chapter 14|Dialogue: The "SAY" Menu]]<br>[[A Development Tutorial: Chapter 15|Modifying Some Basic Mechanics]]
| 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>[[A Development Tutorial: Chapter 10|Locations: Public to Private]]<br>[[A Development Tutorial: Chapter 11|Setup of Scripting Environment]]<br>[[A Development Tutorial: Chapter 12|Understanding Quest Scripts]]<br>[[A Development Tutorial: Chapter 13|A Simple Quest]]<br>[[A Development Tutorial: Chapter 14|Dialogue: The "SAY" Menu]]<br>[[A Development Tutorial: Chapter 15|Modifying Some Basic Mechanics]]
}}
}}



Revision as of 19:55, 20 January 2017

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
Modifying Some 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)