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
Collapse area not working?
KeysOfMyMind Offline
Junior Member

Posts: 15
Threads: 1
Joined: Jan 2012
Reputation: 0
#1
Collapse area not working?

So I have an area setup called push
And an area called collapsearea

I want collapsearea to be set to active when I collide with the area called push.

The push are will throw the player into the "collapsearea".
Once the player collides with this area it drains 60 percent of his health and drains all of his sanity normally making him collapse.

for some reason it doesn't work.

=======================================================
Specific scare talked about:


void OnStart()

{
AddEntityCollideCallback("Player", "Push", "Push", true, 1);
AddEntityCollideCallback("Player", "collapsearea", "collapsearea", true, 1);
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Door_Slam", "react_pant.snt", "Push", 0, false);
SetEntityActive("collapsearea", false);
AddPlayerBodyForce(-8000000, 0, 0, false);
}

void collapsearea(string &in asParent, string &in asChild, int alState)
{
SetPlayerSanity(0);
SetPlayerHealth(45);
CreateParticleSystemAtEntity("doorbash", "ps_dust_impact.ps", "collapsearea", false);
PlaySoundAtEntity("", "scare_slam_door.snt", "collapsearea", 0, false);
}

=======================================================
Full script:

void OnStart()

{
AddUseItemCallback("", "crowbar_1", "mansiondoor1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_2", "CollideAreaBreakDoor", true, 1);
AddEntityCollideCallback("Player", "Push", "Push", true, 1);
AddEntityCollideCallback("Player", "Door_Slam", "Slam", true, 1);
AddEntityCollideCallback("Player", "SlamStart", "SlamStart", true, 1);
AddEntityCollideCallback("Player", "BlowOpenEnd", "BlowOpenEnd", true, 1);
AddEntityCollideCallback("Player", "pianostop", "pianostop", true, 1);
AddEntityCollideCallback("Player", "collapsearea", "collapsearea", true, 1);
AddTimer("pianotimer", 0, "pianotimer");
}



void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03.snt", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}
void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
AddPropImpulse("piano", 0, 0, 100, "world");
SetLeverStuckState("piano", -1, true);
PlaySoundAtEntity("piano", "break_wood.snt", "piano", 0, false);
CreateParticleSystemAtEntity("piano", "ps_dust_impact.ps", "impact", false);
}


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);
}

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Door_Slam", "react_pant.snt", "Push", 0, false);
SetEntityActive("collapsearea", false);
AddPlayerBodyForce(-8000000, 0, 0, false);
}

void Slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansiondoor13", true, true);
SetSwingDoorLocked("mansiondoor13", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("", "10_close_door.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","break_wood.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","sanity_flick.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","scare_slam_door.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","insanity_imageflash01.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","insanity_muffled_steps.snt", "Door_Slam", 0, false);
PlaySoundAtEntity("","scare_slam_door.snt", "Door_Slam", 0, false);
}
void SlamStart(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansiondoorstart", true, true);
SetSwingDoorLocked("mansiondoorstart", true, true);
PlaySoundAtEntity("", "00_laugh.snt", "SlamStart", 0, false);
PlaySoundAtEntity("", "10_close_door.snt", "SlamStart", 0, false);
PlaySoundAtEntity("","break_wood.snt", "SlamStart", 0, false);
PlaySoundAtEntity("","break_wood.snt", "SlamStart", 0, false);
PlaySoundAtEntity("","scare_slam_door.snt", "SlamStart", 0, false);
PlaySoundAtEntity("","scare_slam_door.snt", "SlamStart", 0, false);
}

void collapsearea(string &in asParent, string &in asChild, int alState)
{
SetPlayerSanity(0);
SetPlayerHealth(45);
CreateParticleSystemAtEntity("doorbash", "ps_dust_impact.ps", "collapsearea", false);
PlaySoundAtEntity("", "scare_slam_door.snt", "collapsearea", 0, false);
}
(This post was last modified: 03-23-2013, 01:39 PM by KeysOfMyMind.)
03-23-2013, 01:37 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#2
RE: Collapse area not working?

it might be because you are setting the area to be inactive, and it dosen't get active anytime later in your script

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Door_Slam", "react_pant.snt", "Push", 0, false);
SetEntityActive("collapsearea", false);
AddPlayerBodyForce(-8000000, 0, 0, false);
}

CURRENT PROJECT:
A Fathers Secret == Just started
03-23-2013, 01:57 PM
Find
KeysOfMyMind Offline
Junior Member

Posts: 15
Threads: 1
Joined: Jan 2012
Reputation: 0
#3
RE: Collapse area not working?

(03-23-2013, 01:57 PM)ZereboO Wrote: it might be because you are setting the area to be inactive, and it dosen't get active anytime later in your script

