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
Script Help Trying to break a breakable box with a crowbar
TheCyberToad Offline
Junior Member

Posts: 2
Threads: 1
Joined: Sep 2020
Reputation: 0
#1
Trying to break a breakable box with a crowbar

Was trying to make a breaking script
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.

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?
(This post was last modified: 09-26-2020, 11:20 AM by TheCyberToad.)
09-26-2020, 11:19 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Trying to break a breakable box with a crowbar

Howdy, I'm pretty late to this but

PHP Code: (Select All)
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~


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

void BreakBox(string& asName, string& asEntity);
{
    SetPropHealth("healbox_1", "0");
}

Discord: Romulator#0001
[Image: 3f6f01a904.png]
09-28-2020, 10:46 AM
Find
TheCyberToad Offline
Junior Member

Posts: 2
Threads: 1
Joined: Sep 2020
Reputation: 0
#3
RE: Trying to break a breakable box with a crowbar

Thanks a lot for your answer but it is still not working, the same error in the same place Sad
09-28-2020, 03:54 PM
Find




Users browsing this thread: 1 Guest(s)