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_item, string &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", 0, true);
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");
}