void Push(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("Door_Slam", "react_pant.snt", "Push", 0, false);
SetEntityActive("collapsearea", false);
AddPlayerBodyForce(-8000000, 0, 0, false);
}

Thanks works now, how do I use the PlayMusic function?
I can't understand the syntax it's latin to me.
Help please ^^
03-23-2013, 04:08 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#4
RE: Collapse area not working?

here is an PlayMusic example:

PlayMusic("09_amb_safe.ogg", true, 1, 1, 1, true);


09_amb_safe.ogg is the music file to be played

the first true is if the file should loop (play it self again and again)

first "1" is the volume on the music (1 is standard)

second "1" is how many seconds it will take for the music to hit its the max volume

thirth "1" is the priority of the music. Note that only the music with the highest priority can be heard! 0 - lowest, 1 - higher, etc.

the last true means if i use stopmusic, and start the same music again later, it will continue playing where it got cut off.

PlayMusic if mostly used in OnEnter(), so that it plays everytime the player enters the map (background music/ambience in the map)

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 03-23-2013, 04:25 PM by Lizard.)
03-23-2013, 04:21 PM
Find
KeysOfMyMind Offline
Junior Member

Posts: 15
Threads: 1
Joined: Jan 2012
Reputation: 0
#5
RE: Collapse area not working?

(03-23-2013, 04:21 PM)ZereboO Wrote: here is an PlayMusic example:

PlayMusic("09_amb_safe.ogg", true, 1, 1, 1, true);


09_amb_safe.ogg is the music file to be played

the first true is if the file should loop (play it self again and again)

first "1" is the volume on the music (1 is standard)

second "1" is how many seconds it will take for the music to hit its the max volume

thirth "1" is the priority of the music. Note that only the music with the highest priority can be heard! 0 - lowest, 1 - higher, etc.

the last true means if i use stopmusic, and start the same music again later, it will continue playing where it got cut off.

PlayMusic if mostly used in OnEnter(), so that it plays everytime the player enters the map (background music/ambience in the map)

Thank you very much one more thing I would love to know.
Can you delete solids to make a window break.
Put a broken window in the same place, set it inactive and then when you hit an area have the normal window dissappear while at the same time having the broken window be set to active.

I wanna know if it's possible and if it is, what function should I use cause I haven't seen any functions that are solid based I don't think.
(This post was last modified: 03-23-2013, 05:14 PM by KeysOfMyMind.)
03-23-2013, 05:11 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#6
RE: Collapse area not working?

You can break a windows in two ways.

There is both a normal window entity (window02_large_blue / window_large_blue_seethrough)) and a broken window entity(window02_large_blue_Broken) all found in static_objekts mainsionbase

Then braking a window i reqrement to use window_large_blue_seethrough

Set a window02_large_blue_broken and make it inactive, then plase a window02_large_blue at the same plase, then make it so when you throught something at it like a chair or something the two windows change the inactive becomes active and the active becomes inactive, and at some effects to it. But it is quite a work


When you first are learning or starting at scripting i would regrement to just place a mb_window_noglass (which can be found in obstacles) and put a mansionbase_large_window_breakable (which can be found in special) into it. So when anything thats heavy enough contacts the glass it will break

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 03-23-2013, 05:29 PM by Lizard.)
03-23-2013, 05:28 PM
Find
KeysOfMyMind Offline
Junior Member

Posts: 15
Threads: 1
Joined: Jan 2012
Reputation: 0
#7
RE: Collapse area not working?

Can you do it so that solid objects can be removed and replaced as well?
That way you could have hallways where there first where none, stuff like that.

A rooms layout changes completely when you go in it a second time.

That would be epic, I mean like amazingly epic.
03-23-2013, 07:42 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#8
RE: Collapse area not working?

i dont think you can, but im not that much into the static objects, so i cant give you a 100% reliable answer on that one.

CURRENT PROJECT:
A Fathers Secret == Just started
03-23-2013, 11:48 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#9
RE: Collapse area not working?

Static Objects CANNOT be de-activated or activated.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-24-2013, 05:42 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#10
RE: Collapse area not working?

Only entities can be activated/deactivated, so if there is a static object that you would like to activate/deactivate, then you need to use the model editor to make it an entity.

(03-23-2013, 07:42 PM)KeysOfMyMind Wrote: Can you do it so that solid objects can be removed and replaced as well?
That way you could have hallways where there first where none, stuff like that.

A rooms layout changes completely when you go in it a second time.

That would be epic, I mean like amazingly epic.

It would probably be a lot easier to just make it a whole new map instead of converting everything to entities, then activating them and deactivating them.

In Ruins [WIP]
03-24-2013, 08:24 AM
Find




Users browsing this thread: 2 Guest(s)