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);
}
}
(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);
}
}
Also, change this line:
AddEntityCollideCallback("Player", "introscript", false, 0);
To this:
AddEntityCollideCallback("Player", "NAME OF THE ENTITY THE PLAYER COLLIDES WITH", "introscript", false, 0);
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);
}
}
(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
)
////////////////////////////
// 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);
}
}