script again.. - 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 again.. (/thread-18246.html) |
script again.. - Alento - 09-09-2012 Hey again! Look: void startoven(string &in asEntity, int alState) { if (asName == "ovenlever") { GetEntitiesCollide("contWW_2", "placeWW"); if(alState == -1){ SetEntityActive("contWW_2", false); SetEntityActive("contBmeat", true); } } } What I want, it that the "contBmeat" will be active IF you have placed "contWW_2" at the "placeWW" area. And only when you have placed it there, will the "ovenlever" make the "contBmeat" exist. Do you get what I mean? I've never used "GetEntitiesCollide", how does it work? In general, what does "bool" mean exactly, cuz in Engine script, it says bool before GetEntitiesCollide, what does it mean? please help me asap! need to continue the scripting. and this is in my path to do that.. Peace! RE: script again.. - Adny - 09-10-2012 If you look in the HPL2 Engine Scripts Wiki, you will see any "Get" function prefaced with something like bool, int, or float. bool (Boolean) means true or false, int (Integer) means a whole number and float is a decimal (i.e. 27.8f). Based on whether it is bool, int, or float will dictate what you put after the "==". "GetEntitiesCollide" is used to check if two entities are in contact with one another. It is generally used with a movable entity and a script area ("Player" isn't compatible with this function, and the 2 entities must be able to enter one another, not just make surface contact.) As for your script problem, there are a few questions I'd like to ask before delving into this: -Are you using the extraction oven from entities/lab -What entities (items) correspond to the name? It would be tremendously helpful if I knew what "contWW_2" or "placeWW" were. If I try to make guesses, there is a much higher chance of me not being able to help you properly. RE: script again.. - Alento - 09-10-2012 (09-10-2012, 12:15 AM)andyrockin123 Wrote: If you look in the HPL2 Engine Scripts Wiki, you will see any "Get" function prefaced with something like bool, int, or float. bool (Boolean) means true or false, int (Integer) means a whole number and float is a decimal (i.e. 27.8f). Based on whether it is bool, int, or float will dictate what you put after the "==".Oh! okey, sooo.. am I using the right code, or should I use another? Or is it after the "==" i have to change something? RE: script again.. - Adny - 09-10-2012 Like I said before, until I'm sure what entities correspond with what names in the script I couldn't tell you if you are using them correctly. I understand what you're trying to accomplish, I just don't understand what a "contWW_2" (or any other name) is in game. RE: script again.. - Alento - 09-10-2012 (09-10-2012, 12:28 AM)andyrockin123 Wrote: Like I said before, until I'm sure what entities correspond with what names in the script I couldn't tell you if you are using them correctly. I understand what you're trying to accomplish, I just don't understand what a "contWW_2" (or any other name) is in game.oh.. sorry.. okey. here it is! void startoven(string &in asEntity, int alState) { GetEntitiesCollide("contWW_2", "placeWW"); if (GetEntitiesCollide("contWW_2", "placeWW") == true);<-- contWW_2 is a container, placeWW is an area { if(alState == -1){ SetEntityActive("contWW_2", false); SetEntityActive("contBmeat", true); <-- another container which should replace the other one. } } } did that help more? used by this: SetEntityConnectionStateChangeCallback("ovenlever", "startoven"); RE: script again.. - Adny - 09-10-2012 First, in the level editor find the area "placeWW", in the second tab, make sure "Item Interaction" is checked. Here's the script based on what I think you're trying to accomplish: void OnStart() { SetLocalVarInt("PlaceItemVar", 0); AddUseItemCallback("", "contWW_2", "placeWW", "ItemInOven", true); ///when the player uses "contWW_2" on "placeWW", it triggers "ItemInOven". SetEntityConnectionStateChangeCallback("ovenlever", "PullLever"); //Triggers the function "PullLever" when the lever is pulled. } void ItemInOven(string &in asItem, string &in asEntity) //Removes the item from inventory, adds a variable { RemoveItem(asItem); AddLocalVarInt("PlaceItemVar", 1); } void PullLever(string &in asEntity, int alState) //If the variable is 1 and the lever is pulled, "contBmeat" will be set active { if(GetLocalVarInt("PlaceItemVar") == 1 && alState == -1) { SetEntityActive("contBmeat", true); } } I hope that's more along the lines of what you want to accomplish;l if there are still any issues/problems, reply back with explicit detail of exactly you want the player to do for this puzzle. Hope that helped! |