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
Not sure if this is possible, but I want to ask anyways
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#1
Not sure if this is possible, but I want to ask anyways

So, I have an idea for my custom game. I don't know if it's possible, but I want to ask. If this has been asked before, I'm sorry. I tried searching, but didn't see anything.

Also, please keep in mind that I am fairly new to this still, so just throwing code at me won't help.

What I want to do:

I have a switch in the game that is needed to move a bookshelf, which reveals a secret passageway. This shelf turns all the lights in the current room off, and essentially forces the player to use their Tinderboxes or Lantern.

However, I have an idea.

Here is a screenshot of the wall where the switch is. It's behind the painting.

[Image: zSKR]

On the other side of the player, behind them:

[Image: zSLd]

What I want to do:

Upon using the lever behind the painting, I want the room to go completely dark, which I've already managed to do. I would also like to make it so that when the switch is pulled, the bed changes into "bed_simple_movable" with a dead body on it, or even a suitor, with a bloody/very red scene.

However, I don't want it to change until the player turns AROUND. So as he's turning around, it looks normal, but when the player is full turned, it changes, then after a few seconds, goes back to normal.

So, now here's the big question:

Is this possible? And if so, how would I go about doing it? Is there some sort of tutorial I could follow?
06-10-2012, 01:02 AM
Find
Mine Turtle Offline
Senior Member

Posts: 647
Threads: 32
Joined: Mar 2011
Reputation: 29
#2
RE: Not sure if this is possible, but I want to ask anyways

(06-10-2012, 01:02 AM)Ananaias Wrote: So, I have an idea for my custom game. I don't know if it's possible, but I want to ask. If this has been asked before, I'm sorry. I tried searching, but didn't see anything.

Also, please keep in mind that I am fairly new to this still, so just throwing code at me won't help.

What I want to do:

I have a switch in the game that is needed to move a bookshelf, which reveals a secret passageway. This shelf turns all the lights in the current room off, and essentially forces the player to use their Tinderboxes or Lantern.

However, I have an idea.

Here is a screenshot of the wall where the switch is. It's behind the painting.

[Image: zSKR]

On the other side of the player, behind them:

[Image: zSLd]

What I want to do:

Upon using the lever behind the painting, I want the room to go completely dark, which I've already managed to do. I would also like to make it so that when the switch is pulled, the bed changes into "bed_simple_movable" with a dead body on it, or even a suitor, with a bloody/very red scene.

However, I don't want it to change until the player turns AROUND. So as he's turning around, it looks normal, but when the player is full turned, it changes, then after a few seconds, goes back to normal.

So, now here's the big question:

Is this possible? And if so, how would I go about doing it? Is there some sort of tutorial I could follow?
its just a matter of using well timed "timers", along with SetEntityActive codes. id go into specifics, but im afraid im out of time for today.

[Image: 201107142327000.gif]
06-10-2012, 01:23 AM
Find
Ermu Offline
Member

Posts: 86
Threads: 13
Joined: Jan 2012
Reputation: 2
#3
RE: Not sure if this is possible, but I want to ask anyways

(06-10-2012, 01:02 AM)Ananaias Wrote: the bed changes into "bed_simple_movable" with a dead body on it, or even a suitor, with a bloody/very red scene.
Why do you want it a bed_simple_movable?
The body's are easy to do, just make a body on the bed and untick the "active"
then use the SetEntityActive("bodyname", true); in the script you want.
Same for the red theme, use red lights or so.
Though if you use like PointLight, you need this: SetLightVisible("lightname", true);
(06-10-2012, 01:02 AM)Ananaias Wrote: However, I don't want it to change until the player turns AROUND. So as he's turning around, it looks normal, but when the player is full turned, it changes, then after a few seconds, goes back to normal.

So, now here's the big question:

Is this possible? And if so, how would I go about doing it? Is there some sort of tutorial I could follow?

I believe you need an; SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);



Calls a function when the player looks at a certain entity.
Callback syntax: void MyFunc(string &in asEntity, int alState)
alState: 1 = looking, -1 = not looking
asName - internal name (the items name to look at)
asCallback - function to call
abRemoveWhenLookedAt - determines whether the callback should be removed when the player looked at the entity


