Frictional Games Forum (read-only)
[SCRIPT] Enemy Patroling and Disapearing: 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: [SCRIPT] Enemy Patroling and Disapearing: Help! (/thread-15100.html)

Pages: 1 2 3


RE: Enemy Patroling and Disapearing: Help! - TeamSD - 04-27-2012

AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_1", 2, "");

Is this supposed to be

AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_1", 2, "");

That is the name of a default pathnode. Unless you erased that last letter on purpose, it might cause the grunt to follow nothing. Just wondering.



RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 04-27-2012

(04-27-2012, 11:11 AM)heyitsrobert97 Wrote:
(04-27-2012, 08:21 AM)Cocomunches Wrote:
Quote: ////////////////////////////
// Run when entering map
void OnStart()

{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}

void OnPickup(string &in asEntity)
{
SetEntityActive ("Monster_Grunt", true);
AddTimer("monsterstart", 60.0f, "byegrunt");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_1", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_2", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_3", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_4", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_5", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_6", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_7", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_8", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_9", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_10", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_11", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_12", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_13", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_14", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_15", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_16", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_17", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_18", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_19", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_20", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_21", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_22", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_23", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_24", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_25", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_26", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_27", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_28", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_29", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_30", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_31", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_32", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_33", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_34", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_35", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_36", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_37", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_38", 0, "");
}

void byegrunt(string &in asTimer)
{
SetEntityActive ("Monster_Grunt", false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(2.0f, 0);
}
You Can Delete The Collide area to create areanodes. you just add them right after you spawn the grunt like i did. I also Added Something to The void OnLeave() to help you. it will stop the music (if you have any) and fade it out when you exit the map to main menu or another map Big Grin

haha, thanks! Also, very stupid question, how do you add music?


(04-27-2012, 11:56 AM)TeamSD Wrote: AddEnemyPatrolNode("Monster_Grunt", "PathNodeAre_1", 2, "");

Is this supposed to be

AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_1", 2, "");

That is the name of a default pathnode. Unless you erased that last letter on purpose, it might cause the grunt to follow nothing. Just wondering.
:| i feel stupid. haha, thanks very much, IT WORKS!!!!




RE: Enemy Patroling and Disapearing: Help! - TeamSD - 04-27-2012

Im glad it worked. Do not feel stupid. You have no idea how many times i've done similar grammar errors. They are hard to spot because they don't cause the game to crash. Nothing just happens and it is pain in the ass.


Here is a copypaste from engine scripts page for the music:

void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);

Plays music.

asMusicFile - the music to play + extension .ogg

abLoop - determines whether a music track should loop

afVolume - volume of the music

afFadeTime - time in seconds until music reaches full volume

alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc

If you need more help just say so.





RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 04-28-2012

(04-27-2012, 09:24 PM)TeamSD Wrote: Im glad it worked. Do not feel stupid. You have no idea how many times i've done similar grammar errors. They are hard to spot because they don't cause the game to crash. Nothing just happens and it is pain in the ass.


Here is a copypaste from engine scripts page for the music:

void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);

Plays music.

asMusicFile - the music to play + extension .ogg

abLoop - determines whether a music track should loop

afVolume - volume of the music

afFadeTime - time in seconds until music reaches full volume

alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - highest, 1 - lower, etc

If you need more help just say so.

'Nother nooby question is how would I put these into the .hps?

like, if you can show an example.


RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 04-28-2012

Hey, if you or anyone else can help me out with this, I keep getting similar errors from last time.


Quote:////////////////////////////
// Run when entering map
void OnStart()

{
SetEntityPlayerInteractCallback("scareactive2", "OnPickup", true);
}

void OnPickup(string &in asEntity)
{
SetEntityActive ("Monster_Grunt", true);
AddTimer("monsterstart", 60.0f, "byegrunt");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_7", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_13", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_19", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_25", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_31", 2, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_32", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_33", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_34", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_35", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_36", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_37", 0, "");
AddEnemyPatrolNode("Monster_Grunt", "PathNodeArea_38", 0, "");
}

void byegrunt(string &in asTimer)
{
SetEntityActive ("Monster_Grunt", false);
}

{
SetEntityPlayerInteractCallback("celltwelvekey", "OnPickup", true);
}

void OnPickup(string &in asEntity)
{
SetEntityActive ("baisle", true);
AddTimer("monsterstart", 400.0f, "byegrunt");
AddEnemyPatrolNode("baisle", "PathNodeArea_39", 2, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_40", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_41", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_42", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_43", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_44", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_45", 2, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_46", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_47", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_48", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_49", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_50", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_51", 2, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_52", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_53", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_54", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_55", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_56", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_57", 2, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_58", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_59", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_60", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_61", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_62", 0, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_63", 2, "");
AddEnemyPatrolNode("baisle", "PathNodeArea_64", 0, "");
}

void byegrunt(string &in asTimer)
{
SetEntityActive ("baisle", false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
StopMusic(2.0f, 0);
}


The added part is where Basil (Monster) Is.



RE: Enemy Patroling and Disapearing: Help! - TeamSD - 04-28-2012

void byegrunt(string &in asTimer) appaers in your script twice. name the other one like this for example.

void byegrunt2(string &in asTimer)



RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 04-28-2012

edited fix


RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 04-28-2012

(04-28-2012, 06:58 AM)TeamSD Wrote: void byegrunt(string &in asTimer) appaers in your script twice. name the other one like this for example.

void byegrunt2(string &in asTimer)
FATAL ERROR: Could not load script file



ExecuteString (1,1) : ERR :No matching signatures to 'OnEnter()'

Main (58,1): ERR : Unexpected token '{'




RE: Enemy Patroling and Disapearing: Help! - Dutton - 05-06-2012

opon changing the void byegrunt(string &in asTimer) to
void byegrunt2(string &in asTimer)


You remembered to change:
AddTimer("monsterstart", 400.0f, "byegrunt");

to
AddTimer("monsterstart", 400.0f, "byegrunt2");


??


RE: Enemy Patroling and Disapearing: Help! - Cocomunches - 05-10-2012

(05-06-2012, 05:06 PM)Dutton Wrote: opon changing the void byegrunt(string &in asTimer) to
void byegrunt2(string &in asTimer)

You remembered to change:
AddTimer("monsterstart", 400.0f, "byegrunt");

to
AddTimer("monsterstart", 400.0f, "byegrunt2");


??
Yes I did. Everything worked out fine! Thanks to all!