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 → A different Elevator Cog if you please...
A different Elevator Cog if you please...
2002-12-07, 11:36 AM #1
Hey gang, I need a different kind of elevator cog. It's very basic, i think, but what it should do is that multiple elevators (atleast 20) can be activated with only 1 surface switch. Then, they sleep at the second frame until the switch is pushed again, then they go back to their original frame. Hope someone can get this.
Who made you God to say "I'll take your life from you"?
2002-12-07, 1:39 PM #2
Here ya go.
Code:
# Jedi Knight Cog Script
#
# Elevator cog for Trige
#
# [DP]
#

symbols
thing          elevator
thing          elevator1               nolink
thing          elevator2               nolink
thing          elevator3               nolink
thing          elevator4               nolink
thing          elevator5               nolink
thing          elevator6               nolink
thing          elevator7               nolink
thing          elevator8               nolink
thing          elevator9               nolink
thing          elevator10              nolink
thing          elevator11              nolink
thing          elevator12              nolink
thing          elevator13              nolink
thing          elevator14              nolink
thing          elevator15              nolink
thing          elevator16              nolink
thing          elevator17              nolink
thing          elevator18              nolink
thing          elevator19              nolink

surface        switch
sound          wav=Activate02.wav

flex           speed
int            i                       local

message        activated
message        arrived

end

# ........................................................................................
code

Activated:
   If((GetSenderRef() != switch)||(GetWallCel(swithc) == 1)) Return;
   For(i=0; i<20; i=i+1) MoveToFrame(elevator, 1-GetCurFrame(elevator), speed);
   SetWallCel(switch, 1);
   PlaySoundPos(wav, SurfaceCenter(switch), 0.6, -1, -1, 0);
   Return;

# ........................................................................................

Arrived:
   SetWallCel(switch, 0);
   PlaySoundPos(wav, SurfaceCenter(switch), 0.6, -1, -1, 0);
   Return;

end

That should work, any questions or comments?

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

[This message has been edited by Descent_pilot (edited December 07, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-12-07, 4:07 PM #3
sorry man, but the cog didn't work. It looked like it would though.
Who made you God to say "I'll take your life from you"?
2002-12-07, 4:20 PM #4
Code:
# Jedi Knight Cog Script
#
# Elevator cog for Trige
#
# [DP], GBK
#

symbols
thing          elevator0
thing          elevator1               nolink
thing          elevator2               nolink
thing          elevator3               nolink
thing          elevator4               nolink
thing          elevator5               nolink
thing          elevator6               nolink
thing          elevator7               nolink
thing          elevator8               nolink
thing          elevator9               nolink
thing          elevator10              nolink
thing          elevator11              nolink
thing          elevator12              nolink
thing          elevator13              nolink
thing          elevator14              nolink
thing          elevator15              nolink
thing          elevator16              nolink
thing          elevator17              nolink
thing          elevator18              nolink
thing          elevator19              nolink

surface        switch
sound          wav=Activate02.wav

flex           speed
int            i                       local

message        activated
message        arrived

end

# ........................................................................................
code

Activated:
   If((GetSenderRef() != switch)||(GetWallCel(switch) == 1)) Return;
   For(i=0; i<20; i=i+1) MoveToFrame(elevator0, 1-GetCurFrame(elevator0), speed);
   SetWallCel(switch, 1);
   PlaySoundPos(wav, SurfaceCenter(switch), 0.6, -1, -1, 0);
   Return;

# ........................................................................................

Arrived:
   SetWallCel(switch, 0);
   PlaySoundPos(wav, SurfaceCenter(switch), 0.6, -1, -1, 0);
   Return;

end


And when the moment is right, I'm gonna fly a kite.
2002-12-07, 4:23 PM #5
Don't mind GBK's, nothin' really different, just that I spelled switch - swithc once in the code. See if you can find it. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

[This message has been edited by Descent_pilot (edited December 07, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-12-07, 4:26 PM #6
Your array was screwed up, too.
And when the moment is right, I'm gonna fly a kite.
2002-12-07, 5:58 PM #7
Uh guys, sorry but, it still doesn't work yet...
Who made you God to say "I'll take your life from you"?
2002-12-07, 6:19 PM #8
There was nothing wrong with my array! Didn't we have a (short) disscussion about the 0 thing?

I don't see how both of the cogs can't work...

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-12-07, 10:02 PM #9
GBK, you should know better than that about JK cog arrays. [http://forums.massassi.net/html/tongue.gif]

even if you've got:

thing poof local
thing misc local
thing bobba local

poof[1] would return the value stored in misc.
-Hell Raiser
2002-12-08, 8:09 AM #10
I don't know what to tell you guys. I plugged in the original cog, it didn't work. I deleted that one and plugged in the revised one, that didn't work. I made sure I copy and pasted it right, and it was. Maybe it's just some small detail that was left out when you made it?
Who made you God to say "I'll take your life from you"?
2002-12-08, 8:21 AM #11
Did you implement it correctly?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-12-08, 9:01 AM #12
yeah, all switch surfaces are correct, all things are correct, everything's in order, but when you hit the switch...nothing.
Who made you God to say "I'll take your life from you"?
2002-12-09, 9:50 AM #13
I don't know, it might've been something I did wrong. Did the cog work for you when you tested it GBK?
Who made you God to say "I'll take your life from you"?
2002-12-09, 5:12 PM #14
I didnt test it, but the code is clean . . . it should work. Go over your implementation again, check your elev's frames, "Numframes" variable, and if that fails, delete it all and reimplement.
And when the moment is right, I'm gonna fly a kite.
2002-12-11, 7:09 AM #15
I just tested it, and it works fine. Recheck your implementation.
And when the moment is right, I'm gonna fly a kite.
2002-12-12, 10:22 AM #16
I don't know what to tell ya GBK. I know you're an excellent cogger (probably the best here) better than me at any rate. It's probably something that I've done. But I've re-implimented it a few times and it still won't work for me. I'll just delete the things and the sectors and then start over.
Who made you God to say "I'll take your life from you"?
2002-12-12, 11:36 AM #17
Let me spell it out.

  • Place one of the elevs.
  • Click on 'Add value'.
  • Leave it as 'Thingflags', and press Enter.
  • Click on 'Add value' again. Change it to 'Numframes'. Press Enter.
  • Click on 'Add value'. Change it to 'Frame'. Enter.
  • Click on 'Add value'. Again, change it to 'Frame'. Press Enter.
  • The object should now have 4 new values:

    Thingflags
    Numframes
    Frame
    Frame
  • Place '2' as the value for 'Numframes'.
  • Move the object to its second position. (the bottom)
  • Click on the "Copy as frame" button.
  • Move the object to its first position. (the top)
  • Click on the second 'Frame' value.
  • Paste the copied frame value.
  • Click on 'Copy as frame'.
  • Paste that into the first 'Frame' value.
  • Duplicate this object. Change its template if neccessary.
  • Add the cog.
  • The object's thing numbers should be in sequence, so just get the first one, and enter in the values on-by-one.
  • Define the switch.
  • Set your speed. 5 should do nicely.
  • Test it. It should work.



The cog is pretty much fool-proof. Your error is problably in either the object's frame setup, or their templates. Check the frames first.
And when the moment is right, I'm gonna fly a kite.
2002-12-12, 12:19 PM #18
Thanks for spelling that out for me GBK, although I said that I was gonna redo the area including the frames and things and sectors.
Who made you God to say "I'll take your life from you"?

↑ Up to the top!