Rotating cogs bugging like mad - 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: Rotating cogs bugging like mad (/thread-16651.html) |
Rotating cogs bugging like mad - ApeCake - 07-01-2012 I wanted some rotating cogs in my machine room, so I placed some elevator_machine_cog_small entities in my map. Then I wrote this script; void OnStart() { RotatePropToSpeed("elevator_machine_cog_small_1", 0, 5, 1, 1, 1, false, ""); RotatePropToSpeed("elevator_machine_cog_small_2", 0, 4, 0, 1, 0, false, ""); RotatePropToSpeed("elevator_machine_cog_small_3", 0, 6, 0, 1, 0, false, ""); RotatePropToSpeed("elevator_machine_cog_small_4", 0, 2, 0, 1, 0, false, ""); RotatePropToSpeed("elevator_machine_cog_small_5", 0, 2, 0, 1, 0, false, ""); RotatePropToSpeed("elevator_machine_cog_small_6", 0, 4, 0, 1, 0, false, ""); } However, the cogs do not move the way I want it to. Right now only one of them is visible somehow and is spinning through the ground. I checked the axis', and I think I chose the right one. I clicked on one of the cogs and spinned them in the level editor and saw that the Y was increasing. So I added 1 to Y (not sure about the first cog, but 2-6 is should be all Y). However, it STILL does this. Any help? I looked at the machine room from The Dark Descent but the code was kind of confusing, and the only part I think to get it working is RotatePropToSpeed. Thanks in advance. RE: Rotating cogs bugging like mad - Your Computer - 07-01-2012 Not sure which way you want the first one to rotate, but i don't think 1x, 1y, 1z would yield any logical spinning. As for the others not showing up, that could be a map_cache issue. RE: Rotating cogs bugging like mad - Adny - 07-01-2012 As for them not appearing in game, try deleting any MAP_CACHE files. They can cause many bugs and prevent updates in the level editor from appearing in game. The map cache file can be found in the same folder as your map and hps files. As for the Scripting portion, it definitely needs some work. RotatePropToSpeed is a simple function once you understand each part of it. Since I don't have the map file, I cannot be sure which axis to apply the rotation to. RotatePropToSpeed(string& asName, float afAcc, float afGoalSpeed, float afAxisX, float afAxisY, float afAxisZ, bool abResetSpeed, string& asOffsetArea); asName = "NAMEOFCOG" afAcc = Acceleration (1.0f is fine) afGoalSpeed = The full speed it will rotate after initial acceleration (1.0f is fine) afAxis X/Y/Z = The axis it will rotate on. abResetSpeed = Resets the speed after goal speed is reached (I honestly see no use for this, false is fine) asOffsetArea = The area the entity will rotate around. Leaving it blank ("") is fine for cogs, so they will rotate around the center of themselves. In the end, it should look something like this: RotatePropToSpeed("NAMEOFCOG", 1, 1, 0, 0, 0, false, ""); ///you shouldn't use any value over 1. For the 0's, replace one of them with either a positive or negative 1 (positive/negative change the direction they spin on the axis i.e. left/right). The rotation of the axis is directly connected to its rotation in the level editor (i.e. x=x, y=y, z=z), so that shouldn't be a problem; worst case scenario, reload the map using each different axis, you'll get the right one pretty quickly. Hope that helped. RE: Rotating cogs bugging like mad - ApeCake - 07-01-2012 Hm. I do not have a map_cache file, I deleted that a while ago. Any ways of getting the game to create a new one so I can delete it (if that makes any sense)? RE: Rotating cogs bugging like mad - Datguy5 - 07-01-2012 (07-01-2012, 04:17 PM)ApeCake Wrote: Hm. I do not have a map_cache file, I deleted that a while ago. Any ways of getting the game to create a new one so I can delete it (if that makes any sense)?Map cache is created every time you play the map. RE: Rotating cogs bugging like mad - Damascus - 07-01-2012 I don't remember whether RotateProptoSpeed uses local or world coordinates, but if it's spinning wrong you must just be using the wrong axis. Try using a different one until it rotates correctly. RE: Rotating cogs bugging like mad - ApeCake - 07-01-2012 I still don't have a map_cache file. I played through my whole map twice now and I still do not have it. RE: Rotating cogs bugging like mad - Adny - 07-01-2012 It will only appear if you're using dev settings, which are explained at length here: http://www.youtube.com/watch?v=Rzkwl6IXvaA I highly suggest you use those, it makes map testing and bug/error corrections sooooo much easier. Also, check out the rest of the videos in his series if you got the time, they're pretty well done. RE: Rotating cogs bugging like mad - ApeCake - 07-01-2012 Thanks Andy, I had it turned off for a while now. So I was testing the cogs, but the cogs still weren't visible after I deleted the map_cache. Turns out, they are actually there, you can jump on it and stuff, you just can't see it. I placed the same cog, but the normal size in the map (the others were all stretched out with that one tool) and that one was visible. So, you can't make the cogs any bigger? That would be such a shame if it was that way. And it would totally ruin my puzzle. With small cogs it just doesn't seem dangerous, and the puzzle is supposed to look dangerous. I will now, once again, try out the RotatePropToSpeed. But this time, on the small cogs. Edit: Seems to be working. Thanks! Too bad they move pretty slow. |