Frictional Games Forum (read-only)
DONE - script not working pls 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: DONE - script not working pls help (/thread-23178.html)



DONE - script not working pls help - boghinovel - 09-15-2013

ok guys i know i'm doing something bad but i don't know wath
i made a custom map just for test pls help me Confused
the name of spawns are those:

spawn_enemy_1
enemy_1
path_node_1

and this is my file with other stuf in it that works fine

Code:
void OnStart()
    {
        GiveItemFromFile("lantern", "lantern.ent");SetPlayerLampOil(100.0f);

        for(int i = 0;i < 30;i++)

        GiveItemFromFile("tinderbox", "tinderbox.ent");

        AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
        AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);

        AddEntityCollideCallback("Player", "spawn_enemy_1", "enemy_1", true, 1);
        AddEntityCollideCallback("enemy_1","stop","CollideStop",true,1);

        FadeOut(0.0f);

        AddTimer("internal.timer.id", 5.0f, "MyFunc");
    }



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

        PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.0f, true);
        PlaySoundAtEntity("", "unlock_door.snt", "door2", 0.0f, true);
    }



void monster(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",true);
        AddEnemyPatrolNode("enemy_1","path_node_1",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_2",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_3",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_4",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_5",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_6",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_7",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_8",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_9",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_10",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_11",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_12",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_13",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_14",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_15",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_16",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_17",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_18",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_19",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_20",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_21",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_22",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_23",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_24",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_25",0,"");
    }



void CollideStop(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",false);
    }



void MyFunc(string &in timerID)
    {
        FadeIn(5.0f);
    }









void OnEnter()
{
}

void OnLeave()
{
}



RE: script not working pls help - Neelke - 09-15-2013

I'm pretty sure you can't put SetPlayerLampOil there. Move it under the GiveItemFromFile script. Like this:

GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

Also you don't really need the setplayerlampoil. It is already full when you start the game.

If that is not the problem, try to put the GiveItemFromFile with tinderboxes like this instead:

for(int i = 0;i < 30;i++) GiveItemFromFile("tinderbox", "tinderbox.ent");

Everything else seems to be just fine. If these are not the issues, I have no idea.


RE: script not working pls help - boghinovel - 09-15-2013

(09-15-2013, 01:54 PM)Neelke Wrote: I'm pretty sure you can't put SetPlayerLampOil there. Move it under the GiveItemFromFile script. Like this:

GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

Also you don't really need the setplayerlampoil. It is already full when you start the game.

If that is not the problem, try to put the GiveItemFromFile with tinderboxes like this instead:

for(int i = 0;i < 30;i++) GiveItemFromFile("tinderbox", "tinderbox.ent");

Everything else seems to be just fine. If these are not the issues, I have no idea.

ok so i have done wath you sayd but the monster is not spawning when i go to area script
when in game to spawn_enemy_1 area script, nothing hapens
it supose to spawn enemy_1 wich is a grunt deactivated and supose to folow the path_node_1,2,3 . . .
so wath is bad here coz i don't get it Huh

Code:
void OnStart()
    {
        GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(100.0f);

        for(int i = 0;i < 30;i++) GiveItemFromFile("tinderbox", "tinderbox.ent");

        AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
        AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);

        AddEntityCollideCallback("Player", "spawn_enemy_1", "enemy_1", true, 1);
        AddEntityCollideCallback("enemy_1","stop","CollideStop",true,1);

        FadeOut(0.0f);

        AddTimer("internal.timer.id", 5.0f, "MyFunc");
    }



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

        PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.0f, true);
        PlaySoundAtEntity("", "unlock_door.snt", "door2", 0.0f, true);
    }



void monster(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",true);
        AddEnemyPatrolNode("enemy_1","path_node_1",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_2",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_3",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_4",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_5",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_6",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_7",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_8",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_9",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_10",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_11",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_12",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_13",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_14",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_15",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_16",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_17",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_18",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_19",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_20",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_21",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_22",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_23",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_24",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_25",0,"");
    }



void CollideStop(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",false);
    }



void MyFunc(string &in timerID)
    {
        FadeIn(5.0f);
    }









void OnEnter()
{
}

void OnLeave()
{
}



RE: script not working pls help - PutraenusAlivius - 09-15-2013

PHP Code:
AddEntityCollideCallback("Player""spawn_enemy_1""enemy_1"true1); 
Your parameter on calling the enemy.

