Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotating cogs bugging like mad
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#1
Rotating cogs bugging like mad

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.

[Image: Ff7q8.jpg]

Thanks in advance.
(This post was last modified: 07-02-2012, 06:37 PM by ApeCake.)
07-01-2012, 03:09 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Rotating cogs bugging like mad

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.

Tutorials: From Noob to Pro
07-01-2012, 03:23 PM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Rotating cogs bugging like mad

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.

I rate it 3 memes.
07-01-2012, 03:36 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#4
RE: Rotating cogs bugging like mad

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)?
07-01-2012, 04:17 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#5
RE: Rotating cogs bugging like mad

(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.

07-01-2012, 04:36 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
RE: Rotating cogs bugging like mad

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.

07-01-2012, 05:30 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#7
RE: Rotating cogs bugging like mad

I still don't have a map_cache file. I played through my whole map twice now and I still do not have it.
07-01-2012, 08:49 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#8
RE: Rotating cogs bugging like mad

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.

I rate it 3 memes.
07-01-2012, 09:19 PM
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#9
RE: Rotating cogs bugging like mad

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.
(This post was last modified: 07-01-2012, 10:19 PM by ApeCake.)
07-01-2012, 09:55 PM
Find




Users browsing this thread: 1 Guest(s)