Frictional Games Forum (read-only)
Amnesia script help! - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Amnesia script help! (/thread-24898.html)

Pages: 1 2 3 4


RE: Amnesia script help! - Traggey - 08-24-2013

Wrong section, AGAIN.


Amnesia script help! - theodorg - 03-21-2014

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]


RE: Amnesia script help! - Daemian - 03-21-2014

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.


RE: Amnesia script help! - Mudbill - 03-21-2014

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.


RE: Amnesia script help! - plutomaniac - 03-21-2014

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.


RE: Amnesia script help! - theodorg - 03-21-2014

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



RE: Amnesia script help! - Mudbill - 03-21-2014

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


RE: Amnesia script help! - theodorg - 03-21-2014

(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.


RE: Amnesia script help! - Vale - 03-22-2014

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


RE: Amnesia script help! - Mudbill - 03-22-2014

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