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
Can you re-enable areas once used?
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#1
Can you re-enable areas once used?

Example:
There is a room where the player walks into, the door behind them closes as they enter via a script, but then don't collect the item from the room and has to come back to it. Is it possible to have the area reset and have it activate again when the player passes through it in an event that happens later in the level on the way to the end of the level?

I... think that's clear.
(This post was last modified: 03-10-2012, 09:36 PM by Nevicar.)
03-09-2012, 08:01 AM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#2
RE: Can you re-enable areas once used?

void OnStart()
{

AddEntityCollideCallback(" ", "Script Area", "callback1", true, 1);

AddEntityCollideCallback(" ", "
Script Area ", "callback2", true, 1);

}


void
callback1(string &in asParent, string &in asChild, int alState)


{
SetSwingDoorClosed("door2", true, true);

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

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}




void callback2(string &in asParent, string &in asChild, int alState)

{
SetSwingDoorClosed("door2", true, true);

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

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

try that dude Smile
and you that If(Haveitem) bla bla bla or how that script is

http://wiki.frictionalgames.com/hpl2/amn...unds_music

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 03-09-2012, 08:25 AM by jessehmusic.)
03-09-2012, 08:18 AM
Website Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#3
RE: Can you re-enable areas once used?

(03-09-2012, 08:01 AM)Nevicar Wrote: Example:
There is a room where the player walks into, the door behind them closes as they enter via a script, but then don't collect the item from the room and has to come back to it. Is it possible to have the area reset and have it activate again when the player passes through it in an event that happens later in the level on the way to the end of the level?

I... think that's clear.
In the callback, change the "true" to "false". Like:

AddEntityCollideCallback(" ", "Script Area", "callback1", false, 1);


03-09-2012, 08:23 AM
Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#4
RE: Can you re-enable areas once used?

The easiest answer is always the right one... ugh.

Thanks!
03-09-2012, 08:30 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#5
RE: Can you re-enable areas once used?

np ^^

03-09-2012, 08:34 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Can you re-enable areas once used?

Also, script areas are considered "entities" for the SetEntityActive function.

Tutorials: From Noob to Pro
(This post was last modified: 03-09-2012, 08:37 AM by Your Computer.)
03-09-2012, 08:35 AM
Website Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#7
RE: Can you re-enable areas once used?

Alright, it's not all fixed, I tried to venture into the valley of if statements and constructed this.

AddEntityCollideCallback("Player", "Area_7", "fdoorclose_func1", true, 1);

void fdoorclose_func1(string &in asParent, string &in asChild, int alState)
{
if (HasItem("key1")) SetEntityActive("Area_6", false);
else SetEntityActive("Area_6", true);
}

Basically a character walks out of the room and through an area to check if he has the key, if he doesn't have it then the area should be activated, but it doesn't get activated so obviously what I'm doing is wrong. Any ideas?
(This post was last modified: 03-09-2012, 08:54 AM by Nevicar.)
03-09-2012, 08:54 AM
Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#8
RE: Can you re-enable areas once used?

Anyone have any idears?
03-09-2012, 09:13 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Can you re-enable areas once used?

(03-09-2012, 08:54 AM)Nevicar Wrote: Any ideas?

For starters, you need to think things through before engaging in scripting. Do you want the collision callback to be removed when colliding with Area_7? Is Area_6 in the same map? What state do you want Area_6 to be in before the player collides with Area_7? What is the purpose of Area_6 when active?

Tutorials: From Noob to Pro
03-09-2012, 09:22 PM
Website Find
Nevicar Offline
Junior Member

Posts: 37
Threads: 4
Joined: Mar 2012
Reputation: 0
#10
RE: Can you re-enable areas once used?

Basically right now I have the area set to inactive. I have two sets of areas that are both right next to each (Area_4 and Area_6) other that do the same thing, close the door.

This is the best way I can sum up the way I want it to work, and the way I thought it through while attempting to code it:

1) Player enters the room, Area_4, and the door closes behind him, that function is gone and used.

2)The player then leaves the room without collecting the key which does not activate (Area_3) the other area in the room to use that when the player passes inside of it, making the door close worthless.

3) The player leaves the room and then collides with Area_7 and this area is supposed to check the player for the key and if he has it Area_6 stays inactive, but if he doesn't it becomes active.

Hope that didn't sound snobby and pretentious in the way I worded it out, I appreciate the help and know that I do need to think things through before delving into coding it all.
(This post was last modified: 03-09-2012, 09:55 PM by Nevicar.)
03-09-2012, 09:44 PM
Find




Users browsing this thread: 1 Guest(s)