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 Script won't work
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#1
Script won't work

Workin' on a script atm. Half of the lever script works except for the "SetMoveObjectState("PORTNAME", 0);"s. But the real problem is the graveyard script and spike tunnel script neither of which will work i.e. nothing happens.

Spoiler below!

void OnStart()
{
ConnectEntities("D", "lever_simple01", "castle_portcullis_1", true, -1, "PortOpen1");
ConnectEntities("E", "lever_simple02", "castle_portcullis_2", true, -1, "PortOpen2");
ConnectEntities("F", "lever_simple03", "castle_portcullis_3", true, -1, "PortOpen3");

AddEntityCollideCallback("Player", "GraveArea_1", "Grave1", true, 1);
AddEntityCollideCallback("Player", "GraveArea_2", "Grave2", true, 1);
AddEntityCollideCallback("Player", "GraveArea_3", "Grave3", true, 1);
AddEntityCollideCallback("Player", "GraveArea_4", "Grave4", true, 1);


for(int i=1;i<=3;i++)
AddEntityCollideCallback("Player", "WhisperArea_"+i, "WhisperTunnel", true, 1);

SetEntityPlayerLookAtCallback("GraceAreaCorpse_1", "CorpseDisappear1", true);
SetEntityPlayerLookAtCallback("GraceAreaCorpse_2", "CorpseDisappear2", true);
}

///////Insanity Event///////
///Ports///
void PortOpen1(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
SetLeverStuckState(asMainEntity, -1, true);
SetMoveObjectState("castle_portcullis_1", 1);
SetMoveObjectState("castle_portcullis_2", 0);
SetMoveObjectState("castle_portcullis_3", 0);
SetLeverStuckState("lever_simple01", 0, true);
}

void PortOpen2(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
SetLeverStuckState(asMainEntity, -1, true);
SetMoveObjectState("castle_portcullis_2", 1);
SetMoveObjectState("castle_portcullis_1", 0);
SetMoveObjectState("castle_portcullis_3", 0);
SetLeverStuckState("lever_simple02", 0, true);
}

void PortOpen3(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
SetLeverStuckState(asMainEntity, -1, true);
SetMoveObjectState("castle_portcullis_3", 1);
SetMoveObjectState("castle_portcullis_2", 0);
SetMoveObjectState("castle_portcullis_1", 0);
SetLeverStuckState("lever_simple03", 0, true);
}


///Ports End///

///Graveyard///

void Grave1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("GraceAreaCorpse_1", true);

AddLocalVarInt("Var1", 1);
func5();
}

void Grave2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("GraceAreaCorpse_2", true);

AddLocalVarInt("Var1", 1);
func5();
}

void Grave3(string &in asParent, string &in asChild, int alState)
{

AddLocalVarInt("Var1", 1);
func5();
}

void Grave4(string &in asParent, string &in asChild, int alState)
{

AddLocalVarInt("Var1", 1);
func5();
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
SetEntityActive("coffin_dirty_3", true);
SetEntityActive("Flask_03", true);
}
}

void CorpseDisappear1(string &in asEntity, int alState)
{
if (alState == 1)
{
SetPropActiveAndFade("graveyard_corpse03_1", false, 0.5f);
StartScreenShake(0.1f, 0, 0.1, 0.1);
PlayGuiSound("sanity_flick.snt", 0.5f);
PlayGuiSound("scare_wall_scratch_single.snt", 1);
PlayGuiSound("react_breath.snt", 1);
}
}

void CorpseDisappear2(string &in asEntity, int alState)
{
if (alState == 1)
{
SetPropActiveAndFade("graveyard_corpse02_1", false, 0.5f);
StartScreenShake(0.1f, 0, 0.1, 0.1);
PlayGuiSound("sanity_flick.snt", 0.5f);
PlayGuiSound("scare_wall_scratch_single.snt", 1);
PlayGuiSound("react_breath.snt", 1);
}
}
///Graveyard End///

///Spike Tunnel///
void WhisperTunnel(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "insanity_whisper.snt", "Player", 1.0f, false);
}

///Spike Tunnel End///

void OnEnter()
{

}

void OnLeave()
{

}


EDIT: All areas and entities have the correct names.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 07-29-2012, 02:37 PM by i3670.)
07-29-2012, 02:05 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: Script won't work

I'm not sure if its of any significance, but when you use the "for" loop, the last part is supposed to be "++i", not i++.

For the graveyard part, try adding "SetLocalVarInt("Var1", 0);" to void OnStart()

For the lever part, you're setting the lever stuck state twice per function, each time a different value. I'm not sure about using the castle portcullis with a lever either; I've never seen that application, I've only seen it used with a wheel, perhaps that is a possible issue?

I rate it 3 memes.
07-29-2012, 02:32 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#3
RE: Script won't work

changed the i++ and put in the SetLocalVarInt. Still no change.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-29-2012, 02:42 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Script won't work

Try using debug messages as much as often to see if the problem is with the callback or the function; the more you can isolate the problem, the better off you'll be for troubleshooting.

I rate it 3 memes.
07-29-2012, 02:45 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#5
RE: Script won't work

I don't see why there would be any problem with the script since I've re-used parts of scripts from other maps I've tinkered on and those maps work just fine.

"What you think is irrelevant" - A character of our time

A Christmas Hunt
07-29-2012, 06:07 PM
Find




Users browsing this thread: 1 Guest(s)