Re: Cog help


[ Follow Ups ] [ Post Followup ] [ The Massassi Temple Message Board ]

Posted by Rishka on May 05, 1998 at 22:24:35:

In Reply to: Cog help posted by Entropy on May 05, 1998 at 22:00:55:

Here, try this... it SHOULD work. (no guarantees, I didn't try it in JK yet) You just left out a section of code and had a few things missing. I will start working on a cog tutorial as soon as I finish work on my current project. =)


Symbols
message activated
message entered
message timer
sector thrustsec
vector vec desc=thrust_direction
float thrustspeed=1.0 desc=thrust_speed
surface switch linkid=1
sound wav0
sound wav1
sound wav2
flex wait=5.0 ##how long b4 u can shut it down?
flex sounddelay
flex talkdelay

vector playerVec local
int currentThing local
int status=0 local
end

code
activated:
if(status==0)
{
SetWallCel(switch,1);
PlaySoundPos(wav1, SurfaceCenter(switch), 1, -1, -1, 0);
Sleep(sounddelay);
PlaySoundPos(wav1, SurfaceCenter(switch), 1, -1, -1, 0);
Sleep(sounddelay);
PlaySoundPos(wav1, SurfaceCenter(switch), 1, -1, -1, 0);
Sleep(sounddelay);
PlaySoundPos(wav2, SurfaceCenter(switch), 1, -1, -1, 0);
Sleep(talkdelay);
PlaySoundPos(wav0, SurfaceCenter(switch), 1, -1, -1, 0);

SectorThrust(thrustsec, vec, speed);

// unattach all players in sectors
currentThing = FirstThingInSector(sector0);
while (currentThing != -1)
{
call reactorpull;
currentThing = NextThingInSector(currentThing);
}

currentThing = FirstThingInSector(sector1);
while (currentThing != -1)
{
call reactorpull;
currentThing = NextThingInSector(currentThing);
}
SetTimer(wait);
}
else
{
SetWallCel(switch,0);
SetSectorThrust(thrustsec,vec,0);
status=0;
}
return;

timer:
status=1;
settimer(0);
return;

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

reactorpull:
if (GetThingType(currentThing) == 10)
{
DetachThing(currentThing);
playerVec = GetThingVel(currentThing);
playerVec = VectorAdd(vec, playerVec);
SetThingVel(currentThing, playerVec);
}
return;

end



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ The Massassi Temple Message Board ]