Frictional Games Forum (read-only)

Full Version: Trying to break a breakable box with a crowbar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Was trying to make a breaking script
Code:
void OnStart()
    {
void AddUseItemCallback("", "crowbar", "healbox_1", "BreakBox", true);

}

void BreakBox(string& asName, string& asEntity);

{
SetPropHealth("healbox_1", "0");
}

 but it says the open token is unexpected.

Code:
FATAL ERROR: Could not load script file
'custom_stories/labstory/maps/00_scripttest.hps'!
main (12,1): ERR : Unexpected token ‘{'

The healbox_1 is a common wood_box02_breakable.ent.

Are there any more proper ways of doing this if it's too wrong?
Howdy, I'm pretty late to this but

PHP Code:
void OnStart()
 
  {
void AddUseItemCallback("""crowbar""healbox_1""BreakBox"true);



Drop the "void" in your "AddUseItemCallback". You don't need that there. Big Grin

Everything else looks correct, but it may be better to just make your code a bit more readable. Group things together consistently~


Code:
void OnStart()
{
    AddUseItemCallback("", "crowbar", "healbox_1", "BreakBox", true);
}

void BreakBox(string& asName, string& asEntity);
{
    SetPropHealth("healbox_1", "0");
}
Thanks a lot for your answer but it is still not working, the same error in the same place Sad