mccrazy5
Junior Member
Posts: 11
Threads: 4
Joined: Jun 2012
Reputation:
0
|
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 |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
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 |
|
mccrazy5
Junior Member
Posts: 11
Threads: 4
Joined: Jun 2012
Reputation:
0
|
RE: help with script
yes this is what it says
|
|
07-06-2012, 09:32 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
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 |
|
mccrazy5
Junior Member
Posts: 11
Threads: 4
Joined: Jun 2012
Reputation:
0
|
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 |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
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 |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
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 |
|
mccrazy5
Junior Member
Posts: 11
Threads: 4
Joined: Jun 2012
Reputation:
0
|
RE: help with script
thank you , that works now
|
|
07-06-2012, 09:40 PM |
|
|