The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Why isn't this script working?
Shadowfied Offline
Senior Member

Posts: 261
Threads: 34
Joined: Jul 2010
Reputation: 5
#1
Why isn't this script working?

Hi.

I'm working on a custom story where In one level I have an empty bucket placed, which the player needs to pick up and go fill it using a pump.

So I put a script area around the pump, ticked the "Item Interaction" option and made this script:

(This is in the void OnStart() area)

AddUseItemCallback("", "bucket_empty_1", "AreaFillBucket", "FillBucketFunc", true);

Then outside of the onstart area:

void FillBucketFunc(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "04_water_puff.snt", AreaFillBucket", 0.0f, true);
RemoveItem(asItem);
GiveItemFromFile("filled_bucket", "wooden_bucket_filled.ent");
}

But when I try to enter the level the game crashes giving me an error saying:

"FATAL ERROR: Could not load script file ~~~~~~
ExecuteString(1, 1) : ERR : No matching signatures to 'OnEnter()'
ExecuteString (1, 1) : ERR : No matching signatures to 'OnLeave()'
main (21, 1) : ERR : Unexpected end of file"

Here is the entire script (it's a new level so it's tiny)

Spoiler below!

void OnStart()
{

// Debug
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
}

PlayMusic("02_amb_strange.ogg", true, 0.2f, 2, 0, true);
AddUseItemCallback("", "bucket_empty_1", "AreaFillBucket", "FillBucketFunc", true);
}

void FillBucketFunc(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "04_water_puff.snt", AreaFillBucket", 0.0f, true);
RemoveItem(asItem);
GiveItemFromFile("filled_bucket", "wooden_bucket_filled.ent");
}


Also if I remove the "void FillBucketFunc" part the map works..

What did I do wrong?

Thanks in advance.


Current - Castle Darkuan
Other - F*cked Map
(This post was last modified: 01-09-2012, 09:21 AM by Shadowfied.)
01-09-2012, 09:03 AM
Find


Messages In This Thread
Why isn't this script working? - by Shadowfied - 01-09-2012, 09:03 AM
RE: Why isn't this script working? - by flamez3 - 01-09-2012, 09:12 AM
RE: Why isn't this script working? - by flamez3 - 01-09-2012, 09:24 AM



Users browsing this thread: 1 Guest(s)