![]() |
HasItem problem [SOLVED] - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html) +--- Thread: HasItem problem [SOLVED] (/thread-7259.html) |
HasItem problem [SOLVED] - Linus Ågren - 04-09-2011 What's wrong with this code? I have the key but it doesn't trigger the event. Code: void CollideAreaLiving(string &in asParent, string &in asChild, int alState) The code still won't get triggered if I have that key. What's wrong with it? RE: HasItem problem - Pandemoneus - 04-09-2011 Mind posting the error message? RE: HasItem problem - Linus Ågren - 04-09-2011 Oh sorry, I forgot to remove that part. Edited post above. The problem is now only that the script won't get activated even if I have the item. RE: HasItem problem - Dalroc - 04-09-2011 Remove the " == true" from if(HasItem("key_storage") == true), like this Code: void CollideAreaLiving(string &in asParent, string &in asChild, int alState) RE: HasItem problem - Linus Ågren - 04-09-2011 The collidebox STILL won't get triggered o0. RE: HasItem problem - Dalroc - 04-09-2011 Could you post the EntityCollideCallback that calls CollideAreaLiving? RE: HasItem problem - Linus Ågren - 04-09-2011 Sure, here you go: AddEntityCollideCallback("Player", "AreaLiving", "CollideAreaLiving", true, 1); RE: HasItem problem - Dalroc - 04-10-2011 Spotted the problem (I think). You are destroying the Callback when it's triggered the first time. Set abDeleteOnCollide to false and it should work.. You will have to find another way to remove the Callback only when you have the item. Example would be to use a variable and add a condition to your if conditional to only execute when the player has the key AND when the variable has the right value. RE: HasItem problem - Linus Ågren - 04-22-2011 YES! It works! I never realized it would be such an easy answer. Thanks a thousand times. I've been trying to figure out why it didn't work for so long! ![]() RE: HasItem problem [SOLVED] - Dalroc - 04-22-2011 Glad I could help! ![]() |