Frictional Games Forum (read-only)

Full Version: Custom Usable Item
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is it possible to make a custom usable item ? By usable item I mean something like "Sanity Potion" or "Oil". I want to make a potion that increases the players speed for a short duration of time.
Yes, just make it the way you want in your modeling program. You can change it to whatever in the modeleditor. It could be a door, lantern, lamp, oil, etc.

Edit: nvm that, I thought you meant something else.
You can't create a "new potion". You would have to somehow build the idea on something already made, like oil, sanity potions, or laudanum. It would require scripting, of course.
Model creation:You'll have to create a model first (if you want a custom model) in any 3d editing program that supports OpenCOLLADA (.dae exporter). After exporting it you'll need to open it in the model editor and add some physical properties to it by attatching a body to it, and then you'll need to set the item's settings so it will be a coin (Settings -> User Defined Variables -> Type - Item -> Subtype - Coins).

Script-wise:
Afterwards, you'll need to place it in the Level Editor somewhere in your map, and give it a name, and script it so when the player will pick up "name" it will boost him. You'll need to use:
Code:
void OnStart()
{    
    SetEntityCallbackFunc("name", "BoostPlayer");
}
void BoostPlayer(string &in ent, string &in type)
{    
    if(type == "OnPickup")    
    {        
        SetPlayerMoveSpeedMul(2.2f);        
        AddTimer("", 5.5f, "StopPlayer");    
    }
}
void StopPlayer(string &in timer)
{    
    SetPlayerMoveSpeedMul(1.0f);
}

This code will boost the player's speed by 2.2 times for 5.5 seconds, after he picks up "name".
(07-17-2013, 06:17 PM)ClayPigeon Wrote: [ -> ]Model creation:You'll have to create a model first (if you want a custom model) in any 3d editing program that supports OpenCOLLADA (.dae exporter). After exporting it you'll need to open it in the model editor and add some physical properties to it by attatching a body to it, and then you'll need to set the item's settings so it will be a coin (Settings -> User Defined Variables -> Type - Item -> Subtype - Coins).

Script-wise:
Afterwards, you'll need to place it in the Level Editor somewhere in your map, and give it a name, and script it so when the player will pick up "name" it will boost him. You'll need to use:
Code:
void OnStart()
{    
    SetEntityCallbackFunc("name", "BoostPlayer");
}
void BoostPlayer(string &in ent, string &in type)
{    
    if(type == "OnPickup")    
    {        
        SetPlayerMoveSpeedMul(2.2f);        
        AddTimer("", 5.5f, "StopPlayer");    
    }
}
void StopPlayer(string &in timer)
{    
    SetPlayerMoveSpeedMul(1.0f);
}

This code will boost the player's speed by 2.2 times for 5.5 seconds, after he picks up "name".

Thank you very much Smile

However, although that works I wanted something you activate inside your inventory. Anyway to do that ?
(07-19-2013, 05:35 PM)hunchbackproduction Wrote: [ -> ]However, although that works I wanted something you activate inside your inventory. Anyway to do that ?

Perhaps mess around with item combinations.
(07-19-2013, 09:16 PM)Your Computer Wrote: [ -> ]
(07-19-2013, 05:35 PM)hunchbackproduction Wrote: [ -> ]However, although that works I wanted something you activate inside your inventory. Anyway to do that ?

Perhaps mess around with item combinations.

Oh yes,good idea sir Big Grin I will give it a try. That would make it more like I want it ^ Thanks