Frictional Games Forum (read-only)
I can't get my script to work D: - 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: I can't get my script to work D: (/thread-16556.html)

Pages: 1 2


I can't get my script to work D: - Wrathborn771 - 06-28-2012

Hello,
I've come up with a script, based on a function I found at: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

This is what it looks like:

void OnStart()
{
void Jump1(string& asName, string& asCallback);
}
Jump1("Player", "Thanks", "OnPickup");
{
SetEntityActive("bro_1", true);
AddTimer("", 200.4, "scared");
}
void scared(string &in asTimer)
{
SetEntityActive("bro_1", false);

I get the Fatal Error: Expected identifier all the time :/
I'm sure it's a super-easy-noob-error, because this is the very first time I script without using a tutorial on what/where to type..

Thank you for taking your time and reading this Wink


RE: I can't get my script to work D: - Datguy5 - 06-28-2012

You dont seem to have any callback there.


RE: I can't get my script to work D: - Wrathborn771 - 06-28-2012

(06-28-2012, 10:36 PM)Datguy5 Wrote: You dont seem to have any callback there.
Can you add what's missing then? :o
I accually have another function in that script, lemme post the full one for you to see:

void OnStart()
{
void Jump1(string& asName, string& asCallback);
}
Jump1("Player", "Thanks", "OnPickup");
{
SetEntityActive("bro_1", true);
AddTimer("", 200.4, "scared");
}
void scared(string &in asTimer)
{
SetEntityActive("bro_1", false);
AddEntityCollideCallback("Player", "bro_1", "collidemonster", true, 1);
}
void collidemonster(string &in asParent, string &in asChild, int alState)
{
StartCredits("29_amb_end_intense.ogg", true, "Ending", "MainCredits", 7);
}

Thanks for the reply Smile

P.S: I've played your CS Death Can Await. I must say, it was a masterpiece Wink I accually think it's one of my favorites. Big Grin


RE: I can't get my script to work D: - Datguy5 - 06-29-2012

(06-28-2012, 11:30 PM)Wrathborn771 Wrote:
(06-28-2012, 10:36 PM)Datguy5 Wrote: You dont seem to have any callback there.
Can you add what's missing then? :o
I accually have another function in that script, lemme post the full one for you to see:

void OnStart()
{
void Jump1(string& asName, string& asCallback);
}
Jump1("Player", "Thanks", "OnPickup");
{
SetEntityActive("bro_1", true);
AddTimer("", 200.4, "scared");
}
void scared(string &in asTimer)
{
SetEntityActive("bro_1", false);
AddEntityCollideCallback("Player", "bro_1", "collidemonster", true, 1);
}
void collidemonster(string &in asParent, string &in asChild, int alState)
{
StartCredits("29_amb_end_intense.ogg", true, "Ending", "MainCredits", 7);
}

Thanks for the reply Smile

P.S: I've played your CS Death Can Await. I must say, it was a masterpiece Wink I accually think it's one of my favorites. Big Grin
void OnStart()
{
SetEntityCallbackFunc("NAME OF THE ITEM", "Jump1");
AddEntityCollideCallback("Player", "NAME OF THE SCRIPT AREA", "collidemonster", true, 1);
}
void Jump1(string& asName, string& asCallback);
{
AddTimer("scared", 2.4, "Timer_1");
}
void Timer_1(string &in asTimer)
{
SetEntityActive("bro_1", false);
}
void collidemonster(string &in asParent, string &in asChild, int alState)
{
StartCredits("29_amb_end_intense.ogg", true, "Ending", "MainCredits", 7);
}
void OnEnter()
{
}
void OnLeave()
{
}
Try that.Im not sure it will work(i doubt)but test it and say what happened(including a error report if you get one).Also what are you trying to do here?I had no idea Big Grin And i presume that Jump1("Player", "Thanks", "OnPickup"); you tried that when player picks up something,something will happen.Replace the NAME OF THE ITEM with the name of your item(obviously),and the NAME OF THE SCRIPT AREA replace with the name of the script area the player collides with.And thanks for liking my FIRST custom story :3 Have you seen the second one im currently making?


RE: I can't get my script to work D: - Wrathborn771 - 06-30-2012

(06-29-2012, 12:01 AM)Datguy5 Wrote: void OnStart()
{
SetEntityCallbackFunc("NAME OF THE ITEM", "Jump1");
AddEntityCollideCallback("Player", "NAME OF THE SCRIPT AREA", "collidemonster", true, 1);
}
void Jump1(string& asName, string& asCallback);
{
AddTimer("scared", 2.4, "Timer_1");
}
void Timer_1(string &in asTimer)
{
SetEntityActive("bro_1", false);
}
void collidemonster(string &in asParent, string &in asChild, int alState)
{
StartCredits("29_amb_end_intense.ogg", true, "Ending", "MainCredits", 7);
}
void OnEnter()
{
}
void OnLeave()
{
}
Try that.Im not sure it will work(i doubt)but test it and say what happened(including a error report if you get one).Also what are you trying to do here?I had no idea Big Grin And i presume that Jump1("Player", "Thanks", "OnPickup"); you tried that when player picks up something,something will happen.Replace the NAME OF THE ITEM with the name of your item(obviously),and the NAME OF THE SCRIPT AREA replace with the name of the script area the player collides with.And thanks for liking my FIRST custom story :3 Have you seen the second one im currently making?
I'm sorry, you got something wrong in there :o
I want a monster (bro_1) to spawn when picking up a note (Thanks), and I want the credits to come up when he has killed the player.
So there is no script_area involved :/

Are you making another one? :o
I will totally play it! Big Grin
Will it be a total conversion? If not, I recomend you making it one, it's relly simple and I love more "custom" stories. Smile
Here's a tutorial, it takes like a few minutes to do one:
http://www.youtube.com/watch?v=puIfVx0lslA


RE: I can't get my script to work D: - Datguy5 - 06-30-2012

(06-30-2012, 02:23 PM)Wrathborn771 Wrote:
(06-29-2012, 12:01 AM)Datguy5 Wrote: void OnStart()
{
SetEntityCallbackFunc("NAME OF THE ITEM", "Jump1");
AddEntityCollideCallback("Player", "NAME OF THE SCRIPT AREA", "collidemonster", true, 1);
}
void Jump1(string& asName, string& asCallback);
{
AddTimer("scared", 2.4, "Timer_1");
}
void Timer_1(string &in asTimer)
{
SetEntityActive("bro_1", false);
}
void collidemonster(string &in asParent, string &in asChild, int alState)
{
StartCredits("29_amb_end_intense.ogg", true, "Ending", "MainCredits", 7);
}
void OnEnter()
{
}
void OnLeave()
{
}
Try that.Im not sure it will work(i doubt)but test it and say what happened(including a error report if you get one).Also what are you trying to do here?I had no idea Big Grin And i presume that Jump1("Player", "Thanks", "OnPickup"); you tried that when player picks up something,something will happen.Replace the NAME OF THE ITEM with the name of your item(obviously),and the NAME OF THE SCRIPT AREA replace with the name of the script area the player collides with.And thanks for liking my FIRST custom story :3 Have you seen the second one im currently making?
I'm sorry, you got something wrong in there :o
I want a monster (bro_1) to spawn when picking up a note (Thanks), and I want the credits to come up when he has killed the player.
So there is no script_area involved :/

Are you making another one? :o
I will totally play it! Big Grin
Will it be a total conversion? If not, I recomend you making it one, it's relly simple and I love more "custom" stories. Smile
Here's a tutorial, it takes like a few minutes to do one:
http://www.youtube.com/watch?v=puIfVx0lslA

It wont be a total conversion.Here is the link to the thread: http://www.frictionalgames.com/forum/thread-14108.html And if you want the story to end when the monster kills the player,i suppose you could use a if function(i dont know exactly how they work so i cant help with that :/ ).


RE: I can't get my script to work D: - Wrathborn771 - 06-30-2012

(06-30-2012, 03:39 PM)Datguy5 Wrote: It wont be a total conversion.Here is the link to the thread: http://www.frictionalgames.com/forum/thread-14108.html And if you want the story to end when the monster kills the player,i suppose you could use a if function(i dont know exactly how they work so i cant help with that :/ ).
But I already have the script with the credits, no need to worry about that. Smile
But can you please re-do the script you did for me yesterday without the script_area-function? Because I don't have a area involved.


I just need a monster to spawn when I pickup a letter, the monster is called "bro_1" and the letter is called "Thanks".

P.S: I look forward to play your new story, even tho it's not a total conversion. Tongue


RE: I can't get my script to work D: - EXAWOLT - 06-30-2012

float GetPlayerHealth(50);
-IF healt is below 50, it will be called, just setplayerhealth(0); and StartCredits()
simply nuff said


RE: I can't get my script to work D: - Wrathborn771 - 06-30-2012

(06-30-2012, 03:48 PM)EXAWOLT Wrote: float GetPlayerHealth(50);
-IF healt is below 50, it will be called, just setplayerhealth(0); and StartCredits()
simply nuff said
The problem I currently have is that I need a script which makes a monster spawn when picking up a note.


RE: I can't get my script to work D: - SilentStriker - 06-30-2012

(06-30-2012, 04:00 PM)Wrathborn771 Wrote:
(06-30-2012, 03:48 PM)EXAWOLT Wrote: float GetPlayerHealth(50);
-IF healt is below 50, it will be called, just setplayerhealth(0); and StartCredits()
simply nuff said
The problem I currently have is that I need a script which makes a monster spawn when picking up a note.
Haven't done it myself but if you click your note inside the level editor and then press the entity tab of the note and on PlayerInteractCallback you can write the name of your function or it may work in the CallbackFunc too