Ahem: (partially based off of Force Farsight, and partially off of my own deluded mind) This is a 'MotS RTS' cog.
It doesn't even start, and yes, I did throw it in the level.
Code:
# Rites of Xanthus TC Cog Script
# Mysteries of the Sith
#
# ARMY0.COG
# 7.20.02
# -by Lord_Grismath (GrismathDynasty@hotmail.com)
#
# The first test of my RTS system for MotS.
symbols
thing player local
thing telething
int done=0 local
int active=0 local
int old_camera local
int camera=-1 local
flex tempFlex local
vector tempvec local
vector tempvec2 local
vector motionVector local
flex startHealth=0 local
vector startPosition local
sound seeingSound=ForceSee01.WAV local
sound seeingSound2=FarSight1.wav local
template camera_tpl=+FarSight local
int farsightEffectHandle=-1 local
int channel=-1 local
int bouncing=0 local
int multiCap=0 local
int oldFlags local
thing com0
thing com1
thing com2
thing com3
thing tempghost local
template gtemp=ghost
int X=0 local
model tmodel local
flex thealth=0 local
int bah=0 local //if you're possessing someone
int comnum local //no. of the commander
message startup
message shutdown
message activated
message timer
message pulse
message killed
message selected
message playeraction
message user0
message touched
end
# ========================================================================================
code
startup:
player=GetLocalPlayerThing();
Teleportthing(player, telething);
print("started");
//call activated;
//return;
//activated:
//No underwater usage
// if(GetSectorFlags(GetThingSector(player)) & 2) Return;
PlaySoundThing(seeingSound, player, 1.0, -1, -1, 0x80);
motionVector = '0 0 0';
camera = FireProjectile(player, camera_tpl, -1, 24, '0 0.06 0.02', GetThingLVec(player), 1.0, 0, 0, 0)
old_camera = GetCurrentCamera();
SetCurrentCamera(0);
SetCameraFocus(0, camera);
//farsightEffectHandle = newColorEffect(0, 0, 0, 0, 0, 0, 64, 64, 0, 1.0); Do I want colours?
StopThing(player);
SetActionCog(GetSelfCog(), 0x7FFFFFFF);
active = 1;
SetInvActivated(player, 35, 1);
startHealth = GetThingHealth(player);
startPosition = GetThingPos(player);
SetPulse(0.5);
SetBinWait(player, 35, 1.0);
bouncing = 1;
SetTimerEx(1, 3, 0, 0);
Return;
playeraction:
if(GetSectorFlags(GetThingSector(player)) & 2)
{
call stop_power;
ReturnEx(0.0);
Return;
}
if(!active)
{
ReturnEx(0.0);
Return;
}
if (GetParam(0) == 0.0) // Jump
{
tempFlex = 0.0;
// Only allow motion at one speed.
if (GetParam(2) != 0.0)
tempFlex = 2.8;
motionVector = VectorSet(VectorX(motionVector), tempFlex, VectorZ(motionVector));
ReturnEx(0.0);
}
else
if (GetParam(0) == 1.0) // Crouch
{
tempFlex = 0.0;
// Only allow motion at one speed.
if (GetParam(2) != 0.0)
tempFlex = 2.8;
motionVector = VectorSet(VectorX(motionVector), -tempFlex, VectorZ(motionVector));
ReturnEx(0.0);
}
else
if (GetParam(0) == 2.0) // Activated
{
// print("Activation!");
call stop_power;
ReturnEx(0.0);
}
else
if (GetParam(0) == 3.0) // Fire
{
ReturnEx(0.0);
}
else
if (GetParam(0) == 4.0) // Strafe
{
motionVector = VectorSet(GetParam(2), VectorY(motionVector), VectorZ(motionVector));
ReturnEx(0.0);
}
else
if (GetParam(0) == 5.0) // Turn
{
tempvec = GetThingRotVel(camera);
tempvec = VectorSet(VectorX(tempvec), GetParam(2), VectorZ(tempvec));
SetThingRotVel(camera, tempvec);
ReturnEx(0.0);
}
else
if (GetParam(0) == 6.0) // Fwd / Bkwd Motion
{
motionVector = VectorSet(VectorX(motionVector), VectorY(motionVector), GetParam(2));
ReturnEx(0.0);
}
else
if (GetParam(0) == 8.0) // Pitch
{
tempvec = GetThingLVecPYR(camera);
tempFlex = VectorX(tempvec)+(GetParam(1) / 100.0);
// Limit the pitch vector (flipping over doesn't work right...)
if (tempFlex < -80.0)
tempFlex = -80.0;
else
if (tempFlex > 80.0)
tempflex = 80.0;
tempvec = VectorSet(tempFlex, VectorY(tempvec), VectorZ(tempvec));
SetThingLookPYR(camera, tempvec);
ReturnEx(0.0);
}
else
if (GetParam(0) == 10.0) // Select Inventory Item
{
ReturnEx(0.0);
}
else
if (GetParam(0) == 11.0) // Select Skill
{
ReturnEx(0.0);
}
else
if (GetParam(0) == 12.0) // Use Inventory Item
{
}
else
if (GetParam(0) == 13.0) // Use Skill
{
ReturnEx(0.0);
}
else
if (GetParam(0) == 14.0) // Other Actions
{
if (GetParam(2) == 0.0) // Cycle Camera
{
print("3rd person only...wraa");
}
}
ReturnEx(1.0);
}
else
{
ReturnEx(0.0);
}
// Add up the various velocities.
tempvec = GetThingLVec(camera);
tempvec = VectorScale(tempvec, VectorZ(motionVector) / 3.0);
tempvec2 = GetThingUVec(camera);
tempvec2 = VectorScale(tempvec2, VectorY(motionVector) / 3.0);
tempvec = VectorAdd(tempvec, tempvec2);
tempvec2 = GetThingRVec(camera);
tempvec2 = VectorScale(tempvec2, VectorX(motionVector) / 3.0);
tempvec = VectorAdd(tempvec, tempvec2);
SetThingVel(camera, tempvec);
Return;
timer:
if (GetSenderId() == 1)
{
// Turn off control capture.
SetActionCog(-1, 0);
SetInvActivated(player, 35, 0);
}
else
if(GetSenderId() == 2) // Deactivate power.
{
call stop_power;
}
else
if (GetSenderId() == 3)
{
bouncing = 0;
}
else
if (GetSenderId() == 4)
{
multiCap = 0;
}
else
if (GetSenderId() == 5)
{
SetPhysicsFlags(camera, 0x4000000);
}
Return;
pulse:
// if the player dies, return to the camera
if(GetThingHealth(player) < 1)
{
setThingHealth(player, 100);
teleportThing(player, telething);
call activated;
bah=0;
Return;
}
// and that he didn't take health damage PFFFFT WEAKLING! LET HIM BLEED.
if(GetThingHealth(player) < startHealth)
{
//call stop_power;
Return;
}
// If he changed position (blown by explosion, pushed, ...) stop the power BOOM!
if(!VectorEqual(startPosition, GetThingPos(player)))
{
//call stop_power;
Return;
}
Return;
selected:
Sleep(0.25); //err..
Return;
killed:
if(GetSenderRef() != player) Return; // all others are expendable!
stop_power:
if(active)
{
SetCameraFocus(0, player);
SetCurrentCamera(old_camera);
DestroyThing(camera);
if(bah==1) {
tempghost=CreateThing(gtemp, player);
tmodel=GetThingModel(player);
thealth=GetThingHealth(player0);
com0[comnum]=CreateThing(tmodel, tempghost);
SetThingHealth(com0[comnum], thealth);
TeleportThing(player, Telething);
}
}
SetPulse(0);
if(channel != -1)
{
StopSound(channel, 0.1);
channel = -1;
}
KillTimerEx(2);
active = 0;
bouncing = 0;
multiCap = 0;
SetTimerEx(0.5, 1, 0, 0);
Return;
touched:
for(X=0; X<4; X=X+1) {
if(GetSenderRef()==com0[X]) {
if(GetThingHealth(com0[X])>0) {
tempghost=CreateThing(gtemp, com0[X]);
tmodel=GetThingModel(com0[X]);
thealth=GetThingHealth(com0[X]);
SetThingModel(player, tmodel);
SetThingHealth(player, com0[X]);
TeleportThing(player, tempghost);
DestroyThing(tempghost);
bah=1;
comnum=X;
call stop_power;
}}}
return;
# ........................................................................................
endIt doesn't even start, and yes, I did throw it in the level.
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)

)![http://forums.massassi.net/html/confused.gif [http://forums.massassi.net/html/confused.gif]](http://forums.massassi.net/html/confused.gif)
) for triggers and c/s cogs. Seems to work fine 
How much of that playeraction code is copied from force farsight? If you're using LEC's movement system, then you should have no problem.![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)