How to make a hallucination event. - 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: How to make a hallucination event. (/thread-7262.html) |
How to make a hallucination event. - ZxBrad - 04-09-2011 I just need help on setting up a event for walking in a room and a monster pops out of the cabinet and disappears. RE: How to make a hallucination event. - larslu - 04-09-2011 (04-09-2011, 01:29 PM)ZxBrad Wrote: I just need help on setting up a event for walking in a room and a monster pops out of the cabinet and disappears. Click on the monster you want to hallucinate. Then you see the general things of the monster on your right. Go to the entity of that. Check the box of Hallucination and choose the distance at which distance you want to the monster disappear (HallucinationEndDist). RE: How to make a hallucination event. - ZxBrad - 04-09-2011 (04-09-2011, 01:34 PM)larslu Wrote:(04-09-2011, 01:29 PM)ZxBrad Wrote: I just need help on setting up a event for walking in a room and a monster pops out of the cabinet and disappears. I did that. but how will the game know when to activate the monster at the right time. RE: How to make a hallucination event. - Dalroc - 04-09-2011 This is taken directly from Scripts Recollection, the stickied thread on top of this forum. Always check if what you need has been posted there already! Code: void OnStart() RE: How to make a hallucination event. - ZxBrad - 04-09-2011 I put those in heres my hps file rite now. Code: //////////////////////////// And when i try to start my map up it crashes on me. RE: How to make a hallucination event. - Henriksen - 04-09-2011 [size=xx-small] (04-09-2011, 02:40 PM)ZxBrad Wrote: I put those in heres my hps file rite now. It should be like this i think: // Run first time starting map void OnStart() { SetMessage("Journal", "start", 8.0f); AddUseItemCallback("", "doorkey_1", "castle_1", "UsedKeyOnDoor", true); AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("castle_1", false, true); PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false); RemoveItem("doorkey_1"); } void MonsterFunc1(string &in asParent , string &in asChild , int alState) { SetEntityActive("servant_grunt_1" , true); } RE: How to make a hallucination event. - Dalroc - 04-09-2011 (04-09-2011, 02:40 PM)ZxBrad Wrote: I put those in heres my hps file rite now.As you can see in the AddUseItemCallback you have a "AutoDestroy" parameter, that means you can set that too true and you won't have to remove the item with RemoveItem("doorkey_1");. Code: void AddUseItemCallback(string& asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy); The thing that is crashing your game is this part Code: { Code: // Run first time starting map RE: How to make a hallucination event. - ZxBrad - 04-09-2011 I did that. but then i added a new key to my map and a unlock door script thing and im getting another crash now. Heres my script. And srry if im not getting it my signature clearly states im a noob. Code: // Run first time starting map RE: How to make a hallucination event. - Dalroc - 04-09-2011 (04-09-2011, 03:16 PM)ZxBrad Wrote: I did that. but then i added a new key to my map and a unlock door script thing and im getting another crash now. Heres my script. And srry if im not getting it my signature clearly states im a noob.You are lacking the fundamental basic knowledge of scripting. The braces ({ and }) notes the beginning and start of a function (or a for-loop or a if conditional), everything you want to happen within a function has to be placed between the braces. The OnStart function is called when the map is first loaded, so if you want any other function in your script you will have to call that function within the Onstart function. Thats why you have the Callbacks, they will call the function it's told to call. So as you probably understand the functions need names to be called, that's what the OnStart, UsedKeyOnDoor and MonsterFunc1 is. As you can see in your code you have a function that has no name. Code: { This means that when you use "exitkey_1" on "metal_1" you will call the function to unlock "castle_1". So you will have to make the new ItemCallback call your nameless function, or you modify your "UsedKeyOnDoor" to a generic unlock function that work for several doors (search forums for this). I really can't learn you too script, please read some easy guide, or just look through some other people scripts and learn from that. It's not that hard! P.S. Also, look at my last post what I said about the key being removed automatically by the ItemCallback.. If you are going to ask for help on the forums at least make use of the help you get. |