User Tools

Site Tools


door_scripting_tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
door_scripting_tutorial [2017/11/04 10:47] justindoor_scripting_tutorial [2017/11/04 10:51] justin
Line 61: Line 61:
 The previous scripts work fine for some cases, but most of the time you probably wouldn't want doors to be stuck in an open state. Fortunately we can improve these scripts and allow the door to be toggled between an opened and closed state. The previous scripts work fine for some cases, but most of the time you probably wouldn't want doors to be stuck in an open state. Fortunately we can improve these scripts and allow the door to be toggled between an opened and closed state.
  
-The key to this functionality is maintaining the state of the door in an entity property using [[Set Entity Property]] and checking this property with an "if" statement (or the "Evaluate Condition" node in a visual [[script]]). According to the door's current state, you will trigger the appropriate animation, modify the navigation paths, and update the entity property with the new state. For example, an "open" property with a value of either true or false could be used to maintain the door's state.+The key to this functionality is maintaining the state of the door in an entity property using [[Set Entity Property]] and checking this property with an "if" statement (or the "Evaluate Condition" node in a visual [[script]]). According to the door's current state, you will trigger the appropriate animation, modify the navigation paths, and update the entity property with the new state. For example, a property named "open" with a value that gets toggled between true or false could be used to maintain the door's state.
  
 The new versions of the [[script|scripts]] are very similar to the previous ones except there is now a second set of events that can occur to "revert" the door back to a closed state by playing the "close" animation and changing the navigation paths back to their original types. The new versions of the [[script|scripts]] are very similar to the previous ones except there is now a second set of events that can occur to "revert" the door back to a closed state by playing the "close" animation and changing the navigation paths back to their original types.
Line 103: Line 103:
 </code> </code>
  
-Scripting [[object|objects]] like doors is a great way to learn more about the RPG in a Box scripting language. There are often multiple methods to accomplish the same functionality and there isn't necessarily a right or wrong approach. As with many other concepts, the best way to learn is to experiment with different setups and determine what works best for you and the particular game that you're creating.+Scripting [[object|objects]] like doors is a great way to learn more about the RPG in a Box scripting language. There are often multiple methods to accomplish the same functionality and there isn't necessarily a right or wrong approach. As with many other concepts, the best way to learn is to experiment with different setups and determine what works best for you and the particular game that you're creating. Have fun!
  
door_scripting_tutorial.txt · Last modified: 2017/11/04 11:22 by justin