Frictional Games Forum (read-only)

Full Version: Help with scripting!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone! I'm new here as you may have noticed, but enough chitchat.

I'm having a problem. I have started making my own custom story a couple days backwards and I can't test my map because when I try to start the map, Fatal Error jumps up and says (27,19) unexpected data type.

I have done some scripting and yes, I have watched some tutorials from youtube and so on, but I haven't figured out how I can test my map.

I've spent so many hours trying to solve this error and...NOTHING!

I will post my script here if anyone is interested in helping me!
We need the script
Here it is!

////////////////////////////
// Run first time starting map
void OnStart()
{
PlayMusic("02_amb_safe", true, 0.7f, 1, 0, true);
SetEnemyIsHallucination("Morso1", 2);
SetEntityCallbackFunc("guiding_rod01_1", "ActivateMonster", true);
AddUseItemCallback("", "key_study_1", "mansion_4", "UsedKeyOnDoor", true);
AddUseItemCallback("", "hollow_needle_1", "mansion_2", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "Area2", "CollideArea2", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_4", 0, false);
RemoveUseItem("key_study_1");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveUseItem("hollow_needle_1");
}

void CollideArea2("Player", "Area2", 1)
{
SetSwingDoorClosed("mansion_2", true, true);
}

void ActivateMonster(string &in Item)
{
SetEntityActive("Morso2", true);
AddEnemyPatrolNode("Morso2", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_6", 0, "Idle");
}


////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Don't change syntax's, use this:


////////////////////////////
// Run first time starting map
void OnStart()
{
PlayMusic("02_amb_safe", true, 0.7f, 1, 0, true);
SetEnemyIsHallucination("Morso1", 2);
SetEntityCallbackFunc("guiding_rod01_1", "ActivateMonster", true);
AddUseItemCallback("", "key_study_1", "mansion_4", "UsedKeyOnDoor", true);
AddUseItemCallback("", "hollow_needle_1", "mansion_2", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "Area2", "CollideArea2", true, 1);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_4", 0, false);
RemoveUseItem("key_study_1");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveUseItem("hollow_needle_1");
}

void CollideArea2(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

void ActivateMonster(string &in Item)
{
SetEntityActive("Morso2", true);
AddEnemyPatrolNode("Morso2", "PathNodeArea_1", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_2", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_3", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_4", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_5", 0, "Idle");
AddEnemyPatrolNode("Morso2", "PathNodeArea_6", 0, "Idle");
}


////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Hmm...now another fatal error pops up.

Fatal Error: Could not load script file 'custom_stories/MyCustom/maps/00_mycustom.hps'!
main (20,1) : ERR : A function with the same name and parameters already exist
main (6,1) : ERR : No matching signatures to 'SetEnemyIsHallucination(string@&, const uint)'
main (7,1) : ERR : No matching signatures to 'SetEntityCallBackFunc(string@&, string@&, const bool)'
main (17,1) : ERR : No matching signatures to 'RemoveUseItem(string@& )'
main (24,1) : ERR : No matching signatures to 'RemoveUseItem(string@& )'


I suggest you read the wiki, you don't have proper callbacks and you are duplicating functions. Read here for more info:
http://wiki.frictionalgames.com/hpl2/tut...t_beginner
Yeah, you have functions with the same name and also a number of incorrect syntaxes.
If you are having trouble with the syntaxes, you can find them here:
http://wiki.frictionalgames.com/hpl2/amn..._functions


Also, if you are using Notepad++ which I think is vital, this plugin is highly recommended as you can see all the syntaxes when you type them.
http://www.frictionalgames.com/forum/thr...ht=Notepad
I would love to know where you got that UsedKeyOnDoor function.
Allright!

@flamez3 I read the wiki you linked and @junkfood2121 I watched your links too.

I started making a new map and have scripted about 4 hours now and it works like a charm.
Thanks guys!
If not the easy way, then the hard way.
By the way, I love to make my own custom, hope I can release it here someday when it's finished.

@YourComputer, that's a good question. I did watch many tutorials and maybe I somehow just came up with it, I don't know.