PDA

View Full Version : Why won't count ALL dead people?



Edward
04-24-2005, 11:46 AM
Hi!
A COG of mine won't count all 32 people that lie dead! Please Help!


# 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[i]=createThingAtPos(temp0[rand()*9], room0,GetSectorCenter(room0), vectorset(lx,ly,lz));
if(t0[i]!=-1) dd=dd+1;
CaptureThing(t0[i]);
SetThingVel(t0[i],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[i]) & 0x200)) // || (t0[i]==-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

darthslaw
04-24-2005, 05:27 PM
well one thing I notice off the bat is some of your symbols' names begin with a number. Symbol names must begin with a letter.

atm, that's all I can catch b/c I'm really tired right now.

Lord_Grismath
04-24-2005, 11:19 PM
Something tells me "if(d>=dd)" has something to do with it. Try d>dd.

Oh, and I would REALLY love to beta some of your projects sometime.

Edward
05-02-2005, 07:40 AM
Hi!
Sorry for letting this thing drop and making you think that it was solved. I got sick last Monday, and I stayed away from the computer for a week!

Anyway, DS: I see no symbol starting with a number. And so I believe you were tired!

LG: I don't think that will help. The numbers don't count up to the desired dd. They count up to something below that. AND the counter goes down every time I shoot a projectile.
And I'll try to remember your request.

/Edward

Edward
05-04-2005, 04:11 PM
Still not solved!

Lord_Grismath
05-04-2005, 07:33 PM
Can you better explain what this is supposed to do? My eyes keep glossing over all that code.

Edward
05-05-2005, 10:18 AM
OK... Lets see... The code is activated once entering a certain room, thereby spawning 32 enemies. These 32 are then "captured" and a pulse of every second checks to see if they are alive or not. If all 32 have the Dead flag, or are missing, increase the counter by 1.
If the counter reaches all 32 (or dd in this matter), then Activate user0: and start the talking.
<When firing projectiles, the counter goes down. And so, when I HAVE killed everyone, the counter is somewhere around 28-31 out of 32.>
When I do reach 32, the user0 message is activated. The scene there works normally and at the end, the boss comes to get me.
<After right after that, I hear a voice saying "Well, that seems t-Well, that seems t-Well, that seems t-" and my view rushing forwards to view the boss repetetivly. Thereby making me think that the Pulse has been turned on again by something, and my beenin value set to 1 again.>

Hope this is enough information. If not, I don't know what else I can say.

/Edward

DSLS_DeathSythe
05-05-2005, 05:12 PM
Try this if you want.


########################
# The Boss for TNT3-TNT2
#
# By Edward
########################
symbols
#-----------------------
message entered
message killed
message timer
message pulse
#-----------------------
sector entering=-1

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=0.0
flex spready=0.0
flex spreadz=0.0

flex lookx=0
flex looky=0
flex lookz=0

int lx=0 local
int ly=0 local
int lz=0 local

sector room0=-1
sector room1=-1
sector room2=-1
sector room3=-1
sector room4=-1
sector room5=-1
sector room6=-1
sector room7=-1
sector room8=-1
sector bosshole=-1

template bolt
template acamera

thing cam1=-1 local
thing cam2=-1 local

vector frontalcampos

keyframe bossfire

thing boss=-1 mask=0xFFF

