Hi!
A COG of mine won't count all 32 people that lie dead! Please Help!
The print thing says at tops 31 things dead. But I know that it has reached 32! And also, the number reduces when I fire my guns! Why is that?
Edit: Found more problems... I, sometimes, am able to get to 32 and get to the user0: message. Now begins problems. At the end of all this, the pulse seems to reset itself. Somewhat like if the beenin is reset to 1 and thereby every second I end up printing the first line in the user0 message. WHY WHY WHY!!!!???????????
/Edward
A COG of mine won't count all 32 people that lie dead! Please Help!
Code:
# The Boss for TNT3-TNT2
#
# By Edward
symbols
message entered
message pulse
message user0
message killed
sector entering
template temp0
template temp1
template temp2
template temp3
template temp4
template temp5
template temp6
template temp7
template temp8
template temp9
thing t0=-1 local
thing t1=-1 local
thing t2=-1 local
thing t3=-1 local
thing t4=-1 local
thing t5=-1 local
thing t6=-1 local
thing t7=-1 local
thing t8=-1 local
thing t9=-1 local
thing t10=-1 local
thing t11=-1 local
thing t12=-1 local
thing t13=-1 local
thing t14=-1 local
thing t15=-1 local
thing t16=-1 local
thing t17=-1 local
thing t18=-1 local
thing t19=-1 local
thing t20=-1 local
thing t21=-1 local
thing t22=-1 local
thing t23=-1 local
thing t24=-1 local
thing t25=-1 local
thing t26=-1 local
thing t27=-1 local
thing t28=-1 local
thing t29=-1 local
thing t30=-1 local
thing t31=-1 local
flex spreadx
flex spready
flex spreadz
flex lookx
flex looky
flex lookz
int lx local
int ly local
int lz local
sector room0
sector room1
sector room2
sector room3
sector room4
sector room5
sector room6
sector room7
sector room8
sector bosshole
template bolt
template acamera
thing cam1 local
thing cam2 local
vector frontalcampos
keyframe bossfire
thing boss mask=0xFFF
int i local
int d local
int dd local
int beenin=0 local
sound k_well
sound d_think
sound d_hello
sound d_last
sound d_flash
sound d_clone
sound d_exactly
sound k_heard
sound d_which
sound k_Red
sound d_ok
sound k_difference
sound d_voice
sound k_else
sound d_candothis
sound boltpow
sound k_kthen
sound music
sound hold
int ch=1 local
int k=-1 local
vector lv local
vector lvr local
sound Congrats
end
#
code
entered:
If(GetSenderRef()!=entering) return;
if(beenin==1) return;
beenin=1;
dd=0;
SetGoalFlags(GetLocalPlayerThing(), 0, 0x2);
print("Mission Objective Complete!");
for(i=0; i<32; i=i+1)
{
if(lookx==-1) { lx=rand()*360; } else { lx=lookx; }
if(looky==-1) { ly=rand()*360; } else { ly=looky; }
if(lookz==-1) { lz=rand()*360; } else { lz=lookz; }
t0=createThingAtPos(temp0[rand()*9], room0,GetSectorCenter(room0), vectorset(lx,ly,lz));
if(t0!=-1) dd=dd+1;
CaptureThing(t0);
SetThingVel(t0,VectorSet( (rand()*(spreadx*2.00000000))-spreadx, (rand()*(spready*2.00000000))-spready, (rand()*(spreadz*2.00000000))-spreadz ));
sleep(0.1);
}
SetPulse(1);
return;
pulse:
d=0;
for(i=0; i<32; i=i+1)
{
if((GetThingFlags(t0) & 0x200)) // || (t0==-1)
d=d+1;
}
printint(d);
printint(dd);
if(d>=dd)
{
if(beenin==2) return;
beenin=2;
SetPulse(0);
call user0;
}
if(beenin==2)
{
lv=VectorSub(GetThingPos(cam1),frontalcampos);
lvr=VectorSet(-VectorX(lv), -VectorY(lv), -VectorZ(lv));
SetThingLook(cam1,lvr);
if(VectorDist(GetThingPos(cam1), GetThingPos(boss))<.2)
ApplyForce(cam1,lv);
else if(VectorDist(GetThingPos(cam1), GetThingPos(boss))>.2)
ApplyForce(cam1,lvr);
lv=VectorSub(GetThingPos(cam2), VectorAdd(GetThingPos(GetLocalPlayerThing()), VectorSet(0,0,.05)));
lvr=VectorSet(-VectorX(lv), -VectorY(lv), -VectorZ(lv));
SetThingLook(cam2,lvr);
if(VectorDist(GetThingPos(cam2), GetThingPos(GetLocalPlayerThing()))<.2)
ApplyForce(cam2,lv);
else if(VectorDist(GetThingPos(cam1), GetThingPos(GetLocalPlayerThing()))>.2)
ApplyForce(cam2,lvr);
AISetLookPos(boss, GetThingPos(GetLocalPlayerThing()));
}
return;
killed:
if(GetSenderRef()!=boss) return;
PlaySoundLocal(Congrats,1,0,0x0);
print("Mission Objective Completed!");
SetGoalFlags(GetLocalPlayerThing(), 3, 0x2);
SetGoalFlags(GetLocalPlayerThing(), 4, 0x1);
sleep(1);
print("Right... Now to find the Galexy Destroyer.");
return;
user0:
SetActorFlags(GetLocalPlayerThing(),0x800000);
print("Well, that seems to be everyone...");
PlaySong(0,0,0);
PlaySoundLocal(k_well,1,0,0x0);
sleep(GetSoundLen(k_well));
cam1=FireProjectile(GetLocalPlayerThing(), acamera, -1, -1, '0 0 0', '0 0 0', 0,0,0,0);
cam2=FireProjectile(GetLocalPlayerThing(), acamera, -1, -1, '0 0 0', '0 0 0', 0,0,0,0);
CaptureThing(cam1);
CaptureThing(cam2);
SetCameraFocus(0,cam1);
SetCameraFocus(1,cam1);
SetThingVel(cam2,'.1 .1 .1');
print("That's what you think...");
PlaySoundLocal(d_think,1,0,0x0);
SetLifeLeft(cam1,0);
SetLifeLeft(cam2,0);
SetPulse(0.01);
sleep(1);
ClearSectorFlags(bosshole, 0x1);
ch=PlaySoundLocal(music, .5, 0, 0x0);
sleep(1);
Print("Dark Jedi: Hello Kyle!");
PlaySoundLocal(d_hello,1,0,0x0);
sleep(GetSoundLen(d_hello));
Print("Dark Jedi: I am the last thing you will ever see!");
PlaySoundLocal(d_last,1,0,0x0);
sleep(GetSoundLen(d_last));
Print("Dark Jedi: I am the FLASHING DEATH!!!");
PlaySoundLocal(d_flash,1,0,0x0);
sleep(GetSoundLen(d_flash));
Print("Dark Jedi: I am cloned from Jerec!");
PlaySoundLocal(d_clone,1,0,0x0);
sleep(GetSoundLen(d_clone));
Print("Dark Jedi: I am exactly like him but i am altered to be better!");
PlaySoundLocal(d_exactly,1,0,0x0);
sleep(GetSoundLen(d_exactly)-.5);
Print("Kyle: Yes, so I've heard from your brother, who lies dead...");
SetCameraFocus(0,cam2);
SetCameraFocus(1,GetLocalPlayerThing());
PlaySoundLocal(k_heard,1,0,0x0);
StopSound(ch,1);
PlaySoundLocal(hold,1,0,0x0);
sleep(GetSoundLen(k_heard));
print("Dark Jedi: Oh... Which one was it?");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_which,1,0,0x0);
sleep(GetSoundLen(d_which));
print("Kyle: The Red one.");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_Red,1,0,0x0);
sleep(GetSoundLen(k_Red));
print("Dark Jedi: OK...");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_ok,1,0,0x0);
sleep(GetSoundLen(d_ok));
Print("Kyle: So what's different with you?");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_difference,1,0,0x0);
sleep(GetSoundLen(k_difference));
Print("Dark Jedi: Um... I have a voice?");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_voice,1,0,0x0);
sleep(GetSoundLen(d_voice));
Print("Kyle: True... Anything else?");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_else,1,0,0x0);
sleep(GetSoundLen(k_else));
SetCameraFocus(0,cam1);
Print("Dark Jedi: Um... I can do this!");
PlaySoundLocal(d_candothis,1,0,0x0);
sleep(GetSoundLen(d_candothis));
FireProjectile(boss, bolt, boltpow, -1, '0 0 0', '0 0 0', 0,0,0,0);
k=PlayKey(boss,bossfire,1,0x4);
sleep(1);
StopKey(boss,k,1);
SetCameraFocus(0,cam2);
Print("Kyle: OK then... Lets Fight!");
PlaySoundLocal(k_kthen,1,0,0x0);
sleep(GetSoundLen(k_kthen));
SetCameraFocus(0,GetLocalPlayerThing());
ClearActorFlags(GetLocalPlayerThing(),0x800000);
SetPulse(0);
AIClearMode(boss, 0x2000);
AISetMode(boss, 0x4);
SetGoalFlags(GetLocalPlayerThing(), 3, 0x1);
DestroyThing(cam1);
DestroyThing(cam2);
return;
end
The print thing says at tops 31 things dead. But I know that it has reached 32! And also, the number reduces when I fire my guns! Why is that?
Edit: Found more problems... I, sometimes, am able to get to 32 and get to the user0: message. Now begins problems. At the end of all this, the pulse seems to reset itself. Somewhat like if the beenin is reset to 1 and thereby every second I end up printing the first line in the user0 message. WHY WHY WHY!!!!???????????
/Edward