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
help with script
mccrazy5 Offline
Junior Member

Posts: 11
Threads: 4
Joined: Jun 2012
Reputation: 0
#1
help with script

i tried to script something .. tell me please whats wrong with this script... when i start the map the game crash.
void OnStart()
{
AddEntityCollideCallback("Player", "bookarea", "bookscare", true, 1);

}
void bookscare(string &in asParent, string &in asChild, int alState)
{
AddPropForce("book1", 31, 1, -19.25, "world");
SetEntityActive("light1",true);
SetEntityActive("light2",true);
SetEntityActive("mb_window_1",false);
SetEntityActive("mb_window_noglass_1",true);
PlaySoundAtEntity("", "break_glass_large", "mb_window_noglass_1", 0, false);
}
07-06-2012, 09:21 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: help with script

I don't see any problem. Is there a error message when it crashes?

Think, before you speak Google, before you post
07-06-2012, 09:25 PM
Find
mccrazy5 Offline
Junior Member

Posts: 11
Threads: 4
Joined: Jun 2012
Reputation: 0
#3
RE: help with script

yes this is what it says [Image: n4ztbhmwqmnd.png]
07-06-2012, 09:32 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#4
RE: help with script

the error lies somewhere else. Paste the whole script file of the map "map2.hps"

Think, before you speak Google, before you post
07-06-2012, 09:33 PM
Find
mccrazy5 Offline
Junior Member

Posts: 11
Threads: 4
Joined: Jun 2012
Reputation: 0
#5
RE: help with script

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "hammer", "block", "breakwood", true);
AddEntityCollideCallback("Player", "bookarea", "bookscare", true, 1);

}

void breakwood (string &in asItem, string &in asEntity)
{
SetEntityActive("block",false);
PlaySoundAtEntity("", "break_wood", "mansion_1", 0, false);
GiveSanityBoost();
RemoveItem(asItem);

void bookscare(string &in asParent, string &in asChild, int alState)
{
AddPropForce("book1", 31, 1, -19.25, "world");
SetEntityActive("light1",true);
SetEntityActive("light2",true);
SetEntityActive("mb_window_1",false);
SetEntityActive("mb_window_noglass_1",true);
SetEntityActive("rain",false);
PlaySoundAtEntity("", "break_glass_large", "mb_window_noglass_1", 0, false);
}


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

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}
(This post was last modified: 07-06-2012, 09:37 PM by mccrazy5.)
07-06-2012, 09:35 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: help with script

You had some misplaced brackets, this should be good:


////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "hammer", "block", "breakwood", true);
AddEntityCollideCallback("Player", "bookarea", "bookscare", true, 1);

}

void breakwood(string &in asItem, string &in asEntity)
{
SetEntityActive("block",false);
PlaySoundAtEntity("", "break_wood", "mansion_1", 0, false);
GiveSanityBoost();
RemoveItem(asItem);
}

void bookscare(string &in asParent, string &in asChild, int alState)
{
AddPropForce("book1", 31, 1, -19.25, "world");
SetEntityActive("light1",true);
SetEntityActive("light2",true);
SetEntityActive("mb_window_1",false);
SetEntityActive("mb_window_noglass_1",true);
SetEntityActive("rain",false);
PlaySoundAtEntity("", "break_glass_large", "mb_window_noglass_1", 0, false);
}


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

}

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

I rate it 3 memes.
07-06-2012, 09:37 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#7
RE: help with script

void breakwood (string &in asItem, string &in asEntity)
{
SetEntityActive("block", false);
PlaySoundAtEntity("", "break_wood", "mansion_1", 0, false);
GiveSanityBoost();
RemoveItem(asItem);

void bookscare(string &in asParent, string &in asChild, int alState)
the function "breakwood" has no closing bracket }

Think, before you speak Google, before you post
07-06-2012, 09:37 PM
Find
mccrazy5 Offline
Junior Member

Posts: 11
Threads: 4
Joined: Jun 2012
Reputation: 0
#8
RE: help with script

thank you , that works now
07-06-2012, 09:40 PM
Find




Users browsing this thread: 2 Guest(s)