Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
monster script setup
Manakind Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#1
monster script setup

hello i was following the wiki guide setting up a monster as im new to scripting i need some help here i think ive made an error somewhere in the script.

void TimerTutorial01(string &in asTimer)
{
SetMessage("Inventory", "CombineLevel12Error", 0);
}

void OnStart()
{
AddTimer("tut01", 5, "TimerTutorial01");

{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);

}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}
void OnEnter()
{

}

void OnLeave()
{

}

this is my whole script thus far and i wanted my monster to spawn from a point and follow path nodes. but every time i start my level he doesnt spawn when i hit my scripted area spot. any ideas as to what im doing wrong? mucho help appriciate
10-03-2011, 09:42 PM
Find
Urkle Offline
FG - Associate

Posts: 1,172
Threads: 31
Joined: Jul 2006
Reputation: 21
#2
RE: monster script setup

I moved this over to the Customstories/modifications thread for Amnesia as the HPL1 forum is for the Opensource Penumbra engine.



Developing away on one of
Multiple Macs running 10.6, 10.7, 10.8, and 10.9.
Linux, 8-core AMD, 8GB RAM, Fedora 18, nVidia 450 1GB
10-03-2011, 09:50 PM
Website Find
Manakind Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#3
RE: monster script setup

bump bump =) still cant figure out where ive gone wrong. would love some help.
10-04-2011, 01:00 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: monster script setup

Wait, the map worked for you without the game exiting with a script error?

Try replacing your code with this:
void TimerTutorial01(string &in asTimer)
{
    SetMessage("Inventory", "CombineLevel12Error", 0);
}

void OnStart()
{
    AddTimer("tut01", 5, "TimerTutorial01");
    GiveItemFromFile("lantern", "lantern.ent");

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

    AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}

void OnEnter()
{

}

void OnLeave()
{

}

Tutorials: From Noob to Pro
10-04-2011, 01:20 PM
Website Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#5
RE: monster script setup

Hi Your Computer, you may remember me from yesterday Smile
I got the same problem with my monster, he just won't spawn.

Script:

void MyFunc(string &in asParent, string &in asChild, int alState)
{
AddEntityCollideCallback("Player", "Sound_5", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "Sound_3", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "Music_1", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}
10-04-2011, 03:24 PM
Find
Manakind Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#6
RE: monster script setup

(10-04-2011, 01:20 PM)Your Computer Wrote: Wait, the map worked for you without the game exiting with a script error?

Try replacing your code with this:
void TimerTutorial01(string &in asTimer)
{
    SetMessage("Inventory", "CombineLevel12Error", 0);
}

void OnStart()
{
    AddTimer("tut01", 5, "TimerTutorial01");
    GiveItemFromFile("lantern", "lantern.ent");

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

    AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}

void OnEnter()
{

}

void OnLeave()
{

}
yep my script works without an error, now ive replaced my script with yours and the same thing is happening my map works but when i goto my designated area my inactive mob doesnt spawn. any suggestions?
(This post was last modified: 10-04-2011, 03:54 PM by Manakind.)
10-04-2011, 03:26 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: monster script setup

I'm going to need you guys to add this function to your script:
MonsterCheck(string &in entity, string &in type)
{
    AddDebugMessage(type, false);
}

Then in the level editor, select your monster and on the right, under the Entity tab, type in MonsterCheck for the CallbackFunc field. Be sure to save.

Also, update the MonsterFunction function so that it looks like this:
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    AddDebugMessage(asChild+" has activated!", false);
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}

Save. Now load your map and make sure show debug messages is enabled in your debug menu. Now activate the area by colliding with it and tell me if you see any text at the bottom left that says either "ScriptArea_1 has activated!" or "OnAutoDisabled" or both.

Tutorials: From Noob to Pro
10-04-2011, 05:34 PM
Website Find
Manakind Offline
Junior Member

Posts: 4
Threads: 1
Joined: Oct 2011
Reputation: 0
#8
RE: monster script setup

(10-04-2011, 05:34 PM)Your Computer Wrote: I'm going to need you guys to add this function to your script:
MonsterCheck(string &in entity, string &in type)
{
    AddDebugMessage(type, false);
}

Then in the level editor, select your monster and on the right, under the Entity tab, type in MonsterCheck for the CallbackFunc field. Be sure to save.

Also, update the MonsterFunction function so that it looks like this:
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    AddDebugMessage(asChild+" has activated!", false);
    SetEntityActive("servant_grunt_1", true);
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
    AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 4, "");
}

Save. Now load your map and make sure show debug messages is enabled in your debug menu. Now activate the area by colliding with it and tell me if you see any text at the bottom left that says either "ScriptArea_1 has activated!" or "OnAutoDisabled" or both.
silly question but how do you activate debug mode? ive tested the map and its not activating for me. would like to check if it says activated or onautodisabled =)
10-04-2011, 07:40 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#9
RE: monster script setup

Same question as above. activate debug?

Tried to run the map. Gave me the error message: main(25,13): ERR : Expected identifier
10-04-2011, 07:51 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: monster script setup

If you follow the steps written here, specifically step 3, you'll have access to the debug menu: http://wiki.frictionalgames.com/hpl2/amn...evenvguide

@i3670 That error message is not enough information for me to help you.

Tutorials: From Noob to Pro
10-05-2011, 12:47 AM
Website Find




Users browsing this thread: 2 Guest(s)