Frictional Games Forum (read-only)
What's wrong with this script? - 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: What's wrong with this script? (/thread-13109.html)



What's wrong with this script? - Strembitsky - 02-05-2012

Code:
//===========================================
     // Starter's Script File!
     //===========================================

     //===========================================
     // This runs when the map first starts
     void OnStart()
     {
          AddEntityCollideCallback("Player", "ScriptArea_1", "Collide_Area", true, 1);
     }
     void Collide_Area(string &in asParent, string &in asChild, int alState)      
     {
          [void FadeEnemyToSmoke(string& servant_grunt, bool abPlaySound);]
     }

     //===========================================
     // This runs when the player enters the map
     void OnEnter()
     {
     }

     //===========================================
     // This runs when the player leaves the map
     void OnLeave()
     {
     }


It is meant to poof away a monster once you enter the area. Whenever I try to open the map in Amnesia, the game stops responding with an always unique error message.



RE: What's wrong with this script? - Elven - 02-05-2012

I recommend watching this:

http://wiki.frictionalgames.com/hpl2/tutorials/scripting/article

It gives you basic idea of scripting Smile. There are more tutorials in wiki!



RE: What's wrong with this script? - Strembitsky - 02-05-2012

(02-05-2012, 12:10 AM)Elven Wrote: I recommend watching this:

http://wiki.frictionalgames.com/hpl2/tutorials/scripting/article

It gives you basic idea of scripting Smile. There are more tutorials in wiki!
I have! I also am currently following the tutorial on the wiki. Nothing is different in my code than the one on the wiki. Also, the error message always says that the code on the 13th line isn't right, so that means the function isn't written correctly. Could you please help?


RE: What's wrong with this script? - Elven - 02-05-2012

[void FadeEnemyToSmoke(string& servant_grunt, bool abPlaySound);]

must be

FadeEnemyToSmoke("servant_grunt", true);



RE: What's wrong with this script? - Your Computer - 02-05-2012

FYI, square brackets are normally used for accessing array indexes.


RE: What's wrong with this script? - Strembitsky - 02-05-2012

(02-05-2012, 12:19 AM)Elven Wrote: [void FadeEnemyToSmoke(string& servant_grunt, bool abPlaySound);]

must be

FadeEnemyToSmoke("servant_grunt", true);
Thank you oh so very much Smile





RE: What's wrong with this script? - Elven - 02-05-2012

Glad that I was helpful Smile