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
Whats wrong with my script?
Henriksen Offline
Senior Member

Posts: 308
Threads: 71
Joined: Dec 2010
Reputation: 2
#1
Whats wrong with my script?

Hi, I was trying to script random events today but it doesnt work, can anyone see whats wrong with my script'?

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}

void Func01(string &in asParent, string &in asChild, int alState)
{
int x = RandInt(1, 3);
if (x == 1)
{
[SetEntityActive("servant_grunt_1", true);]
return;
}
if (x == 2)
{
[SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);]
return;
}
if (x == 3)
{
[SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);]
return;
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{    
PlayMusic("ambience_voice.ogg", true, 0.7f, 1, 0, false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

05-28-2011, 10:48 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: Whats wrong with my script?

[SetEntityActive("servant_grunt_1", true);]

'[' & ']' needless. Omit all of them.

05-28-2011, 11:13 AM
Website Find
Henriksen Offline
Senior Member

Posts: 308
Threads: 71
Joined: Dec 2010
Reputation: 2
#3
RE: Whats wrong with my script?

(05-28-2011, 11:13 AM)Tanshaydar Wrote: [SetEntityActive("servant_grunt_1", true);]

'[' & ']' needless. Omit all of them.

My script now looks like this but it still doesnt work:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}

void Func01(string &in asParent, string &in asChild, int alState)
{
int x = RandInt(1, 3);
if (x == 1)
{
SetEntityActive("servant_grunt_1", true);
return;
}
if (x == 2)
{
SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
return;
}
if (x == 3)
{
SetEntityActive("servant_grunt_1", true);
SetEntityActive("servant_grunt_2", true);
SetEntityActive("servant_grunt_3", true);
return;
}
}

////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("ambience_voice.ogg", true, 0.7f, 1, 0, false);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
05-28-2011, 11:14 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: Whats wrong with my script?

I'm not sure what's wrong since script looks right. There might be something wrong with the map file. Try to add debug messages to see if player collides with the area and if statements are working.

05-28-2011, 11:19 AM
Website Find




Users browsing this thread: 1 Guest(s)