Frictional Games Forum (read-only)
[SCRIPT] Trying to break a breakable box with a crowbar - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Trying to break a breakable box with a crowbar (/thread-56798.html)



Trying to break a breakable box with a crowbar - TheCyberToad - 09-26-2020

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?


RE: Trying to break a breakable box with a crowbar - Romulator - 09-28-2020

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");
}



RE: Trying to break a breakable box with a crowbar - TheCyberToad - 09-28-2020

Thanks a lot for your answer but it is still not working, the same error in the same place Sad