-------------------------------------

Except, on how to trigger it.
Insert the SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);

inside the function that is triggered when you pull the lever, after it's pulled, and when you look at the bed, it should trigger the function you put in "string& asCallback";
void YourFuncNameHere(string &in asEntity, int alState)



EXAMPLE:

(PUT THIS INSIDE THE FUNCTION THAT IS CALLED WHEN LEVER PULLED)
{
SetEntityPlayerLookAtCallback("bed_scare", lookedatbed, true);

}

(PUT THIS ANYWHERE IN YOUR SCRIPT FILE)
void lookedatbed(string &in asEntity, int alState)
{
SetEntityActive("deadbody_scare", true);

SetLightVisible("redlight", true);

}


Hope you understood, and that this helped!

Never used "SetEntityPlayerLookAtCallback" so can't really help if it doesn't work.
(This post was last modified: 06-10-2012, 01:39 AM by Ermu.)
06-10-2012, 01:36 AM
Find
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#4
RE: Not sure if this is possible, but I want to ask anyways

I really don't understand at all, but that's possibly due to me screaming at bads on League of Legends, so my mind is all sorts of scrambled.

I'll read over it again in a bit, try stuff out, and see if it works. In either case, thanks for the great reply.

Also, as a side note, can't wait for Plague Forest<3
06-10-2012, 03:52 AM
Find
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#5
RE: Not sure if this is possible, but I want to ask anyways

I probably did it wrong. I got rid of the bed thing, don't worry about that. I'm using the bed already on the map.

I have the following in my game:

http://puu.sh/zXzB

That's 3 bodies, 2 lamps, and a pin light.

Because of my lack of understanding, and not really knowing what to do, I ended up making it so that "deadbodyb" is set active when the lever is pulled.

I tried making it so that when looking at "deadbodyb", "deadbodya," "deadbodyc", and the lamps and light would show up, but it's not working.

All together, I want me turning around to spawn all 3 bodies, the two lamps, and the pinlight I have, but I am having difficulties doing it. Here's my code if anyone can help. I really appreciate it.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityPlayerLookAtCallback("deadbodyb""lookedatbed"true);
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}

void lookedatbed(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyc"true);
    
SetEntityActive("redlighta"true);
    
SetEntityActive("redlightb"true);
    
SetLightVisible("redlight"true);


EDIT: I couldn't get the code to work at all with "SetEntityPlayerLookAtCallback("bed_scare", lookedatbed, true);". The game wouldn't even start. I did some googling and found "void lookedatbed(string &in asParent, string &in asChild, int alState)"

I'm sure it CAN work with "SetEntityPlayerLookAtCallback("bed_scare", lookedatbed, true);", and I just screwed something up. If someone can help me with that, too, that'd be awesome.
(This post was last modified: 06-10-2012, 09:50 AM by Ananaias.)
06-10-2012, 09:49 AM
Find
Ermu Offline
Member

Posts: 86
Threads: 13
Joined: Jan 2012
Reputation: 2
#6
RE: Not sure if this is possible, but I want to ask anyways

(06-10-2012, 09:49 AM)Ananaias Wrote: I probably did it wrong. I got rid of the bed thing, don't worry about that. I'm using the bed already on the map.

I have the following in my game:

http://puu.sh/zXzB

That's 3 bodies, 2 lamps, and a pin light.

Because of my lack of understanding, and not really knowing what to do, I ended up making it so that "deadbodyb" is set active when the lever is pulled.

I tried making it so that when looking at "deadbodyb", "deadbodya," "deadbodyc", and the lamps and light would show up, but it's not working.

All together, I want me turning around to spawn all 3 bodies, the two lamps, and the pinlight I have, but I am having difficulties doing it. Here's my code if anyone can help. I really appreciate it.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityPlayerLookAtCallback("deadbodyb""lookedatbed"true);
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}

