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 a newbie with an HPS file?
lbrosious96 Offline
Junior Member

Posts: 4
Threads: 4
Joined: Jun 2012
Reputation: 0
#1
Help a newbie with an HPS file?

here is the code I have for my first map. It worked perfectly with the first key (monsterdoor/monsterdoorkey_1). Then, I wanted to add a second key/door, called irondoor_key and irondoor respectively, i get so many errors when loading my map. What Did i do wrong? I followed a tutorial, and I have basic/intermediate knowledge of C++ (took a highschool class or two) so go easy on me. Thank you! I will answer any and all questions you have to the best of my ability!



I am getting the error "main (11,2) : ERR : Unexpected end of file"

on line 11 row 2 its blank...so im not sure what to do Sad



void OnStart()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "irondoor"key", "irondoor", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(monsterdoorkey_1, monsterdoor)
{
SetSwingDoorLocked("monsterdoor", "irondoor", false, true);
PlaySoundAtEntity("", "unlock_door", "monsterdoor", "irondoor", 0, false);
RemoveItem("monsterdoorkey_1", "irondoor_key");
}
(This post was last modified: 06-29-2012, 06:01 PM by lbrosious96.)
06-29-2012, 05:28 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#2
RE: Help a newbie with an HPS file?

AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "irondoor"key", "irondoor" "UsedKeyOnDoor", true);
You can't just add a new one, you have to make a new command for that. Also, the UsedKeyOnDoor function has a wrong syntax. And everything in it is wrong too.
In fact, you got that many mistakes, that I think it's better to just correct everything, so you can see what you did wrong.

PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""monsterdoorkey_1""monsterdoor""UsedKeyOnDoor"true);
AddUseItemCallback("""irondoor_key""irondoor""UsedKeyOnDoor"true);
}
void UsedKeyOnDoor(string &in asItemstring &in asEntity
{
SetSwingDoorLocked(asEntityfalsetrue);
PlaySoundAtEntity("""unlock_door.snt"asEntity0false);
RemoveItem(asItem);

If you got any questions on that script, feel free to ask. I just think that explaining everything would take too long, as this is something people make 3+ video tutorials about(Because of using asEntity etc. Variables and the syntax and such stuff)
(This post was last modified: 06-29-2012, 05:49 PM by Cruzore.)
06-29-2012, 05:42 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Help a newbie with an HPS file?

Alright, I see where you went wrong. You can't stuff more information into 1 callback than what is allowed; you put 2 items (keys) and 2 entities (doors in this case) into 1 callback (AddUseItemCallback). Also, the syntax (stuff inside the parentheses) for UsedKeyOnDoor is wrong. This needs to be 2 callbacks and 2 functions, not one. Also, is it irondoor_key or irondoorkey? You have 2 different names.

Anyways, here's the revised script:


void OnStart()
{
AddUseItemCallback("", "irondoor_key", "irondoor" "use_iron_key", true);
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "use_monster_key", true);
}

void use_iron_key(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("irondoor" false, true);
PlaySoundAtEntity("", "unlock_door", "irondoor" 0, false);
RemoveItem("irondoor_key");
}

void use_monster_key(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "monsterdoor", 0, false);
RemoveItem("monsterdoorkey_1");
}

I rate it 3 memes.
06-29-2012, 05:45 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#4
RE: Help a newbie with an HPS file?

...what FastHunteR and andyrockin123 said.
06-29-2012, 10:20 PM
Find




Users browsing this thread: 1 Guest(s)