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
Amnesia script help!
Traggey Offline
is mildly amused

Posts: 3,257
Threads: 74
Joined: Feb 2012
Reputation: 185
#21
RE: Amnesia script help!

Wrong section, AGAIN.
08-24-2013, 02:41 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#22
Amnesia script help!

So Im making an amnesia custom story and at one point you walk down a staircase and a monster spawn in front of you. What you dont know is that its an hallucination. I want to spawn a wall behind you that prevents you from escaping when the monster spawns and then one more script that removes the wall when the hallucination disappears.

This is my current monster spawn script that Im using to spawn the hallucination. This script works what i want help with is spawning the wall! :

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Awesome_key", "Awesome_door", "ABC", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "secret_key", "secret_door", "SECRET", true);
}

void ABC(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "Awesome_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Awesome_door", 0, false);
RemoveItem("Awesome_key");
}

void SECRET(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "secret_door", false, true);
PlaySoundAtEntity("", "unlock_door", "secret_door", 0, false);
RemoveItem("secret_key");
[b][b]}

[b]void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
[/b][/b]
SetEntityActive("servant_grunt_1", true);
}[/b]
(This post was last modified: 03-21-2014, 07:22 PM by theodorg.)
03-21-2014, 07:21 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#23
RE: Amnesia script help!

I would find the piece of wall you want, e.g. mansion_base_wall_default.dae, create an entity with it, and switch between enabled/disabled in-game as required.

03-21-2014, 07:29 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#24
RE: Amnesia script help!

You might be able to use SetPropActiveAndFade on static objects, but I'm not sure. If not, then yes, you need to create an entity for the wall you want to use. You do that by opening the model editor, go File > Import Mesh, find the model in the static_objects folder, add a box shape around the wall, create that shape into the collision body, go Edit > User Defined Variables and set the type to Object, subtype Static. Doing so will allow you to use the SetEntityActive script on the wall itself.

After that, just save that entity in the entities folder (preferrably inside your own custom subfolder), and use it from the level editor.

I've actually got a video on just this if you need a more detailed explanation.

03-21-2014, 08:28 PM
Find
plutomaniac Offline
Super Moderator

Posts: 6,368
Threads: 45
Joined: May 2011
Reputation: 183
#25
RE: Amnesia script help!

The Technical support section is not there for development questions. Moved to correct forum. Also, have one thread for all your development questions and not 5 with the same title. Merged.
(This post was last modified: 03-21-2014, 08:36 PM by plutomaniac.)
03-21-2014, 08:34 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#26
RE: Amnesia script help!

(03-21-2014, 08:28 PM)Mudbill Wrote: You might be able to use SetPropActiveAndFade on static objects, but I'm not sure. If not, then yes, you need to create an entity for the wall you want to use. You do that by opening the model editor, go File > Import Mesh, find the model in the static_objects folder, add a box shape around the wall, create that shape into the collision body, go Edit > User Defined Variables and set the type to Object, subtype Static. Doing so will allow you to use the SetEntityActive script on the wall itself.

After that, just save that entity in the entities folder (preferrably inside your own custom subfolder), and use it from the level editor.

I've actually got a video on just this if you need a more detailed explanation.

I followed you instructions and created an entity. But when i get in to the editor and try to activate it it just dosent show up. Heres the script:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Awesome_key", "Awesome_door", "ABC", true);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "secret_key", "secret_door", "SECRET", true);
}

void ABC(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "Awesome_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Awesome_door", 0, false);
RemoveItem("Awesome_key");
}

void SECRET(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked( "secret_door", false, true);
PlaySoundAtEntity("", "unlock_door", "secret_door", 0, false);
RemoveItem("secret_key");
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
SetEntityActive("popup_wall_1", true);
}
03-21-2014, 10:43 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#27
RE: Amnesia script help!

You mean you get to the game and it doesn't appear? Does the monster appear?

03-21-2014, 11:32 PM
Find
theodorg Offline
Junior Member

Posts: 44
Threads: 11
Joined: Aug 2013
Reputation: 0
#28
RE: Amnesia script help!

(03-21-2014, 11:32 PM)Mudbill Wrote: You mean you get to the game and it doesn't appear? Does the monster appear?

I start the map and everything works fine. The monster spawns but the wall dosen't. The monster and the wall is locked to one function as you can see and that function is locked to an area box. The area box works with the monster but not the wall.
03-21-2014, 11:36 PM
Find
Vale Offline
Member

Posts: 92
Threads: 13
Joined: Mar 2014
Reputation: 7
#29
RE: Amnesia script help!

is the wall static? I understand that you cant regularily activate/deactivate static objects
use model editor, and convert a copy of it to an entity
then replace the version in-game with the .ent for the modded wall
hope this helps
03-22-2014, 12:39 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#30
RE: Amnesia script help!

I believe that's what he did. Well, perhaps my video could help in case you did something wrong.




03-22-2014, 12:43 AM
Find




Users browsing this thread: 6 Guest(s)