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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help How to make item unlootable?
IWT Offline
Junior Member

Posts: 5
Threads: 2
Joined: May 2012
Reputation: 0
#1
How to make item unlootable?

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?
01-18-2013, 12:38 AM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#2
RE: How to make item unlootable?

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?

01-18-2013, 12:47 AM
Find
IWT Offline
Junior Member

Posts: 5
Threads: 2
Joined: May 2012
Reputation: 0
#3
RE: How to make item unlootable?

(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?
(This post was last modified: 01-18-2013, 01:07 AM by IWT.)
01-18-2013, 01:06 AM
Find
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#4
RE: How to make item unlootable?

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: (Select All)
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.
(This post was last modified: 01-18-2013, 05:03 AM by TheGreatCthulhu.)
01-18-2013, 01:20 AM
Find
IWT Offline
Junior Member

Posts: 5
Threads: 2
Joined: May 2012
Reputation: 0
#5
RE: How to make item unlootable?

(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: (Select All)
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.
01-18-2013, 01:06 PM
Find




Users browsing this thread: 1 Guest(s)