Frictional Games Forum (read-only)
Scripting, need urgent 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: Scripting, need urgent help! (/thread-9259.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


Scripting, need urgent help! - JetlinerX - 07-20-2011

Hello everyone!

I have a quick few questions to you scripting geniuses out there:

1. I got a key to unlock a door, and all that is good, but how do I make a key in another map, open a key in another map? For instance: You find a key in the cellar, then go through the level transfer door OUT OF THE cellar and into the Foyer. You use the key on the level transfer door in the foyer to the upstairs. Does that make since?

2. How do I work enemies?


RE: Scripting, need urgent help! - xtron - 07-20-2011

Question 1 @ You need to fix a globalvar I believe. Search on the wiki or google because I don't know how to fix the globalvars.

Question 2 @ what do you mean?. How to make a monster spawn?


RE: Scripting, need urgent help! - JetlinerX - 07-20-2011

1. Okay, I will look into that.

2. How do I make them spawn yes, and will they automatically search for the player, or will my map maker need to make a path and tell him what to do?


RE: Scripting, need urgent help! - xtron - 07-20-2011

you could add this function to your script to easily make the monster active/deactivated
Code:
SetEntityActive("MonsterName", true);
Change MonsterName to your monstername or any entity you want to become active/deactivated.
true = set the entity active
false = deactivate the entity


This code will make the monster auto spot the Player and run towards him
Code:
ShowEnemyPlayerPosition("MonsterName");



RE: Scripting, need urgent help! - MrCookieh - 07-20-2011

1. Like xtron said, you need global variables.
(you can use global variables for all maps of your custom story's maps. local variables are only used in the specific map, and can't be called by other maps)

2. At first you have to place your monster. If you want it only appear when a player does something, then you have to set it inactive.
Via Script, use the SetEntityActive("MonsterName", true); like xtron said.
then you have two options:
1. Create pathnodes. If you want that your monster follows a path, you have to place those (in the area tab). Then use the function AddEnemyPatrolNode("monstername", "pathnodename", how long he waits with a float, "animation (you can leave this empty)");
2. ShowEnemyPlayerPosition("MonsterName"); But be careful with this. Many people already said, that the Monster AI is like sh*t, and if there's a wall between you and the monster, he will get stuck/run against the wall.


RE: Scripting, need urgent help! - JetlinerX - 07-20-2011

1. Awesome! Thanks guys! I got the monster working pretty well now, one last question with him. How can I made him inactive, until the player picks up the key, then he beats down a door?

2. Can someone elaborate a little bit on these "global variables?"


RE: Scripting, need urgent help! - MrCookieh - 07-20-2011

1. You can do that in the editor. just click at him, and there should be a small box under his name 'Active'. Uncheck it, now he's inactive. Smile

2. here a simple example: You make a global string type variable. Let's call it x.
Now you can set x = "test" in level 1. When you are in level 2 now, it has the saved value. In this case, test.
If you want to know how it works, look at the amnesia wiki at script tutorials.


RE: Scripting, need urgent help! - JetlinerX - 07-20-2011

1. So he will beat down the door when the player picks up the key if I just make him active? (Sorry, first time scripting)

2. Ehhhhhmmm.... I dont get it... lol, sorry. Like I said, first time scripting, so the Amnesia Wiki is still pretty confusing its self too Sad

3. Sorry if I am annoying you guys asking all these questions that are on the Wiki, it just helps me when I hear other explanations from people who were in my shoes at one point.


RE: Scripting, need urgent help! - JetlinerX - 07-21-2011

Got the monster working! But still dont know how to make him beat down a door when the key is picked up. Sad


RE: Scripting, need urgent help! - JenniferOrange - 07-21-2011

At first I had no idea how to make a monster beat down the door when a key was picked up either, but for the sake of Frictional Games, I decided to test and came up with a solution that works! Big Grin I might just post a tutorial thread. o.o