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 Help with scripting!
Hatred Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2012
Reputation: 1
#1
Help with scripting!

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!
02-12-2012, 11:25 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Help with scripting!

We need the script

02-12-2012, 11:30 AM
Find
Hatred Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2012
Reputation: 1
#3
RE: Help with scripting!

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()
{
}
02-12-2012, 11:32 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Help with scripting!

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()
{
}

02-12-2012, 11:53 AM
Find
Hatred Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2012
Reputation: 1
#5
RE: Help with scripting!

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@& )'


(This post was last modified: 02-12-2012, 12:09 PM by Hatred.)
02-12-2012, 12:08 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: Help with scripting!

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

02-12-2012, 12:26 PM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#7
RE: Help with scripting!

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

Creator of The Dark Treasure.
02-12-2012, 12:33 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Help with scripting!

I would love to know where you got that UsedKeyOnDoor function.

Tutorials: From Noob to Pro
02-12-2012, 06:07 PM
Website Find
Hatred Offline
Junior Member

Posts: 10
Threads: 3
Joined: Feb 2012
Reputation: 1
#9
RE: Help with scripting!

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.
02-12-2012, 08:56 PM
Find




Users browsing this thread: 1 Guest(s)