Oni (folder)/GameDataFolder/IGMD/global: Difference between revisions

m
→‎Built-in overriding: wording, formatting
m (link fix)
m (→‎Built-in overriding: wording, formatting)
Line 41: Line 41:
  }
  }


Now Oni's level scripts cannot hide objects in the environment by calling env_show ''x'' 0, and as you play a level you will see the effect of this. One obvious change is found in the introductory cutscene in Chapter 2. Ah, that must be the seat the receptionist wanted you to take! ^_^
Now Oni's level scripts cannot hide objects in the environment by calling <tt>env_show ''x'' 0</tt>, and as you play a level you will see the effect of this. One obvious change is found in the introductory cutscene in Chapter 2. Ah, that must be the seat the receptionist wanted you to take! ^_^


'''Big catch''': pseudo-hooks like this are of limited value because there's no way to call the original function once you've overridden its name with your own declaration. Therefore, you can't add code to the beginning or end of a built-in function as you should be able to with a true hook; you can only prevent the built-in function from running, and run your own code instead. In theory you might be able to reconstruct a built-in call's effects using equivalent BSL commands. This is attempted by Gumby's cutscene-skipping script, which attempts to replace [[BSL:Functions#cutscene|begin_cutscene and end_cutscene]] with its own implementations so it can add a "skip cutscene" key, with somewhat unpredictable results.
'''Big catch''': pseudo-hooks like this are of limited value because there's no way to call the original function once you've overridden its name with your own declaration. Therefore, you can't add code to the beginning or end of a built-in function as you should be able to with a true hook; you can only prevent the built-in function from running, and run your own code instead. In theory you might be able to reconstruct a built-in call's effects using equivalent BSL commands. This is attempted by Gumby's cutscene-skipping script, which replaces [[BSL:Functions#cutscene|<tt>begin_cutscene</tt> and <tt>end_cutscene</tt>]] with its own implementations so it can add a "skip cutscene" key, with somewhat unpredictable results.


Thus, the override "feature" is not recommended for use.
Thus, the override "feature" is not recommended for use.


[[Category:Game directory map]][[Category:Modding tutorials]]
[[Category:Game directory map]][[Category:Modding tutorials]]