PHP Code:
void monster(string &in asParentstring &in asChildint alState)
{
 
SetEntityActive("enemy_1",true);
AddEnemyPatrolNode("enemy_1","path_node_1",0,"");
AddEnemyPatrolNode("enemy_1","path_node_2",0,"");
AddEnemyPatrolNode("enemy_1","path_node_3",0,"");
AddEnemyPatrolNode("enemy_1","path_node_4",0,"");
AddEnemyPatrolNode("enemy_1","path_node_5",0,"");
AddEnemyPatrolNode("enemy_1","path_node_6",0,"");
AddEnemyPatrolNode("enemy_1","path_node_7",0,"");
AddEnemyPatrolNode("enemy_1","path_node_8",0,"");
AddEnemyPatrolNode("enemy_1","path_node_9",0,"");
AddEnemyPatrolNode("enemy_1","path_node_10",0,"");
AddEnemyPatrolNode("enemy_1","path_node_11",0,"");
AddEnemyPatrolNode("enemy_1","path_node_12",0,"");
AddEnemyPatrolNode("enemy_1","path_node_13",0,"");
AddEnemyPatrolNode("enemy_1","path_node_14",0,"");
AddEnemyPatrolNode("enemy_1","path_node_15",0,""); AddEnemyPatrolNode("enemy_1","path_node_16",0,"");
AddEnemyPatrolNode("enemy_1","path_node_17",0,"");
AddEnemyPatrolNode("enemy_1","path_node_18",0,"");
AddEnemyPatrolNode("enemy_1","path_node_19",0,"");
AddEnemyPatrolNode("enemy_1","path_node_20",0,"");
AddEnemyPatrolNode("enemy_1","path_node_21",0,"");
AddEnemyPatrolNode("enemy_1","path_node_22",0,"");
AddEnemyPatrolNode("enemy_1","path_node_23",0,"");
AddEnemyPatrolNode("enemy_1","path_node_24",0,"");
AddEnemyPatrolNode("enemy_1","path_node_25",0,"");


See a difference? No, well here's your mistake. The function's name in the function and parameter is different. The function has Monster but the parameter has enemy_1.

Make it the same.


RE: script not working pls help - boghinovel - 09-15-2013

ok here it is i have tested and damn is not working, the monster is not spawning ufffAngry[/size]
Code:
void OnStart()
    {
        GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(100.0f);

        for(int i = 0;i < 30;i++) GiveItemFromFile("tinderbox", "tinderbox.ent");

        AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
        AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);

        AddEntityCollideCallback("Player", "spawn_enemy_1", "active_enemy", true, 1);
        AddEntityCollideCallback("enemy_1","stop","CollideStop",true,1);

        FadeOut(0.0f);

        AddTimer("internal.timer.id", 5.0f, "MyFunc");
    }



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

        PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.0f, true);
        PlaySoundAtEntity("", "unlock_door.snt", "door2", 0.0f, true);
    }



void active_enemy(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",true);
        AddEnemyPatrolNode("enemy_1","path_node_1",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_2",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_3",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_4",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_5",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_6",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_7",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_8",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_9",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_10",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_11",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_12",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_13",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_14",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_15",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_16",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_17",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_18",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_19",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_20",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_21",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_22",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_23",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_24",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_25",0,"");
    }



void CollideStop(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",false);
    }



void MyFunc(string &in timerID)
    {
        FadeIn(5.0f);
    }









void OnEnter()
{
}

void OnLeave()
{
}



RE: script not working pls help - PutraenusAlivius - 09-15-2013

(09-15-2013, 02:33 PM)boghinovel Wrote: ok here it is i have tested and damn is not working, the monster is not spawning ufffAngry[/size]
Code:
void OnStart()
    {
        GiveItemFromFile("lantern", "lantern.ent");
        SetPlayerLampOil(100.0f);

        for(int i = 0;i < 30;i++) GiveItemFromFile("tinderbox", "tinderbox.ent");

        AddUseItemCallback("", "key1", "door1", "KeyOnDoor", true);
        AddUseItemCallback("", "key2", "door2", "KeyOnDoor", true);

        AddEntityCollideCallback("Player", "spawn_enemy_1", "active_enemy", true, 1);
        AddEntityCollideCallback("enemy_1","stop","CollideStop",true,1);

        FadeOut(0.0f);

        AddTimer("internal.timer.id", 5.0f, "MyFunc");
    }



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

        PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.0f, true);
        PlaySoundAtEntity("", "unlock_door.snt", "door2", 0.0f, true);
    }



void active_enemy(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",true);
        AddEnemyPatrolNode("enemy_1","path_node_1",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_2",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_3",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_4",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_5",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_6",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_7",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_8",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_9",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_10",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_11",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_12",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_13",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_14",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_15",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_16",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_17",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_18",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_19",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_20",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_21",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_22",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_23",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_24",0,"");
        AddEnemyPatrolNode("enemy_1","path_node_25",0,"");
    }



void CollideStop(string &in asParent, string &in asChild, int alState)
    {
        SetEntityActive("enemy_1",false);
    }



void MyFunc(string &in timerID)
    {
        FadeIn(5.0f);
    }









void OnEnter()
{
}

void OnLeave()
{
}

You probably named something wrong/didn't save in the Level Editor.

Or, the monster DOES spawn, but doesn't follow the pathnodes.


RE: script not working pls help - boghinovel - 09-15-2013

ok so it was this
enemy_1 = ennemy_1
damn mistake
thanx for helping me guys