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
How to detect when player uses or drinks potion
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: How to detect when player uses or drinks potion

Create a new item in the Model Editor so that it is just an item that you can pickup in the World, then code it so that Daniel automatically drinks it and triggers the event.

Spoiler below!
PHP Code: (Select All)
void OnStart()
{
    
SetEntityCallbackFunc("potion_health_1""Drink_Event");
}

void Drink_Event(string &in asEntitystring &in Type)
{
    
RemoveItem(asEntity);
    if(
Type == "OnPickup")
    {
        
AddPlayerHealth(25.0f);
        
//Rest of the event goes here. This includes any effects you want to use.
    
}



Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 06-01-2019, 03:39 PM by Romulator.)
06-01-2019, 03:39 PM
Find


Messages In This Thread
RE: How to detect when player uses or drinks potion - by Romulator - 06-01-2019, 03:39 PM



Users browsing this thread: 1 Guest(s)