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
lever problem
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#1
lever problem

I have a problem with lever i set in my cs.

The first time i scripted it in, it worked perfectly, but now after that i copied that script into another file, and changed the names that need to be changed, it wont work.

void OnStart()
{
SetEntityConnectionStateChangeCallback("bro_lever", "UnLockDoor");
}

void UnLockDoor(string &in asEntity, int level_state)
{
if (level_state == 1)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "ui_sanity_gain", "Player", 0, false);
GiveSanityBoost();
}
}

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 07-27-2012, 04:09 PM by Lizard.)
07-27-2012, 03:30 PM
Find Reply
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: lever problem

The script looks fine and should work properly. Make sure:

-the new script file you pasted it into is an actual c++ script file and not just a .txt file
-the .map and .hps files are named exactly the same
-the .map and .hps files are in the same folder
-both the lever and door names in the .hps file are exactly the same as in the level editor.

I rate it 3 memes.
07-27-2012, 03:43 PM
Find Reply
Steve Offline
Member

Posts: 178
Threads: 17
Joined: Jun 2012
Reputation: 7
#3
RE: lever problem

I don't see anything wrong :|
are you sure the names are correct?


EDIT: Ninjaed XD

CURRENTLY WORKING ON:
Final Light = 40%
Need of voice actors.
(This post was last modified: 07-27-2012, 03:44 PM by Steve.)
07-27-2012, 03:43 PM
Find Reply
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#4
RE: lever problem

(07-27-2012, 03:43 PM)andyrockin123 Wrote: The script looks fine and should work properly. Make sure:

-the new script file you pasted it into is an actual c++ script file and not just a .txt file
-the .map and .hps files are named exactly the same
-the .map and .hps files are in the same folder
-both the lever and door names in the .hps file are exactly the same as in the level editor.
it is a c++ script file, and i have other scripts that works fine in the same map and the lever and door names are excatly the same in both level editor and the .hps file

I can upload the entire script. There might be something i missed


////////////////////
//Run first time entering map
void OnStart()
{
AddEntityCollideCallback("Player", "StartMusicArea", "StartMusic", true, 1);
AddUseItemCallback("", "RustyKey", "metal_1", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("ScareCabinet", "RoarScare", true);
SetEntityConnectionStateChangeCallback("bro_lever", "UnLockDoor");
AddEntityCollideCallback("Player", "DeadBroArea", "BroStare", true, 1);
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("ambience_haunting", true, 1, 2, 1, true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("RustyKey");
}

void RoarScare(string &in asEntity)
{
PlaySoundAtEntity("", "brute/enabled", "castle_1", 0, false);
}

void UnLockDoor(string &in asEntity, int level_state)
{
if (level_state == 1)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "ui_sanity_gain", "Player", 0, false);
GiveSanityBoost();
}
}

void BroStare(string &in asParent, string &in asChild, int alState)
{
StartPlayerLookAt("grunt_body_part2_1", 1, 10, "");
SetPlayerActive(false);
AddTimer("player_stare", 2, "Stare");
GiveSanityDamage(50, true);
}

void Stare(string &in asTimer)
{
SetPlayerActive(true);
StopPlayerLookAt();
}

////////////////////
//Run when entering map
void OnEnter()
{

}

////////////////////
//Run when leaving map
void OnLeave()
{

}

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 07-27-2012, 03:52 PM by Lizard.)
07-27-2012, 03:50 PM
Find Reply
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
RE: lever problem

Try replacing your if statement with:

if(GetLeverState("NAME_OF_LEVER") == 1)

{
///do stuff

}

I rate it 3 memes.
07-27-2012, 03:53 PM
Find Reply
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#6
RE: lever problem

(07-27-2012, 03:53 PM)andyrockin123 Wrote: Try replacing your if statement with:

if(GetLeverState("NAME_OF_LEVER") == 1)

{
///do stuff

}
It worked, thanks man

CURRENT PROJECT:
A Fathers Secret == Just started
07-27-2012, 03:58 PM
Find Reply




Users browsing this thread: 1 Guest(s)