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
How to make two scripts? Need help!
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#1
How to make two scripts? Need help!

I want to create two different script in my .hps file, but when I running a map, game shows fatal error:
main (12,1): ERR: Unexpected token '{'
main (17,1): ERR: Unexpected token '{'

What's wrong with it? Please, help. Could you explain how to make different scripts and, if you have time, fix those two? (to example how make scripts). Btw, sorry for my (maybe) bad English Big Grin
Here's a script:

////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("basement_1", false, true);
PlaySoundAtEntity("", "unlock_door", "basement_1", 0, false);
}
{
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1);
}

void DeadOne(string &in asParent, string &in asChild, int alStates);
{
SetEntityActive("GhostOne", true);
AddPropForce("GhostOne", 0, 0, -10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "GhostOne", 0, false);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}
11-18-2012, 11:38 AM
Find
GoranGaming Offline
Member

Posts: 183
Threads: 30
Joined: Feb 2012
Reputation: 7
#2
RE: How to make two scripts? Need help!

////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("basement_1", false, true);
PlaySoundAtEntity("", "unlock_door", "basement_1", 0, false);
}




void DeadOne(string &in asParent, string &in asChild, int alStates);
{
SetEntityActive("GhostOne", true);
AddPropForce("GhostOne", 0, 0, -10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "GhostOne", 0, false);
}



////////////////////////////
// Run when entering map
void OnEnter()
{

}


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

}

Current projects:

The Dark Prison 85 % (Stopped working on this one)

Unnamed Project 7 %
11-18-2012, 11:45 AM
Website Find
JMFStorm Offline
Member

Posts: 205
Threads: 8
Joined: Aug 2011
Reputation: 28
#3
RE: How to make two scripts? Need help!

Very nice script I have to say! The mistake is very simple.
AddEntityCollideCallback("Player", "tp_1", "DeadOne", true, 1); script should be under the function: "void OnStart ()"

11-18-2012, 11:46 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: How to make two scripts? Need help!

Do i sense irony?

Trying is the first step to success.
11-18-2012, 11:53 AM
Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#5
RE: How to make two scripts? Need help!

Thanks for help! GoranGaming, I use your script, but there's another fatal error:
main (19,1):ERR:Unexpected token '{'

What should I do?
11-18-2012, 11:56 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: How to make two scripts? Need help!

void DeadOne(string &in asParent, string &in asChild, int alStates);



Remove this one ;

Trying is the first step to success.
11-18-2012, 12:48 PM
Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#7
RE: How to make two scripts? Need help!

Finnaly it works! Big Grin Thanks you all for help Smile
11-18-2012, 12:53 PM
Find




Users browsing this thread: 3 Guest(s)