Frictional Games Forum (read-only)
I need help 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: I need help with this script (/thread-19905.html)



I need help with this script - DanielStanley - 01-12-2013

Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

// Start of everything!

AddEntityCollideCallback("Player", "introscript", false, 0);
}
void introstart(string &in asParent, string &in asChild, int alState)
{

if(alState == 1)
{
PlayMusic("03_puzzle_secret", false, 1.00, 0, 5, true);
}
if(alState == -1)
{
StopMusic(0, 5);
}
}


RE: I need help with this script - The chaser - 01-12-2013

(01-12-2013, 09:18 PM)DanielStanley Wrote: Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

// Start of everything!

AddEntityCollideCallback("Player", "introscript", false, 0);
}
void introscript(string &in asParent, string &in asChild, int alState)
{

if(alState == 1)
{
PlayMusic("03_puzzle_secret", false, 1.00, 0, 5, true);
}
if(alState == -1)
{
StopMusic(0, 5);
}
}



RE: I need help with this script - NaxEla - 01-13-2013

Also, change this line:

AddEntityCollideCallback("Player", "introscript", false, 0);

To this:

AddEntityCollideCallback("Player", "NAME OF THE ENTITY THE PLAYER COLLIDES WITH", "introscript", false, 0);


RE: I need help with this script - Damascus - 01-13-2013

There's a plethora of problems here. Added script is red, corrected script is blue:

(01-12-2013, 09:18 PM)DanielStanley Wrote: Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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


// Start of everything!

AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
}
void introscript(string &in asParent, string &in asChild, int alState)
{

if(alState == 1)
{
PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
}
if(alState == -1)
{
StopMusic(0, 5);
}
}



RE: I need help with this script - darksky - 01-13-2013

(01-13-2013, 05:39 AM)Damascus Wrote: There's a plethora of problems here. Added script is red, corrected script is blue:

(01-12-2013, 09:18 PM)DanielStanley Wrote: Hey. So i made this script and i can't get it to work, does anyone know how to fix this? (I'm pretty new to this script thing)

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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


// Start of everything!

AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
}
void introscript(string &in asParent, string &in asChild, int alState)
{

if(alState == 1)
{
PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
}
if(alState == -1)
{
StopMusic(0, 5);
}
}

it won't work like that, Damascus. the closing bracket for OnStart comes after the collidecallback. your second closing bracket is wrong.

(and you don't need brackets when using a for-loop with just one instruction Smile )


RE: I need help with this script - FlawlessHappiness - 01-13-2013

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");

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

AddEntityCollideCallback("Player", "ENTITY COLLIDED WITH", "introscript", false, 0);
}

// Start of everything!

void introscript(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlayMusic("03_puzzle_secret", false, 1, 0, 5, true);
}
if(alState == -1)
{
StopMusic(0, 5);
}
}