Frictional Games Forum (read-only)
Noob needs 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Noob needs help (/thread-7705.html)

Pages: 1 2


Noob needs help - X4anco - 04-30-2011

Hello, I need to know how to activate an monster when a player collides to on area. Or even better when a player picks something up


RE: Noob needs help - Kyle - 04-30-2011

Collide with area:

Code:
OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}

Pick up item:

Code:
OnStart()
{
SetPlayerInteractCallback("Item", "Function01", true);
}
void Function01(string &in asEntity)
{
SetEntityActive("Monster", true);
}



RE: Noob needs help - X4anco - 04-30-2011

Thank-you I'll try it out now
Could you please tell me how to make monster follow nodes?


RE: Noob needs help - Karai16 - 05-01-2011

(04-30-2011, 12:56 PM)Kyle Wrote: Collide with area:

Code:
OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Function01", true, 1);
}
void Function01(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}

Pick up item:

Code:
OnStart()
{
SetPlayerInteractCallback("Item", "Function01", true);
}
void Function01(string &in asEntity)
{
SetEntityActive("Monster", true);
}

I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.


RE: Noob needs help - Kyle - 05-01-2011

(05-01-2011, 01:42 AM)Karai16 Wrote: I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.

Did you plug it all in?

If you used the first script, does the script area match the one you are using for you custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

If you used the second script, does "Item" have the same name as the name of the item you are using in your custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?


RE: Noob needs help - Karai16 - 05-01-2011

(05-01-2011, 01:50 AM)Kyle Wrote:
(05-01-2011, 01:42 AM)Karai16 Wrote: I do have a question though. I tried using the code you're telling him to use, but it isn't working with me.

Did you plug it all in?

If you used the first script, does the script area match the one you are using for you custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

If you used the second script, does "Item" have the same name as the name of the item you are using in your custom story? Did you replace "Monster" with the name of the monster in you custom story? If yes to both, is the monster in your custom story set to unactive?

yes I did... you see this is my code, if you see anything wrong with it please tell me:

Code:
void OnStart()
{
    AddUseItemCallback("", "RoomKey", "RoomDoor", "UsedKeyOnDoor", true);
    SetPlayerInteractCallback("RoomKey", "Activatebob", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("RoomDoor", false, true);
    PlaySoundAtEntity("", "unlock_door", "RoomDoor", 0, false);
    RemoveItem("RoomKey");
}

void Activatebob(string &in asEntity)
{
setEntityActive("Bob", true);
}
and yes, I'm sure I named my servant Bob. Also, to help, I'll give you the error it's giving me.
[Image: Error.png]


RE: Noob needs help - HumiliatioN - 05-01-2011

Yep, i have same problem:


void OnStart()
{
SetPlayerLampOil(0);
//if(ScriptDebugOn())
//{
// GiveItemFromFile("lantern", "lantern.ent");
// for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
// SetPlayerLampOil(0);
//}
SetMessage("Journal", "start", 8.0f);;
SetEntityConnectionStateChangeCallback("lever_nice01_1", "StateChangeLever");
SetPlayerInteractCallback("Item", "Officekey", true);
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("Player", "Brute_1", "Brute1", true, 1);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddEntityCollideCallback("Player", "shake_1", "Earthquake", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights", "KillLights", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights2", "KillLights2", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "Stuff", true);
}

void Officekey(string &in asEntity)
{
SetEntityActive("Brute2", true);
}

Says multiple errors!! Sad


RE: Noob needs help - Kyle - 05-01-2011

It might take a while, and I kind of messed up there. I can fix that. Here, try this:

Code:
void OnStart()
{
SetPlayerLampOil(0);
if (ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
SetPlayerLampOil(100);
}
SetMessage("Journal", "start", 8.0f);
SetEntityConnectionStateChangeCallback("lever_nice01_1", "StateChangeLever");
SetPlayerInteractCallback("Item", "Officekey", true);
AddUseItemCallback("", "crowbar_1", "prison_section_1", "UserCrowbarOnDoor", true);
SetPlayerInteractCallback("Item", "Officekey", true);
AddEntityCollideCallback("Player", "Brute_1", "Brute1", true, 1);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddEntityCollideCallback("Player", "shake_1", "Earthquake", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights", "KillLights", true, 1);
AddEntityCollideCallback("Player", "AreaKillLights2", "KillLights2", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "stuff", true);
}
void Officekey(string &in asEntity)
{
SetEntityActive("Brute2", true);
}



RE: Noob needs help - HumiliatioN - 05-01-2011

(05-01-2011, 03:16 PM)Kyle Wrote: It might take a while, and I kind of messed up there. I can fix that. Here, try this:

[code]
void OnStart()
{
if (ScriptDebugOn())
{

}

What? I remove these two marks but it doesnt work!


RE: Noob needs help - Kyle - 05-01-2011

(05-01-2011, 03:20 PM)HumiliatioN Wrote:
(05-01-2011, 03:16 PM)Kyle Wrote: It might take a while, and I kind of messed up there. I can fix that. Here, try this:

[code]
void OnStart()
{
if (ScriptDebugOn())
{

}

What? I remove these two marks but it doesnt work!

Sorry, the thing was that I didn't mean to press the post button and so it posted that little amount.