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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help debugging various script functions
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#22
RE: Need help debugging various script functions

Here's an untested example:

Note, this would all go into your inventory.hps file if you intend to use the inventory item idea:

PHP Code: (Select All)
void OnGameStart()
    {
        
/*!
         * SyringeScript: internal name for callback
         *
         * PlayerItem: item in inventory that represents the player
         *
         * Syringe: item in inventory that represents the syringe
         *
         * StartSyringePowers: function to call when the two items (i.e. PlayerItem and Syringe) are combined in inventory
         *
         * false: false should only be set if syringes all hold the same inventory name, otherwise use true
         *  and duplicate the line for each syringe with a unique inventory name:
         */
        
AddCombineCallback("SyringeScript""PlayerItem""Syringe""StartSyringePowers"false);
    }

void StartSyringePowers(string &in player_itemstring &in syringe)
    {
        
// Remove ONLY the syringe!
        
RemoveItem(syringe);
        
// Force-exit inventory!
        
ExitInventory();

        
// Adjust player movement speeds
        // Bigger values will make the player fall of the map!
        
SetPlayerMoveSpeedMul(1.8);
        
SetPlayerRunSpeedMul(1.5);

        
// Timer to play custom heartbeat sound
        
AddTimer("heartbeat_sound"0"heartbeat_sound");
        
// Duration of the epinephrine effect!
        
AddTimer("finishTimer"10"finishTimer");
    }

void heartbeat_sound(string &in asTimer)
    {
        
PlaySoundAtEntity("heart""Heartbeat_fast.snt""Player"0true);
        
AddTimer("heartbeat_sound"8"heartbeat_sound"); //loop sound
    
}


void finishTimer(string &in asTimer)
    {
        
SetPlayerMoveSpeedMul(1); // change players speed to normal
        
SetPlayerRunSpeedMul(1);// change players speed to normal
        
StopSound("heart"1); // stop sound if it is still playing
        
RemoveTimer("heartbeat_sound");
    } 

Tutorials: From Noob to Pro
09-16-2013, 05:29 AM
Website Find


Messages In This Thread
RE: Need help debugging various script functions - by Your Computer - 09-16-2013, 05:29 AM



Users browsing this thread: 6 Guest(s)