Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make Objects de-spawn (disappear).
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#7
RE: How to make Objects de-spawn (disappear).

(05-06-2011, 05:38 PM)Simpanra Wrote: 0_0 thats....complex...

This should guide you through it:

Setting up the new entity:
In this example i am using "shelf2", but you might be using a different shelf. The process should be the same.
This approach assumes you don't want to use the "secret_shelf" entity, and can't / don't want to make a custom "secret_shelf".
Open up your model editor, and find the shelf file you are using. Shelves are in the found folder entities/storage. Load in the shelf you want to make activate-able, and choose save-as:
http://imgur.com/KcEEG

Call the shelf something different, in this example it is called shelf02_Activateable.
Now that we aren't working on the original, it is time to change some settings! First select the boxy green mesh around the object, and make sure the settings window has the mass set to 0 and the body name (in the general tab) as "Body_1":
http://imgur.com/pu31Y

Now look at the top bar, and select Settings->UserDefinedVariables and change the settings from "static prop" to the ones shown in the below image. Make sure to enter "Body_1" in the shown place!
http://imgur.com/hLxAN

Save, and exit the model editor, we should be done with that now!

Setting up the map
Now we finally can replace the shelf in the map. Open up the level editor and select the shelf you wish to replace, and find the entity file box in the "general" tab.
http://imgur.com/4QqW5

Click the "..." and navigate and load your custom entity:
http://i.imgur.com/vPgLa.png

Do these last two steps for each shelf you want to be able to toggle the activate property of. Now make sure all the instances in your map you wish to deactivate as part of this effect have the prefix "shelfDeactivateObjects_", and those you wish to activate "shelfActivateObjects_". In one of the screenshots above you will see I called my shelf "shelfDeactivateObjects_Shelf", as long as the correct prefix is there it doesn't matter what goes after the underscore.


Finally, in your script file, where you want to make the objects disappear, place in the following two lines of code:
SetEntityActive("shelfDeactivateObjects_*",false);
SetEntityActive("shelfActivateObjects_*",true);

This isn't overly difficult to do, but it is quite a bit of work.
(This post was last modified: 05-06-2011, 06:09 PM by Apjjm.)
05-06-2011, 06:07 PM
Find


Messages In This Thread
RE: How to make Objects de-spawn (disappear). - by Apjjm - 05-06-2011, 06:07 PM



Users browsing this thread: 1 Guest(s)