So I was reading one of the forum threads when I noticed that one of the users (docblacky) posted the following code:
What I understood from this is that you are allowed to use functions from another script IF you declare that script as a property. I thought, "wow, this is pretty handy." So I decided to set up my own example:
Scriptname TestPatrolScript extends ObjectReference {Creates actors that patrol routes}objectReference property spawnMarker autoobjectReference property gotoMarker autoactorBase property patrolSoldierBase autoTestFunctionScript property funcScript autoevent onEquipped(actor akActor) if akActor == game.getPlayer() actor patrolSoldier = (spawnMarker.placeAtMe(patrolSoldierBase, 1, true)) as actor utility.wait(2) TestFunctionScript.patrolFunc(patrolSoldier, gotoMarker) endIfendEventScriptname TestFunctionScript extends Actor {Testing sharing functions between scripts}actor function patrolFunc(actor soldier, objectReference endMarker) soldier.pathToReference(endMarker, 0.5)endFunction
The problem is that I don't actually know how to fill the property "funcScript" with "TestFunctionScript". I mean once I declare the property, and then I go to the properties tab of the script and click the "edit value" button, I then get the option to "pick reference in render window" which doesn't help because I can't pick a script in the reference window. So some clarification would be much appreciated.
Also before people mention it, I do realize that this example can also be done by casting "patrolSoldier" to type TestFunctionScript (i.e. ptrolSoldier as TestFunctionScript) and I also do realize that the import command can also be used to achieve what I'm trying to do. This is just an example for the sake of testing the property method.