[SCRIPT] why wont this work? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: [SCRIPT] why wont this work? (/thread-12918.html) |
why wont this work? - oscar1007 - 01-28-2012 So, the player har a jar in his inventory, now when he uses that on a body part of a dead grunt, i want the player to get a different jar (filled with blood). This is my script: void OnStart() { AddUseItemCallback("", "hollow_needle_1", "grunt_body_part2_1", "take_blood", true); } void take_blood(string &in asItem, string &in asEntity) { GiveSanityBoostSmall(); RemoveItem("glass_container_1"); GiveItem("", "glass_container_blood_1", "glass_container_blood_1", "glass_container_blood_1.tga", 1.0f); } The "glass_container_blood_1" is in the map, i just placed it so the player cant get it. And, when i try to use the jar in game, nothing happens. It says cant use item this way or something. Why wont this script work? Thanks! RE: why wont this work? - palistov - 01-28-2012 You scripted "hollow_needle_1" to be used on the grunt part, change it to "glass_container_1" and it should work. Also, your GiveItem line has some errors: The first argument, which you left empty, needs to be the item's internal name. In this case it looks like you want it to be called "glass_container_blood_1", right? The second argument is the item's filename. Change it to "glass_container_blood". You don't want the "_1" there because that's just the item's index, which is simply a way to keep track of unique objects in the map, in case you so choose to place multiple ones of the same type. The third argument is the item type. There are a few different types, but don't worry about that, just change it to "Puzzle". The fourth argument is the image type. Again, remove the "_1". The last argument is supposed to be an integer. You put a floating point value. The wiki says it's a float but that begs the question: How do you acquire 1.5f jars? Anyways, I don't think it really matters because if you convert a float to an integer I believe it simply rounds down. But it wouldn't hurt to change it RE: why wont this work? - oscar1007 - 01-28-2012 (01-28-2012, 02:49 PM)palistov Wrote: You scripted "hollow_needle_1" to be used on the grunt part, change it to "glass_container_1" and it should work.Thank you. it works now btw, you were suppose to use the needle RE: why wont this work? - palistov - 01-28-2012 Ah, ok. It said in your original post "when you use the jar", that's what got me confused hehe. |