PDA

View Full Version : Door toggle cog (maybe not what you think)



Vertigobot
10-27-2000, 02:30 PM
Alright, I know next to nothing about cog (sorry)... I've been trying to find a certain cog, but I can't locate anything close yet. Here's what I need: A cog that closes a door when a player enters a sector.. BUT it gets more complicated. I need it so that if a player "activates" a certain object (the object then would move to frame 1, indicating that it has been toggled) the door won't close for x amount of seconds.
I don't know how doable this is... I'll give you credit in the file readme (of course) if you can help me out (unless you want no indication that you are in any connected to this level, heh heh). Thanks for your time

Keith8_8000
10-28-2000, 04:15 PM
I think I can help. So you want a door that closes when a player enters a sector, then you need to activate a certain thing and it opens and that thing goes to frame 1 to show it is open. Then have the door close after x seconds right? Well I can do that but do you want it also that if you don't get to the door in the x amount of time that the thing moves back? I can do that to if you wish. Well hope I can help! http://forums.massassi.net/html/biggrin.gif

------------------
Keith: "Perhaps there was an age in which people had Knowledge of Magic..."

ThreeDee
10-28-2000, 07:35 PM
try this, I haven't tested it...


symbols

message entered
message activated
message timer

int player local
int shouldIwait=0 local

flex delayTime

thing switch
thing door

sector closeSec

end

code

entered:

if (shouldIwait == 0)
{
MoveToFrame(door, 1);
}
else
{
SetTimer(delayTime);
}

Return;

activated:

if (GetSenderRef() == switch)
{
if (shouldIwait == 0)
{
MoveToFrame(switch, 1);
shouldIwait = 1;
}
else
{
MoveToFrame(switch, 0);
shouldIwait = 0;
}
}

Return;


timer:

MoveToFrame(door, 1);

Return;

end

I'm reasonably sure that'll do it. When you put it into Jed there are a few things you'll have to define:

delayTime - time to delay closing of door if switch is activated

switch - thing ID of the switch thing

door - door thing

closeSec - when you enter this sector the door closes

[This message has been edited by ThreeDee (edited October 28, 2000).]

[This message has been edited by ThreeDee (edited October 28, 2000).]

Vertigobot
10-30-2000, 07:13 AM
Ok, sorry about the rather incoherent first post, my brain was fried after school. To clarify, I'll give the duties of the cog in a couple basic sections.
Ok, first:
The door moves to frame 1 when a player enters a sector, moving at a x speed and stays there for x seconds.

Secondly:
If a player "activates" the switch (which moves to frame 1, at x speed for x amount of seconds) the door will NOT move to frame 1 when the player enters the sector.

I'm trying to make a "trap door" type of thing, the door will close and trap the player unless the switch is flipped. I tried to do this myself and it didn't work out. The easiest way I can figure to have the door check if the switch is flipped is simply to have it check if the switch is at frame 0, if it is, then it will close (much like the frame check on a normal door cog). Am I making sense now? Thanks for the feedback.