What can I do to this cog to ensure that the player is thrust right up through all the selected sectors? At the moment, the player seems to slowly lose momentum and stop somewhere in the second sector. Removing the 'no gravity' flag made the thrust too weak to get off the ground:
[This message has been edited by rob_whatman (edited November 16, 2002).]
Code:
# Jedi Knight Cog Script
#
# antigrav_lift.cog
#
# Script to start sector thrust by activating switch
#
# Based on code of [DB] with code from mdm10_window.cog
#
# not supported by Lucasarts Inc.
symbols
message startup
message activated
message timer
sector sector0
sector sector1
sector sector2
int currentThing local
int i local
surface switch01 mask=0x448 linkid=1
sound thrustsnd=18particlestream01.wav
vector playerVec local
vector vec0 desc=thrust_direction
int speed
int channel=-1 local
end
## Code Section
code
startup:
SetWallCel(switch01, 0);
return;
activated:
if (GetSenderID()==1) SetWallCel(switch01, 1);
if (GetWallCel(switch01)==1)
{
channel=PlaySoundPos(thrustsnd, GetSectorCenter(sector0), 1.0, 0.5, 1.5, 1);
SetSectorFlags(sector0,0x9);
SetSectorFLags(sector1,0x9);
SetSectorFlags(sector2,0x9);
SectorThrust(sector0, vec0, speed*20);
SectorThrust(sector1, vec0, speed*20);
SectorThrust(sector2, vec0, speed*20);
currentThing = FirstThingInSector(sector0);
while (currentThing != -1)
{
call antigravpull;
currentThing = NextThingInSector(currentThing);
}
currentThing = FirstThingInSector(sector1);
while (currentThing != -1)
{
call antigravpull;
currentThing = NextThingInSector(currentThing);
}
}
return;
antigravpull:
if (GetThingType(currentThing) == 10) {
DetachThing(currentThing);
playerVec = GetThingVel(currentThing);
playerVec = VectorAdd(vec0, playerVec);
SetThingVel(currentThing, playerVec);
}
return;
end[This message has been edited by rob_whatman (edited November 16, 2002).]