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
Help with script
chriiisss Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
Help with script

Hi im new here in this forum and im pretty new to the this custom story editor and I think this is pretty funny, but i got this scripting problem that has been bothering me for a while.. I am trying to make a grunt appear when I pick up a certian key and make the kety fit into a door like they do in this tutorial: http://wiki.frictionalgames.com/hpl2/tut...[]=monster
I have followed and read the whole page a couple of times now and I still got problems..(There may be something I have missed. Im good at missing stuff I read)
This is the error I get:

FATAL ERROR: Could not load script file `MyMaps/Firstmap.hps`!
Main(7,3): ERR A function with the same name and parameters already exist.
Main(12,1): ERR A function with the same name and parameters already exist.

Main(23,3): ERR A function with the same name and parameters already exist.

Main(28,3): ERR A function with the same name and parameters already exist.

Main(14,3): ERR No matching signatures to `AddUseItemCallback(string@&,string@&,string@&, const bool)`


I know those first Errors seems kind of obvious but I have tried to do something about it by deleting some void OnStart just to check if that worked, but sadly it didnt.

Here is my script if you are considering to help Smile


////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
}
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void OnStart()
{
AddUseItemCallback("corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "keydoor_1", 0, false);
RemoveItem("corridorkey_1");
}
void OnStart()
{
AddUseItemCallback("", "corridorkey_1", "keydoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("corridorkey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("keydoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "keydoor_1", 0, false);
RemoveItem("corridorkey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("gruntyboy_1", true);
ShowEnemyPlayerPosition("gruntybot1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}


Thx anyway Smile
(This post was last modified: 02-14-2012, 07:01 AM by chriiisss.)
02-14-2012, 06:56 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Help with script

Well, you didn't delete enough OnStart functions. You're only supposed to have one (with the same return type and parameters). You also misused AddUseItemCallback on the third OnStart.

Tutorials: From Noob to Pro
02-14-2012, 07:06 AM
Website Find
chriiisss Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#3
RE: Help with script

Thx for a fast reply!
Ok ill try deleting all those OnStarts again but you said I missused the Callback, how?
(This post was last modified: 02-14-2012, 07:09 AM by chriiisss.)
02-14-2012, 07:09 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Help with script

(02-14-2012, 07:09 AM)chriiisss Wrote: Ok ill try deleting all those OnStarts again but you said I missused the Callback, how?

Look at the third time you used AddUseItemCallback and compare it with all the other times you used it. See a difference? The third one is missing an argument.

Tutorials: From Noob to Pro
02-14-2012, 07:14 AM
Website Find
chriiisss Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#5
RE: Help with script

Ok got it to work now Smile Thx for the help, it is really appreciated.


(This post was last modified: 02-14-2012, 11:00 AM by chriiisss.)
02-14-2012, 09:15 AM
Find




Users browsing this thread: 1 Guest(s)