I try to use the key on it but it says " Cannot use this item away". My code is like this:
Code:
void Onstart()
{
AddUseItemCallback("", "prisonkeylight_1", "mansion_3", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("prisonkeylight_1");
}
It doesn't have any errors it just doesn't seem to work. Did i put something wrong
.
I followed "the Make a key unlock a specific door" but still not working.
oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!
void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps
(03-19-2011, 02:42 PM)Danarogon Wrote: [ -> ]oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!
void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps
Callbacks aren't supposed to have ;'s at the end.
Is the door named "mansion_3" and the key prisonkeylight_1?
(03-19-2011, 02:42 PM)Danarogon Wrote: [ -> ]oh! i think i found it!
in the
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
you missed ; at the end!
void UsedKeyOnDoor(string &in asItem, string &in asEntity);
this is the correct one... i hope it helps
The video didn't tell me to put the ";". Besides, when i put the ";" it gives me an error said "Unexpected {".
oh... right sorry i haven't noticed i didn't had it either in my own code... well so the best thing i can tell you is that try to save the map before you test it... sometimes stupid stuff like thus happens because i fergot to save the map. or you cold try to make code from scratch again and if it does not work i hope someone whit more knolage about scripting than me helps you out.
You wrote Onstart().
It has to be OnStart().
Noticed the difference?
(03-19-2011, 04:17 PM)Pandemoneus Wrote: [ -> ]You wrote Onstart().
It has to be OnStart().
Noticed the difference?
In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future!
(03-19-2011, 07:54 PM)Nye Wrote: [ -> ] (03-19-2011, 04:17 PM)Pandemoneus Wrote: [ -> ]You wrote Onstart().
It has to be OnStart().
Noticed the difference?
In case you don't notice the difference, it needs to be capitalised 100% accurately. Scripting is very case sensitive, so be careful in future!
I see the difference. Onstart = OnStart, i forgotten the capital S.
Thanks.