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
Multiple use of a void OnStart, need help D:
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: Multiple use of a void OnStart, need help D:

(03-16-2013, 03:27 PM)KeysOfMyMind Wrote: So hi guys.
i'm new to scripting and I want this script to work and it should, but it doesn't for some reason.



void OnStart()
{
AddUseItemCallback("", "crowbar_1", "mansiondoor1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_Joint", "CollideAreaBreakDoor", true, 1);
}


void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("mansiondoor1", false, true);
AddPropImpulse("mansiondoor1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("mansiondoor1", true);
SetSwingDoorClosed("mansiondoor1", false, false);
SetMoveObjectState("mansiondoor1", 1);
PlaySoundAtEntity("","break_wood_metal", "ScriptArea_Dust", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "ScriptArea_Dust", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

//Scare Here
{
AddEntityCollideCallback("Player", "push", "Push", true, 1);
AddEntityCollideCallback("Player", "door_slam", "Slam", true, 1);
}


void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_pant.snt", "push", 0, false);
AddPlayerBodyForce(30000, 0, 0, false);
}


void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansiondoor1", true, true);
SetSwingDoorLocked("mansiondoor1", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "door_scare", 0, false);
}

My scare part crashes the game.
Some help please.

Also I'd like to make it so that I have another area the player hits up against the wall where he collapses and gasps from hitting the wall.
Also the value for the AddPlayerBodyForce propels the player forward, I'd like him to be push backwards into the wall area.

Put the AddEntityCollideCallback parts to your void OnStart(), so that it will look like this.
PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""crowbar_1""mansiondoor1""UsedCrowbarOnDoor"true);
AddEntityCollideCallback("crowbar_joint_1""ScriptArea_Joint""CollideAreaBreakDoor"true1);
AddEntityCollideCallback("Player""push""Push"true1); AddEntityCollideCallback("Player""door_slam""Slam"true1);

To make the player to be pushed backwards, change to force from 30000 to -30000.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-16-2013, 03:41 PM
Find


Messages In This Thread
RE: Multiple use of a void OnStart, need help D: - by PutraenusAlivius - 03-16-2013, 03:41 PM



Users browsing this thread: 3 Guest(s)