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 Problem.. Crowbar and open hatch.
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#4
RE: Script Problem.. Crowbar and open hatch.

PHP Code: (Select All)
AddTimer(asEntity0.2"TimerPlaceCrowbar"); 

That's not a float. You put a double there. Use:

PHP Code: (Select All)
AddTimer(asEntity0.2f"TimerPlaceCrowbar");

///....

AddTimer (""0.1f"TimerPushHatch");

///...

AddTimer (""1.1f"TimerHatchCanClose"); 

That's for all of your other functions as well..
1.3 is a double
1.3f is a float
THOSE FUNCIONS REQUIRE A FLOAT

PHP Code: (Select All)
PlaySoundAtEntity("""player_crouch.snt""Player"0.05ffalse); 

Although it should work regardless... =/

I've got it!

The simplest little mistake.

AddUseItemCallback("openhatch", "crowbar_1", "ScriptArea_1", "UseCrowbarOnDoor", true);

void UseCrowbarOndoor(string &in asItem, string &in asEntity)
...


Be sure to copy Function names to avoid this problem.
And let me mention that if you didn't check the ItemInteraction it still wouldn't work.

Fixed code:
PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("openhatch""crowbar_1""ScriptArea_1""UseCrowbarOnDoor"true);
    
AddEntityCollideCallback ("joint""ScriptArea_1""BreakHatch"true1);
}

void UseCrowbarOnDoor(string &in asItemstring &in asEntity)

    
RemoveItem("crowbar_1");
    
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 BreakHatch(string &in asParentstring &in asChildint alState
{
    
SetEntityActive("joint"false);
    
SetEntityActive("brokencrowbar"true);
    
SetSwingDoorLocked("hatch"falsefalse);
    
SetSwingDoorClosed("hatch"falsefalse);
    
SetSwingDoorDisableAutoClose("hatch"true);
    
AddPropImpulse("hatch"0, -30"world");
    
CreateParticleSystemAtEntity("""ps_hit_wood.ps""AreaEffect"false);
    
PlaySoundAtEntity("""break_wood_metal.snt""AreaEffect"0false);
    
GiveSanityBoostSmall();
    
PlayMusic("10_puzzle01.ogg"false0.70.110false);
    
AddTimer (""0.1"TimerPushHatch");
}

void TimerPushHatch (string &in asTimer)
{
    
AddPropImpulse("hatch"0, -2, -1"world");
    
AddTimer (""1.1"TimerHatchCanClose");
}

void TimerHatchCanClose (string &in asTimer)
{
    
SetSwingDoorDisableAutoClose("hatch"false);


And I suggest making another Script Area for the crowbar, since I presume the one you have is already in that area and would basically trigger immediately.
(This post was last modified: 02-23-2016, 07:43 AM by Spelos.)
02-23-2016, 07:10 AM
Find


Messages In This Thread
RE: Script Problem.. Crowbar and open hatch. - by Spelos - 02-23-2016, 07:10 AM



Users browsing this thread: 1 Guest(s)