[SCRIPT] Rotating Bookshelf, Goblets move with it, but not books? - 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] Rotating Bookshelf, Goblets move with it, but not books? (/thread-16050.html) |
Rotating Bookshelf, Goblets move with it, but not books? - Ananaias - 06-11-2012 In my custom story, I have a bookshelf that moves to reveal a secret doorway, that is activated by a switch being pulled. I had no items on it, and it looked really plain, so I added books and some Goblets to spice it up. However, I've come across an issue. When the bookshelf rotates, the goblets go with it, but the books themselves don't. They just stay in their original position, but floating in the air. Here's my script: PHP Code: void OnStart() RE: Rotating Bookshelf, Goblets move with it, but not books? - Ermu - 06-11-2012 Are the books entities or static_objects? If they're static_objects, i don't think there's anything to do, except to remove them. If they're entities, try this: AddAttachedPropToProp(string& asPropName, string& asAttachName, string& asAttachFile, float afPosX, float afPosY, float afPosZ, float afRotX, float afRotY, float afRotZ); Attaches a prop to another prop. asPropName - the prop to attach another prop at asAttachName - internal name of the prop that gets attached asAttachFile - the prop that gets attached extension .ent afPosX - X position of the attach from the prop afPosY - Y position of the attach from the prop afPosZ - Z position of the attach from the prop afRotX - rotation around X axis of the attach afRotY - rotation around Y axis of the attach afRotZ - rotation around ZX axis of the attach Note: for the purposes of “AddEntityCollideCallback”, attached props will not call the callback function if they collide with a “static_object” or a “StaticProp” entity type! Bug: afRotZ is used for both the ZX rotation and the Z position of the attached prop. Unwanted rotation can be avoided by using: AddAttachedPropToProp(asPropName,asAttachName,asAttachFile,afPosX,afPosY,0,afPosZ,90.0f,afPosZ) Bug: Attaching a breakable prop to a physically active prop, and then breaking the attached prop, will cause the game to crash should the parent object be moved or reset. I personally don't have really much experience on this, so i have no idea if that will work. Hope someone else has. RE: Rotating Bookshelf, Goblets move with it, but not books? - i3670 - 06-11-2012 Those books you are using aren't even meant to be moved. Tip: Use the regular books instead, the ones you can move by hand. RE: Rotating Bookshelf, Goblets move with it, but not books? - MaZiCUT - 06-11-2012 If these are static objects theres not much to do, unless you use entities or you're a good scripter that can do this instead: Make each of the static bookpiles/books a script for it to move once you use the lever giving them their own position to move and rotate and then you try to get the rotation and position same as the bookshelves, but i recommend using entities and go with the guy above me. RE: Rotating Bookshelf, Goblets move with it, but not books? - Ananaias - 06-12-2012 Okay, instead of doing all that stuff (sounds complicated, and I'm tired), would it be possible to make it so that they despawn, then instead, maybe there's a pile of books infront of the shelf after being moved? I tried using SetEntityActive("bookset1" false); and that didn't work. RE: Rotating Bookshelf, Goblets move with it, but not books? - Adny - 06-12-2012 (06-12-2012, 07:40 AM)Ananaias Wrote: Okay, instead of doing all that stuff (sounds complicated, and I'm tired), would it be possible to make it so that they despawn, then instead, maybe there's a pile of books infront of the shelf after being moved?I think everyone's overcomplicating this; just put books on the shelf that you can normally interact with in the game; no book rows or piles because those are static entities(aka they won't move) but single (unopened) books are normal entities and can be interacted with/used because they will move with the bookshelf. RE: Rotating Bookshelf, Goblets move with it, but not books? - Ananaias - 06-12-2012 Alright. But is there a way to make them despawn, or no? If not, I'll do it that way. RE: Rotating Bookshelf, Goblets move with it, but not books? - Datguy5 - 06-12-2012 (06-12-2012, 10:52 AM)Ananaias Wrote: Alright. But is there a way to make them despawn, or no? If not, I'll do it that way. You cant set static_objects inactive(atleast i think).Unless you turn them into entities. RE: Rotating Bookshelf, Goblets move with it, but not books? - SilentStriker - 06-12-2012 Why don't you just turn the book rows to entities and there we go RE: Rotating Bookshelf, Goblets move with it, but not books? - Adny - 06-12-2012 (06-12-2012, 07:14 PM)SilentStriker Wrote: Why don't you just turn the book rows to entities and there we goBook rows are technically entities, but they are static entities (confusing, I know). Static entities are things like cogs; they have the same interactions as static objects unless acted upon by a script (ie using rotateprop to make cogs spin for a machine) |