The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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 AddUseItem Callback Not Working
dailycreepypasta Offline
Junior Member

Posts: 32
Threads: 18
Joined: Aug 2014
Reputation: 0
#1
AddUseItem Callback Not Working

To my luck, something else didn't work. I have a crowbar item in one of my maps named "Crowbar". I have a script that requires the item to function properly. So, while testing the mod I got the crowbar and went to the level with the script. The script isn't working for me! Here's the script I'm using:

PHP Code: (Select All)
void OnStart()
{
        
AddUseItemCallback("""Crowbar""Door""UseCrowbarOnDoor"true);
}

void UseCrowbarOnDoor(string &in asItemstring &in asEntity)
{
        
RemoveItem(asItem);
        
PlaySoundAtEntity("""player_crouch.snt""Player"0.05false);
        
AddTimer(asEntity0.2"TimerPlaceCrowbar");
}
 
void TimerPlaceCrowbar(string &in asTimer)
{
        
SetEntityActive("Joint"true);
        
PlaySoundAtEntity("""puzzle_place_jar.snt"asTimer0false);
}
 
void BreakDoor(string &in asParentstring &in asChildint alState)
{
        
SetEntityActive("Joint"false);
        
SetEntityActive("Broken"true);
 
        
SetSwingDoorLocked("Door"falsefalse);
        
SetSwingDoorClosed("Door"falsefalse);
        
SetSwingDoorDisableAutoClose("Door"true);
 
        
AddPropImpulse("Door"003"world");
 
        
CreateParticleSystemAtEntity("""ps_hit_wood.ps""AreaEffect"false);
        
PlaySoundAtEntity("""break_wood_metal""AreaEffect"0false);
 
        
GiveSanityBoostSmall();
 
        
PlayMusic("10_puzzle01.ogg"false0.70.110false);
 
        
AddTimer(""0.1"TimerPushDoor");
}
 
void TimerPushDoor(string &in asTimer)
{
        
AddPropImpulse("Door", -421"world");
        
AddTimer(""1.1"TimerDoorCanClose");
}
 
void TimerDoorCanClose(string &in asTimer)
{
        
SetSwingDoorDisableAutoClose("Door"false);


I made sure that the names match and that the casing is the same, and I don't use the crowbar in any script except for one to set an entity inactive. What could be the problem?

Creator of "The Night I Went Insane".

http://www.moddb.com/mods/the-night-i-went-insane
(This post was last modified: 04-06-2015, 05:49 AM by dailycreepypasta.)
04-06-2015, 05:46 AM
Find


Messages In This Thread
AddUseItem Callback Not Working - by dailycreepypasta - 04-06-2015, 05:46 AM
RE: AddUseItem Callback Not Working - by DnALANGE - 04-06-2015, 10:30 AM
RE: AddUseItem Callback Not Working - by Neelke - 04-06-2015, 12:29 PM
RE: AddUseItem Callback Not Working - by Neelke - 04-07-2015, 07:50 AM
RE: AddUseItem Callback Not Working - by Neelke - 04-07-2015, 08:12 AM
RE: AddUseItem Callback Not Working - by Mudbill - 04-07-2015, 09:30 AM



Users browsing this thread: 1 Guest(s)