Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Eureka!
Eureka!
2002-06-18, 3:52 AM #1
Last night, I finally managed to get an object to move between 2 points, without frames. The object's parent template is walkstruc, too. [http://forums.massassi.net/html/smile.gif]


If anyone cares to know how, reply, and Ill tell you... [http://forums.massassi.net/html/biggrin.gif]


(Grismath, if you ever intend to get doors, elevators, or any non-static object into your TCS, youd better hear what I have to say... [http://forums.massassi.net/html/wink.gif] )

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-06-18, 3:14 PM #2
I'm interested...

Raynar
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2002-06-18, 4:03 PM #3
I'm curious. [http://forums.massassi.net/html/smile.gif]

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-06-18, 5:15 PM #4
Ok. [http://forums.massassi.net/html/smile.gif]


First, keep in mind my goal; To create doors and elevators that will act and sound as normal, but not use frames or soundclasses. This is because they are created ingame without ghosts...

First, the following must be added to the door template:

Code:
move=physics surfdrag=0 airdrag=0 mass=0 height=0.043038 physflags=0x425d


The 'hight' variable will be different for every model, and it took me awhile to get it right for my test template. The physics flags make the object walkable, while still retaining the movephysics. The lack of mass and friction make the object only react to specific forces (IE, setthingvel).


Then, of course, the cog. Ill give you the actual code, because this is just the POC code I wrote to test my theories.

Code:
# Cog based door movement POC - contained.
#
# 06/2002 GBK - Packman573@aol.com
Symbols
Message Startup
Message Activated
Message Pulse
Message Timer
Thing Door				Local
Vector Pos
Sector Pos_s
Template Type
Vector Frame0
Vector Frame1
Vector Dir0
Vector Dir1
Flex Target=0.025
Int Posi=0			Local
Flex Sleeptime
End
Code
Startup:
Sleep(0.5);
Door = Createthingatpos(Type, Pos_s, Pos, '0 0 0');
Capturething(Door);
Stop;

Activated:
If(Isthingmoving(Door) != 0 || Posi != 0) Stop;
Print("Started");
Posi = 1;
Setthingvel(Door, Dir0);
Setpulse(0.01);
Stop;


Pulse:
If(Posi == 1) { Printflex(Vectordist(Getthingpos(Door), Frame1));
If(Vectordist(Getthingpos(Door), Frame1) <= Target) { Stopthing(Door);
Posi = 2;  Settimer(Sleeptime); Print("Frame1"); }
Else { Stopthing(Door); Setthingvel(Door, Dir0);} }
If(Posi == 3) { Printflex(Vectordist(Getthingpos(Door), Frame0));
If(Vectordist(Getthingpos(Door), Frame0) <= Target) { Stopthing(Door);
Posi = 0; Setpulse(0); Print("Frame0"); }
Else { Stopthing(Door); Setthingvel(Door, Dir1);} }
Stop;

Timer:
Setthingvel(Door, Dir1);
Posi = 3;
Stop;
End



Do note, in the end version, all the frame and dir values will be passed to the cog by the master controller, and this cog is actully a class cog...


For all of those who dont have the time to decypher my code, or just dont know how, ths is how it works;

1) The object is set in motion in a specific direction (prefferrably toward its destination frame...)

2) A high pulse is set, looking for the distance between the object and the target frame. The wider the target distance, the less the chance of it missing, and getting stuck. But, the wider the target, the more error in position. (Not good for small doors... Which means that they will have to travel slowly in order to be reliable.)

3) When the target distance is achieved, the obejct is stopped, and a timer is set.

4) The object is set in motion back towards its original position.

5) Repeat steps 2 & 3.




What took me so long? Getting those damn templates figured out. [http://forums.massassi.net/html/frown.gif]


Anyway, it works. I can now go about the rather exigent task of writing the Door & Elevator module for the TVTCS... [http://forums.massassi.net/html/biggrin.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-06-19, 5:37 AM #5
So long thinglimit!
APT 1, 2, 3/4, 5/6
TDT
DMDMD

http://veddertheshredder.com
2002-06-19, 2:42 PM #6
That looks like a good system. Is it indistinguishable from the regular frame movement?

------------------
Author of the JK DataMaster, Parsec, and the EditPlus Cog Files.
Visit Saber's Domain.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-06-19, 5:46 PM #7
Indistinguishable, to the end user? Yes, as long as the system is set up properly. But the editor will have to make a few extra steps in installing doors.


But, the really great news is, ANY object can now be tvtcs controlled, including doors and elevators... [http://forums.massassi.net/html/biggrin.gif] (In other words, yes, goodbye thinglimit!)

Thanks for the comments, guys.. BTW, feel free to use this method, for anything... Just be sure to mention me.. [http://forums.massassi.net/html/wink.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-06-20, 12:21 AM #8
/me scribbles down notes.

GBK, what about the powerups though, are you just going to assign them an extra value which would be set to 0 if they've been taken?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-06-20, 5:32 AM #9
Well, the powerups will be done similarly to the enemy generator.

There is a third command, 1003 - 'save status & destroy'. This command records the object's status, (The enemy generator also saves the object's position and health), and checks that value before recreating the set.



Oops, Ive said too much.. [http://forums.massassi.net/html/eek.gif]

------------------
I used to believe that we only want what we can't have. I was wrong. The truth is, the wonderful truth is, we only want what we think we can't have.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!