Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help with this script
DanielStanley Offline
Junior Member

Posts: 9
Threads: 2
Joined: Sep 2011
Reputation: 0
#1
I need help with this script

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
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: I need help with this script

(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);
}
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
01-12-2013, 10:59 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#3
RE: I need help with this script

Also, change this line:

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

To this:

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

In Ruins [WIP]
01-13-2013, 12:25 AM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#4
RE: I need help with this script

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);
}
}

(This post was last modified: 01-13-2013, 05:41 AM by Damascus.)
01-13-2013, 05:39 AM
Find
darksky Offline
Member

Posts: 52
Threads: 8
Joined: Nov 2012
Reputation: 2
#5
RE: I need help with this script

(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 )
(This post was last modified: 01-13-2013, 09:10 AM by darksky.)
01-13-2013, 09:09 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: I need help with this script

////////////////////////////
// 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);
}
}

Trying is the first step to success.
(This post was last modified: 01-13-2013, 01:05 PM by FlawlessHappiness.)
01-13-2013, 01:05 PM
Find




Users browsing this thread: 1 Guest(s)