Making Invisibility Potions

From FleshWorks

Jump to: navigation, search

by Shockeye


Intro

This tutorial shows you how to create an invisibilty potion like the earlier Thief games had. From this you should be able to work out how to recreate all of the old potions with the exception of Slowfall. Basically the idea is to use the effect of the Keeper invisibility spell, instead of it being cast by a Keeper NPC, it will be triggered by imbibing a potion. There are to parts to making the potion. Firstly, you need to set up a script that will apply the effect (which is called a Stimulus in the scripts) to the player when he uses the potion. Secondly, we need to create the potion class and attach the script to it.


Making the Potion Script

  • Open the Trigger Scripts Manager. Hit the new script button. An new, empty script will appear. Change the default name to something meaningful like InvisibilityPotion
  • Click the conditions button. Another dialog will appear, from which you can select the condition that will cause the script to trigger. The condition we need is Image:Condition_icon.png Weapons&Inventory > When I am used in a way from the inventory. Select this, hit ok.
  • Click OK
  • Hit the actions button. Yet another dialog appears as if by magic. This is where we get to pick what happens we the script is run. Select Image:action_icon.png Objects > Apply[Float] units of stimulus [Enum:eStimulus type] to linked object(s)[LinkFlavour], hit ok.
  • Now back in the script dialog set the parameters for the action.
  • Click on [Float] and set it to anything greater than zero.
  • Click on [Enum:eStimulus type] and set it to StimulusType_T3MakeInvisibleSpell. (Use other Stimuli to create other potions)
  • Click on [LinkFlavour] and set it to PLAYER
  • Click OK in the InvisibilityPotion script window to save it.
  • Click CANCEL in trigger script browser, so that you don't compile every single script!


Creating the Potion Class

Open the Actor Browser. Create a new class under WorldObj > Inventory >Powerup > Potion and call it InvisibilityPotion. Right click the new class, select make placeable from the context menu. A placeable object will have an asterisk next to it in the Actor Browser. Select your new class. Go to the properties page and add a new property Scripts > TriggerScripts. When you open this new property in the properties browser, there will already be one script there, which plays a pick up noise. Add a new script here, set it to your InvisibilityPotion script. We need to give the potion a mesh so it will be visible in the level. Under Properties > Render add new property ObjectMesh. In the properties page select this and set it to whatever you want from mesh browser, preferably something bottle shaped like one of the other potions. You might want to look into reskinning it as well so that it looks different from the health potion, but that's another tutorial altogether. Now you can place your potion in your level. To use potion you need to cycle through inventory because no key is assigned.



Back to Mission Design: Gameplay Tutorials Page

Back to Mission Design Tutorials Page

Back to Main Tutorials Page

Personal tools