Frictional Games Forum (read-only)
[SCRIPT] How to make item unlootable? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] How to make item unlootable? (/thread-19965.html)



How to make item unlootable? - IWT - 01-18-2013

So, I'm on my way to build my Custom story Demo, and one thing I've seen nowhere, is this:

So, my plan is to place an item with different name on the ground, and make it unlootable, and interactable with other items. How is the script done?


RE: How to make item unlootable? - Daemian - 01-18-2013

you edit the item on the model editor and set its type to other than "Item"
so player can't pick it up.

i'm not sure what kind of interaction you want with other items, collision? combine?


RE: How to make item unlootable? - IWT - 01-18-2013

(01-18-2013, 12:47 AM)Amn Wrote: you edit the item on the model editor and set its type to other than "Item"
so player can't pick it up.

i'm not sure what kind of interaction you want with other items, collision? combine?

As the item lays on the ground, unlootable, you can use other item on it.

And I'm not sure about model editor, is it possible to do it without, or how to do it?


RE: How to make item unlootable? - TheGreatCthulhu - 01-18-2013

If the item doesn't have to move around (like, bounce back when the player runs into it), you can just open the Level Editor, select the item, go to the Entity tab, and check, "StaticPhysics"; when done, just place a script area around it, and do something like this in the script file (inside OnEnter() function):
PHP Code:
SetEntityInteractionDisabled("itemname"true);

// and then (for player "hand-based" interactions):
SetEntityPlayerInteractCallback("ScriptArea_1""MyFunc"false);

// or rather (to use an item on it):
AddUseItemCallback("internalCallbackID""itemToUseID""ScriptArea_1""MyFunc"true); 

Of course, replace "itemname", "itemToUseID", "ScriptArea_1" and "MyFunc" with the names you're using, and "internalCallbackID" with whatever you want.


RE: How to make item unlootable? - IWT - 01-18-2013

(01-18-2013, 01:20 AM)TheGreatCthulhu Wrote: If the item doesn't have to move around (like, bounce back when the player runs into it), you can just open the Level Editor, select the item, go to the Entity tab, and check, "StaticPhysics"; when done, just place a script area around it, and do something like this in the script file (inside OnEnter() function):
PHP Code:
SetEntityInteractionDisabled("itemname"true);

// and then (for player "hand-based" interactions):
SetEntityPlayerInteractCallback("ScriptArea_1""MyFunc"false);

// or rather (to use an item on it):
AddUseItemCallback("internalCallbackID""itemToUseID""ScriptArea_1""MyFunc"true); 

Of course, replace "itemname", "itemToUseID", "ScriptArea_1" and "MyFunc" with the names you're using, and "internalCallbackID" with whatever you want.

Thanks, really helps me out! I guess the Demo is finished soon. Just fixing and decorating and some debugging and it's done.