Frictional Games Forum (read-only)
I need help with scripting! SCRIPT INSIDE - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: I need help with scripting! SCRIPT INSIDE (/thread-7560.html)



I need help with scripting! SCRIPT INSIDE - flamez3 - 04-22-2011

Hello, ive been working hours for this to work, and well im no awesome programmer. Here's what i want to do?

I want player to walk to a script area, named "ScriptArea_1". when the player walk in the area, i wanted a monster to spawn behind player, and make the camera on the monster for 1.5 seconds. the monster i wish to be behind him is "servant_grunt_2" (02 for being another one in the level) i have no idea how to do this, i have looked on google and youtube and all the tutorials for triggering are on making doors shut behind people and not the things i want, now i hope anyone could help me with this delima, i have worked on it for hours with no possible solution in the near future, i would really appreciate any help i can get.

Thanks
Please People! I need help!


I ADDED MORE STUFF IN, THIS IS THE WHOLE SCRIPT

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt_2" , true);
}
AddUseItemCallback("""R01_Key1", "cabinet_metal_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cabinet_metal_1", false, true);
}

im making the cabnit closed and locked. im making it open with a key on a table(odley enough) and it doesnt seem to be working, this keeps stuffing up : AddUseItemCallback("""R01_Key1", "cabinet_metal_1", "KeyOnDoor", true); JUST AFTER THE ADDUSEITEMCALLBACK thing it says theres a expected identifier, but i don't know to put one in.


RE: I need help with scripting! - Dalroc - 04-22-2011

Instead of wasting hours trying to figure it out you could've just checked the STICKIED topic at the TOP OF THE FORUMS, named SCRIPTS RECOLLECTION.

That way you would have EXACTLY what you are looking for.


RE: I need help with scripting! - flamez3 - 04-22-2011

well, Mabey i dont know what monsterfunc1 is, string &in asChild, int alState,AddEntityCollideCallback. I have no idea, " im no awesome programmer"read please
right now i have this script


////////////////////////////
// Run first time starting map

AddEntityCollideCallback ("Player", "ScriptArea_1", "MonsterFunc1", true, 1);

void MonsterFunc1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
}

the bold part is comming up with a error, Expected identifier.
Anyway, any help?


RE: I need help with scripting! SCRIPT INSIDE - Tottel - 04-22-2011

http://www.frictionalgames.com/forum/thread-5117.html

The 2nd spoiler. No offence, but learn to read.


RE: I need help with scripting! SCRIPT INSIDE - flamez3 - 04-22-2011

...i have done that, as stated in the reply above, i dont know what monsterfunc1 is, string &in asChild, int alState,AddEntityCollideCallback. so i have asked you people to help me with that.


RE: I need help with scripting! SCRIPT INSIDE - Tottel - 04-22-2011

If you actually read that post, then you would have seen

AddEntityCollideCallback ("Player", "ScriptArea_1", "MonsterFunc1", true, 1);

is placed inside the Onstart() function.
And MonsterFunc1 is the name of a function. The name does not matter at all, as long as it's clear to the scripter.

Now, what happens is this: You add a colideCallback, which triggers when the player walks into a ScriptArea (ScriptArea_1 in the level editor). When that happens, the function is triggered. In this case, when you walk into an area, a Grunt goes active.


RE: I need help with scripting! SCRIPT INSIDE - flamez3 - 04-22-2011

I actually thank you for trying, but im going over other things, because i got so many problems, and its a night, (im scaring myself)
(04-22-2011, 11:50 AM)Tottel Wrote: If you actually read that post, then you would have seen

AddEntityCollideCallback ("Player", "ScriptArea_1", "MonsterFunc1", true, 1);

is placed inside the Onstart() function.
And MonsterFunc1 is the name of a function. The name does not matter at all, as long as it's clear to the scripter.

Now, what happens is this: You add a colideCallback, which triggers when the player walks into a ScriptArea (ScriptArea_1 in the level editor). When that happens, the function is triggered. In this case, when you walk into an area, a Grunt goes active.

actually i do need your help,
i keep getting this message and i don't know what?

AddUseItemCallback("""R01_Key1", "cabinet_metal_1", "KeyOnDoor", true);

Just after the ADDUSEITEMCALLBACK there is a expected identifier, i have deleted the brackets and added them, it doesn't say anywhere in the tut?


RE: I need help with scripting! SCRIPT INSIDE - Robby - 04-22-2011

There's something wrong with "AddUseItemCallback". That should be like this:
Code:
AddUseItemCallback("", "R01_Key1", "cabinet_metal_1", "KeyOnDoor", true);

At least that is what I see wrong with AddUseItemCallback.