lbrosious96
Junior Member
Posts: 4
Threads: 4
Joined: Jun 2012
Reputation:
0
|
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
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 |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
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.
void OnStart() { AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true); AddUseItemCallback("", "irondoor_key", "irondoor", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false); 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 |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
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 |
|
ApeCake
Member
Posts: 116
Threads: 20
Joined: Jun 2012
Reputation:
4
|
RE: Help a newbie with an HPS file?
...what FastHunteR and andyrockin123 said.
|
|
06-29-2012, 10:20 PM |
|
|