Just need some help scripting, im a beginner - 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: Just need some help scripting, im a beginner (/thread-8254.html) |
Just need some help scripting, im a beginner - willochill - 05-26-2011 okay, so im like a complete noob at scripting, like i'm stumped with a lot of stuff. I have an area in my map. In this area, when the player walks by, I want a grunt to be alerted, but ONLY if the player has a certain item in the inventory. How would I script this? (let's call the area Area1 and the item Item1). thx, im just stumped here. RE: Just need some help scripting, im a beginner - triadtimes - 05-26-2011 The way I did it awhile back was this: In the OnStart I had this: Code: AddEntityCollideCallback("Player", "Area1", "FunctionName", false, 1); And the actual function looked like this: Code: void FunctionName(string &in asParent, string &in asChild, int alState) What would happen is the function would trigger every time the Player walks past but a certain action wouldn't be taken until the Player has Item1. (Depending on the action you may also need to put a variable in to stop it from happening more than once.) RE: Just need some help scripting, im a beginner - Kyle - 05-26-2011 (05-26-2011, 04:02 AM)willochill Wrote: okay, so im like a complete noob at scripting, like i'm stumped with a lot of stuff. I have an area in my map. In this area, when the player walks by, I want a grunt to be alerted, but ONLY if the player has a certain item in the inventory. How would I script this? (let's call the area Area1 and the item Item1). thx, im just stumped here. Code: void OnStart() MonsterName is meant to be replaced with the name of the monster that's spawned. I have to set the bool abOnDelete for the AddEntityCollideCallback because if the player doesn't have the object and when they walk through, it would stop the function from working because it's deleted and also nothing would happen. So when the player does have the item, it sets the monster active and then prevents the player from accidently colliding with Area1 after the script was used. |