int a=0 local
int b=0 local
int i=0 local
int d=0 local
int dd=0 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 > 0) return;
beenin = 1;
d = 0;
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[i] = CreateThingAtPos(temp0[Rand() * 9], room0, GetSectorCenter(room0), vectorset(lx, ly, lz));
if(t0[i] != -1) dd = dd + 1;
CaptureThing(t0[i]);
SetThingVel(t0[i], VectorSet((Rand() * (spreadx * 2.0)) - spreadx, (Rand() * (spready * 2.0)) - spready, (Rand() * (spreadz * 2.0)) - spreadz ));
}
return;
#---------------------
killed:
if(GetSenderRef() == boss)
{
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;
}
else //-Non boss guy was killed
{
d = d + 1;
PrintInt(d);
PrintInt(dd);
if(d >= dd) //-Everyone is dead
{
if(beenin > 1) return;
beenin = 2;
SetTimerEx(0.1, 1, 0, 0);
}
return;
}
return;
#---------------------
timer:
a = GetSenderID();
b = GetParam(0);
if(a == 1)
{
SetActorFlags(GetLocalPlayerThing(),0x800000);
Print("Well, that seems to be everyone...");
PlaySong(0,0,0); PlaySoundLocal(k_well,1,0,0x0);
sleep(GetSoundLen(k_well));
SetTimerEx(GetSoundLen(k_well), 2, 0, 0);
// sleep(GetSoundLen(k_well));
return;
}
if(a == 2)
{
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,'0.1 0.1 0.1');
Print("That's what you think...");
PlaySoundLocal(d_think,1,0,0x0);
// SetLifeLeft(cam1, 0.0);
// SetLifeLeft(cam2, 0.0);
SetPulse(0.01);
SetTimerEx(1.0, 3, 1, 0);
// sleep(1);
return;
}
if(a == 3)
{
if(b == 1)
{
ClearSectorFlags(bosshole, 0x1);
ch=PlaySoundLocal(music, .5, 0, 0x0);
SetTimerEx(1.0, 3, 2, 0);
// sleep(1);
return;
}
if(b == 2)
{
Print("Dark Jedi: Hello Kyle!");
PlaySoundLocal(d_hello,1,0,0x0);
SetTimerEx(GetSoundLen(d_hello), 3, 3, 0);
// sleep(GetSoundLen(d_hello));
return;
}
if(b == 3)
{
Print("Dark Jedi: I am the last thing you will ever see!");
PlaySoundLocal(d_last,1,0,0x0);
SetTimerEx(GetSoundLen(d_last), 3, 4, 0);
// sleep(GetSoundLen(d_last));
return;
}
if(b == 4)
{
Print("Dark Jedi: I am the FLASHING DEATH!!!");
PlaySoundLocal(d_flash,1,0,0x0);
SetTimerEx(GetSoundLen(d_flash), 3, 5, 0);
// sleep(GetSoundLen(d_flash));
return;
}
if(b == 5)
{
Print("Dark Jedi: I am cloned from Jerec!");
PlaySoundLocal(d_clone,1,0,0x0);
SetTimerEx(GetSoundLen(GetSoundLen(d_clone), 3, 6, 0);
// sleep(GetSoundLen(d_clone));
}
if(b == 6)
{
Print("Dark Jedi: I am exactly like him but i am altered to be better!");
PlaySoundLocal(d_exactly,1,0,0x0);
SetTimerEx(GetSoundLen(d_exactly)-.5, 3, 7, 0);
// sleep(GetSoundLen(d_exactly)-.5);
}
if(b == 7)
{
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);
SetTimerEx(GetSoundLen(k_heard), 3, 8, 0);
// sleep(GetSoundLen(k_heard));
}
if(b == 8)
{
print("Dark Jedi: Oh... Which one was it?");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_which,1,0,0x0);
SetTimerEx(GetSoundLen(d_which), 3, 9, 0);
// sleep(GetSoundLen(d_which));
}
if(b == 9)
{
print("Kyle: The Red one.");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_Red,1,0,0x0);
SetTimerEx(GetSoundLen(k_Red), 3, 10, 0);
// sleep(GetSoundLen(k_Red));
}
if(b == 10)
{
print("Dark Jedi: OK...");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_ok,1,0,0x0);
SetTimerEx(GetSoundLen(d_ok), 3, 11, 0);
// sleep(GetSoundLen(d_ok));
}
if(b == 11)
{
Print("Kyle: So what's different with you?");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_difference,1,0,0x0);
SetTimerEx(GetSoundLen(k_difference), 3, 12, 0);
// sleep(GetSoundLen(k_difference));
}
if(b == 12)
{
Print("Dark Jedi: Um... I have a voice?");
SetCameraFocus(0,cam1);
PlaySoundLocal(d_voice,1,0,0x0);
SetTimerEx(GetSoundLen(d_voice), 3, 13, 0);
// sleep(GetSoundLen(d_voice));
}
if(b == 13)
{
Print("Kyle: True... Anything else?");
SetCameraFocus(0,cam2);
PlaySoundLocal(k_else,1,0,0x0);
SetTimerEx(GetSoundLen(k_else), 3, 14, 0);
// sleep(GetSoundLen(k_else));
}
if(b == 14)
{
SetCameraFocus(0,cam1);
Print("Dark Jedi: Um... I can do this!");
PlaySoundLocal(d_candothis,1,0,0x0);
SetTimerEx(GetSoundLen(d_candothis), 3, 15, 0);
// sleep(GetSoundLen(d_candothis));
}
if(b == 15)
{
FireProjectile(boss, bolt, boltpow, -1, '0 0 0', '0 0 0', 0,0,0,0);
k=PlayKey(boss,bossfire,1,0x4);
SetTimerEx(1.0, 3, 16, 0);
// sleep(1);
}
if(b == 16)
{
StopKey(boss,k,1);
SetCameraFocus(0,cam2);
Print("Kyle: OK then... Lets Fight!");
PlaySoundLocal(k_kthen,1,0,0x0);
SetTimerEx(GetSoundLen(k_kthen), 3, 17, 0);
// sleep(GetSoundLen(k_kthen));
}
if(b == 17)
{
SetCameraFocus(0, GetLocalPlayerThing());
SetCameraFocus(1, GetLocalPlayerThing());
ClearActorFlags(GetLocalPlayerThing(),0x800000);
SetPulse(0.0);
AIClearMode(boss, 0x2000);
AISetMode(boss, 0x4);
SetGoalFlags(GetLocalPlayerThing(), 3, 0x1);
DestroyThing(cam1);
DestroyThing(cam2);
}
return;
}
return;
#---------------------
pulse:
lv = VectorSub(GetThingPos(cam1), frontalcampos);
lvr = VectorSet(-VectorX(lv), -VectorY(lv), -VectorZ(lv));
SetThingLook(cam1, lvr);
if(VectorDist(GetThingPos(cam1), GetThingPos(boss)) < 0.2)
ApplyForce(cam1, lv);
else
if(VectorDist(GetThingPos(cam1), GetThingPos(boss)) > 0.2)
ApplyForce(cam1, lvr);
lv=VectorSub(GetThingPos(cam2), VectorAdd(GetThingPos(GetLocalPlayerThing()), VectorSet(0,0,0.05)));
lvr=VectorSet(-VectorX(lv), -VectorY(lv), -VectorZ(lv));
SetThingLook(cam2,lvr);
if(VectorDist(GetThingPos(cam2), GetThingPos(GetLocalPlayerThing())) < 0.2)
ApplyForce(cam2, lv);
else
if(VectorDist(GetThingPos(cam1), GetThingPos(GetLocalPlayerThing())) > 0.2)
ApplyForce(cam2, lvr);
AISetLookPos(boss, GetThingPos(GetLocalPlayerThing()));
return;
#---------------------
end

Edward
05-06-2005, 05:14 PM
Thanks! That seems to have solved it all!

/Edward