Frictional Games Forum (read-only)
Looping? (Still need 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: Looping? (Still need help) (/thread-16458.html)

Pages: 1 2 3 4


RE: Looping? - SiderealStop - 06-24-2012

Kay added it, changed it to false and everything. Still getting the error though when I walk into the room. This is what I have in the script:



void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "servant_grunt_1", true, 1);
InteractConnectPropWithMoveObject("MachineryDoor", "valve_iron_rusty_1", "MachineryDoor", true, false, -1);
AddEntityCollideCallback("ScriptArea_1", "servant_grunt_1", "Loop", fale, 1);
}
void OnEnter()
void Loop(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
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", 0, "");
AddTimer("2", 1, "Loop");
}

'Loop', I', guessing, is the name of the loop function. I used that in the 'function' part of the callback. Put the grunt as 'child' and put the script as 'parent'. Still not working. xD It looks like it actually should work so, really, I think it might be the timer itself...?


RE: Looping? - Cruzore - 06-24-2012

AddEntityCollideCallback("ScriptArea_1", "servant_grunt_1", "Loop", fale, 1);
false has a typo.

Also, void OnEnter() is missing..what is that called again? well..
I mean those: { }


RE: Looping? - SiderealStop - 06-24-2012

@-@ WOW Kay. That...was a horrible fail on my part... *facepalms*

As much of a fail as that was, I fixed, saved and tried again but am still getting the error.


RE: Looping? - Cruzore - 06-24-2012

Who's Kay? Big Grin
I think I got the mistake:
AddEntityCollideCallback("Player", "PlayerCollide", "servant_grunt_1", true, 1);
servant_grunt_1 should be the function. But instead, you pasted the name of your monster. What you have to do is rename it, make a new function and set the grunt active.


RE: Looping? - SiderealStop - 06-24-2012

servant_grunt_1 is the name of the entity, the grunt. That entire script used to work until I added the loop.. ;A; So I'm not entirely sure what you mean.. ><


RE: Looping? - Cruzore - 06-24-2012

It's strange, because the third string of the collide callback is supposed to be the function. And an entity is not a function.


RE: Looping? - SiderealStop - 06-24-2012

Mm I copied that one directly from the wiki, the example conveniently had the grunt as the enemy patrolling. I was just looking at it too, seeing the difference between the entity callback on the list of commands on the site and the callback from that example. Thing is that it works fine if you take out the whole loop thing. :/


RE: Looping? - Cruzore - 06-24-2012

Well, another thing: About every thing in this script is either horribly wrong or I have eye cancer.
Or, better off: After reading some threads, it seems like the grunt will loop automatically? You just have to make sure he doesn't dissapear when out of reach of the player and not in sight, which you do by changing it's stats at the modeleditor? Someone must clear this up, I think. I have no idea about how the grunt reacts.


RE: Looping? - SiderealStop - 06-24-2012

Oh it will? I've tested multiple times, different things and such. Usually it disappears at the end of the path...I just checked settings and such, there's nowhere where I can set anything to not disappear when it finishes its path or anything like it...


RE: Looping? - Cruzore - 06-24-2012

Okay, I've read some stuff and I think this way it works:
void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "Loop", true, 1);
InteractConnectPropWithMoveObject("MachineryDoor", "valve_iron_rusty_1", "MachineryDoor", true, false, -1);
}
void OnEnter()
{
}
void Loop(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
for(int i=0;i<11;i++)
{
if(i == 11)
{
i = 0;
}

AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_"+i, 0.0f, "");
}
}

Though the grunt may still dissapear after hiding long enough. You will probably have to change something in the user defined variables in the model editor.