void lookedatbed(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyc"true);
    
SetEntityActive("redlighta"true);
    
SetEntityActive("redlightb"true);
    
SetLightVisible("redlight"true);


EDIT: I couldn't get the code to work at all with "SetEntityPlayerLookAtCallback("bed_scare", lookedatbed, true);". The game wouldn't even start. I did some googling and found "void lookedatbed(string &in asParent, string &in asChild, int alState)"

I'm sure it CAN work with "SetEntityPlayerLookAtCallback("bed_scare", lookedatbed, true);", and I just screwed something up. If someone can help me with that, too, that'd be awesome.
If the SetEntityPlayerLookAtCallback doesn't work, you could also force the player to look at the bed, and then activate all of those.

ie. When you pull the lever, it starts a Timer, (done with AddTimer), then after the timer has ended, the player is forced to look at the bed, and then the body and lights activate.

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
AddTimer(""3"Forcelook");
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}
void Forcelook(string &in asTimer){      ////Make an AreaScript inside your bed in LevelEditor and insert name here      StartPlayerLookAt("AreaScriptName", 10, 10, "");      AddTimer("", 1, "ActivateScare");}
void ActivateScare(string &in asTimer){    SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyc"true);
    
SetLightVisible("redlighta"true);
    
SetLightVisible("redlightb"true);
    
SetLightVisible("redlight"true); 
      
AddTimer(""2"ScareOver");}
void ScareOver(string &in asTimer){////Leave this empty!!StopPlayerLookAt();} 

REMEMBER TO DELETE ALL LINES WITH ////, THEY WERE COMMENTS FOR YOU!!!

PS. LoL rules
(This post was last modified: 06-10-2012, 12:29 PM by Ermu.)
06-10-2012, 12:20 PM
Find
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#7
RE: Not sure if this is possible, but I want to ask anyways

Okay. I named the Area "bedscare". Also moved it to activate deadbodyb when I look at the area as well.

Is this what the code should look like now? Sorry, still very new to this ><

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
AddTimer(""3"Forcelook");
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}
void Forcelook(string &in asTimer){StartPlayerLookAt("bedscare"1010"");      AddTimer(""1"ActivateScare");}
void ActivateScare(string &in asTimer){    SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("deadbodyc"true);
    
SetLightVisible("redlighta"true);
    
SetLightVisible("redlightb"true);
    
SetLightVisible("redlight"true); 
      
AddTimer(""2"ScareOver");}
void ScareOver(string &in asTimer){////Leave this empty!!StopPlayerLookAt();} 

EDIT: I got this error, so I'm guessing I did something wrong >:

[Image: A4QH]

EDIT2: Lol, I forgot to delete "////Leave this empty!!"

It loaded, testing it now.

EDIT3: Alright, cool. I That got everything to show up (But the two lamps I have, but I think I can manage to make them show up myself.

Now, how do I make them disappear after a few seconds? Furthermore, is there a way to add kind of a panicked noise in the players character? Almost as if the player sees it, then the main character (David, in this case), pants or something? Also, I would like for the player to lose a little sanity, too.

Sorry if I'm asking 200,000,000 questions. I'm taking the time to ask as many questions as I can now, so I can learn all that I really want to ><
(This post was last modified: 06-10-2012, 10:14 PM by Ananaias.)
06-10-2012, 10:07 PM
Find
Ermu Offline
Member

Posts: 86
Threads: 13
Joined: Jan 2012
Reputation: 2
#8
RE: Not sure if this is possible, but I want to ask anyways

(06-10-2012, 10:07 PM)Ananaias Wrote: Okay. I named the Area "bedscare". Also moved it to activate deadbodyb when I look at the area as well.

Is this what the code should look like now? Sorry, still very new to this ><

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
AddTimer(""3"Forcelook");
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}
void Forcelook(string &in asTimer){StartPlayerLookAt("bedscare"1010"");      AddTimer(""1"ActivateScare");}
void ActivateScare(string &in asTimer){    SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("deadbodyc"true);
    
SetLightVisible("redlighta"true);
    
SetLightVisible("redlightb"true);
    
SetLightVisible("redlight"true); 
      
AddTimer(""2"ScareOver");}
void ScareOver(string &in asTimer){////Leave this empty!!StopPlayerLookAt();} 

EDIT: I got this error, so I'm guessing I did something wrong >:

[Image: A4QH]

EDIT2: Lol, I forgot to delete "////Leave this empty!!"

It loaded, testing it now.

EDIT3: Alright, cool. I That got everything to show up (But the two lamps I have, but I think I can manage to make them show up myself.

Now, how do I make them disappear after a few seconds? Furthermore, is there a way to add kind of a panicked noise in the players character? Almost as if the player sees it, then the main character (David, in this case), pants or something? Also, I would like for the player to lose a little sanity, too.

Sorry if I'm asking 200,000,000 questions. I'm taking the time to ask as many questions as I can now, so I can learn all that I really want to ><


ADD THESE INSIDE "void ScareOver"
SetEntityActive("deadbodyb", false);
SetEntityActive("deadbodyc", false);
SetLightVisible("redlighta", false);
SetLightVisible("redlightb", false);
SetLightVisible("redlight", false);

You can also change the time when the scare ends, by changing the number value of AddTimer("", 2, "ScareOver"); located inside of "void ActivateScare"


Also you can do the paniced voice by browsing the Amnesia sounds folder, and once you have selected the one you want, add this inside "void ActivateScare", note you have to add the .snt file of the same name as the .ogg.
PlaySoundAtEntity("", "YourSelectedSoundFile.snt", "Player", 0, false);

Quote:Almost as if the player sees it, then the main character (David, in this case), pants or something?
Didn't understand what you're trying to say here.

Quote:Also, I would like for the player to lose a little sanity, too.
GiveSanityDamage(float afAmount, bool abUseEffect);


afAmount - amount of sanity damage done (in Numbers, replace the "float afAmount" with the number value you want to deal damage to sanity, without quotes)
abUseEffect - determines whether an effect is played when the sanity damage is dealt (= if you want to use some kind of effect. Replace the "bool abUseEffect" with either "true" or "false", without quotes aswell. )
(This post was last modified: 06-10-2012, 11:58 PM by Ermu.)
06-10-2012, 11:49 PM
Find
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#9
RE: Not sure if this is possible, but I want to ask anyways

Alright, so I got this now:

[Image: A6UY]

Script:

PHP Code: (Select All)
void OnStart()
{
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
    
AddUseItemCallback("""MasterRoomKey""MasterRoomDoor""unlock_door"true);
}

void func_shelf(string &in asEntityint alState)
{
    if (
alState == 1)
{
AddTimer(""3"Forcelook");
    
SetSwingDoorClosed("MasterRoomDoor"truetrue);
    
SetLampLit("light1room2"falsetrue);
    
SetLampLit("light2room2"falsetrue);
    
SetLampLit("light3room2"falsetrue);
    
SetLampLit("light4room2"falsetrue);
    
SetLampLit("light5room2"falsetrue);
    
SetLampLit("light6room2"falsetrue);
    
SetLampLit("light7room2"falsetrue);
    
SetLampLit("light8room2"falsetrue);
    
SetLampLit("light9room2"falsetrue);
    
SetLampLit("light1hall1"falsetrue);
    
SetLampLit("light2hall1"falsetrue);
    
SetLampLit("light3hall1"falsetrue);
    
SetLampLit("light4hall1"falsetrue);
    
SetLampLit("light5hall1"falsetrue);
    
SetLampLit("light6hall1"falsetrue);
    
SetLampLit("light7hall1"falsetrue);
    
SetLampLit("light8hall1"falsetrue);
    
SetLampLit("light1room1"falsetrue);
    
SetLampLit("light2room1"falsetrue);
    
SetLampLit("light3room1"falsetrue);
    
SetLampLit("light4room1"falsetrue);
    
SetLampLit("light5room1"falsetrue);
    
SetLampLit("light6room1"falsetrue);
    
SetLampLit("light7room1"falsetrue);
    
SetLampLit("light8room1"falsetrue);
    
SetLightVisible("point1room2"false);
    
SetLightVisible("point2room2"false);
    
SetLightVisible("point3room2"false);
    
SetLightVisible("point4room2"false);
    
SetLightVisible("point5room2"false);
    
SetLightVisible("point6room2"false);
    
SetLightVisible("point7room2"false);
    
SetLightVisible("point8room2"false);
    
SetLightVisible("point9room2"false);
    
SetLightVisible("point1hall1"false);
    
SetLightVisible("point2hall1"false);
    
SetLightVisible("point3hall1"false);
    
SetLightVisible("point4hall1"false);
    
SetLightVisible("point5hall1"false);
    
SetLightVisible("point6hall1"false);
    
SetLightVisible("point7hall1"false);
    
SetLightVisible("point8hall1"false);
    
SetLightVisible("point1room1"false);
    
SetLightVisible("point2room1"false);
    
SetLightVisible("point3room1"false);
    
SetLightVisible("point4room1"false);
    
SetLightVisible("point5room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point6room1"false);
    
SetLightVisible("point8room1"false);
    
SetMoveObjectState("shelf"1.0f);
    
SetEntityActive("hallwaypoofer"true);
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_4"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_7"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("hallwaypoofer""PathNodeArea_9"2"");
    
PlaySoundAtEntity("""quest_completed.snt""rotatearea"0false);
        return;
    }
}
void Forcelook(string &in asTimer){StartPlayerLookAt("bedscare"1010"");      AddTimer(""1"ActivateScare");}
void ActivateScare(string &in asTimer){    SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("deadbodyc"true);
    
SetLightVisible("redlighta"true);
    
SetLightVisible("redlightb"true);
    
SetLightVisible("redlight"true); 
    
GiveSanityDamage(40bool true);
    
SetSoundAtEntity("""react_breath1.snt""Player"0false);
      
AddTimer(""2"ScareOver");}
void ScareOver(string &in asTimer){StopPlayerLookAt();} 
    
SetEntityActive("deadbodya"false);
    
SetEntityActive("deadbodyb"false);
    
SetEntityActive("deadbodyc"false);
    
SetLightVisible("redlight"false);
    
SetLightvisible("redlightb"false); 

Okay, so I got the above problem fixed, by removing "}" after "void ScareOver(string &in asTimer){StopPlayerLookAt();}", and by instead putting it at the end of "SetLightvisible("redlightb", false);"

So now the code looks like:

PHP Code: (Select All)
void Forcelook(string &in asTimer){StartPlayerLookAt("bedscare"1010"");      AddTimer(""1"ActivateScare");}
void ActivateScare(string &in asTimer){    SetEntityActive("deadbodya"true);
    
SetEntityActive("deadbodyb"true);
    
SetEntityActive("deadbodyc"true);
    
SetLightVisible("redlighta"true);
    
SetLightVisible("redlightb"true);
    
SetLightVisible("redlight"true); 
    
GiveSanityDamage(40bool true);
    
SetSoundAtEntity("""react_breath1.snt""Player"0false);
      
AddTimer(""2"ScareOver");}
void ScareOver(string &in asTimer){StopPlayerLookAt();
    
SetEntityActive("deadbodya"false);
    
SetEntityActive("deadbodyb"false);
    
SetEntityActive("deadbodyc"false);
    
SetLightVisible("redlight"false);
    
SetLightvisible("redlightb"false);} 


However, now I'm getting THIS error, and I can't figure it out.

[Image: A7un]
(This post was last modified: 06-11-2012, 01:57 AM by Ananaias.)
06-11-2012, 01:00 AM
Find
Ananaias Offline
Junior Member

Posts: 20
Threads: 7
Joined: Jun 2012
Reputation: 0
#10
RE: Not sure if this is possible, but I want to ask anyways

Fixed the sound issue. Now it's just:

[Image: A7DL]

EDIT: Wow, I'm an idiot.

Alright, that got it working, but now for some reason, the sound isn't playing at all. Gonna see if I can get that working now. Will post again here if I can't figure it out.

EDIT2:

Alright, I tried a few things I found on Google, and nothing worked. Every time I tried "SetSoundAtEntity", I got an error. Here's what I have right now:

PlaySoundAtEntity("", "react_breath.snt", "bed_nice_2", 1, false);

Nothing plays. What do?

EDIT3: Just remembered that the SetSoundAtEntity originally had "SetSoundAtEntity("". "reacht_breath.snt", "Player", 0, false);

Going to try out:

PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);

Alright, that worked. Awesome. However, it's REALLY quiet. Is there a way to make it a little louder?
(This post was last modified: 06-11-2012, 02:22 AM by Ananaias.)
06-11-2012, 02:07 AM
Find




Users browsing this thread: 1 Guest(s)