Hi!
I make this level/project, and I leave it alone for quite sometime (let's say half a year). I return to it, play a bit, find something's missing. I open the COG, add 10 new symbols and a few lines of code to go with them, try the game again, and guess what happens.
No...
No...
No...
Nothing has changed! It is as if I never changed the COG. Yes, I refreshed the COG place, added what was needed to be added, and nothing! I thought I did a mistake in a code line so I tried for some test prints. They didn't show! Like if I never put them there!
Here's the COG:
[edit] The changes would be the fireone array and the part between KillTimerEx() and SetTimerEx() in the damaged message
/Edward
[This message has been edited by Edward (edited August 04, 2004).]
I make this level/project, and I leave it alone for quite sometime (let's say half a year). I return to it, play a bit, find something's missing. I open the COG, add 10 new symbols and a few lines of code to go with them, try the game again, and guess what happens.
No...
No...
No...
Nothing has changed! It is as if I never changed the COG. Yes, I refreshed the COG place, added what was needed to be added, and nothing! I thought I did a mistake in a code line so I tried for some test prints. They didn't show! Like if I never put them there!
Here's the COG:
Code:
# Fly a ship 2.
#
# By Edward
flags=0x240
symbols
message startup
message activated
message damaged
message touched
message pulse
message trigger
message timer
message removed
message speed
thing ship local
thing startpos
thing hidden
thing player local
template smoke
template shippy
thing look local
template looker=+bryarbolt local
template fireone0
template fireone1
template fireone2
template fireone3
template fireone4
template fireone5
template fireone6
template fireone7
template fireone8
template fireone9
template fireone10
template firetwo
sound fireonesnd
sound firetwosnd
surface firea0 mask=0xFFF
surface firea1 mask=0xFFF
surface firea2 mask=0xFFF
surface firea3 mask=0xFFF
surface firea4 mask=0xFFF
surface firea5 mask=0xFFF
surface fireb mask=0xFFF
sound engine
sound inengine
int in=0 local
int ch1=1 local
int ch2=2 local
flex gas=0 local
flex gasx=0 local
flex gass=0 local
vector randomvec local
int i local
int trigging
int mores=0 local
thing gh local
thing gh2 local
template ghost
vector vec local
flex speedy local
flex newlvec local
flex lvecdist local
flex oldlvec local
flex lookvec local
flex speedflex local
int boostvar=0 local
end
#
code
startup:
sleep(4);
ship=CreateThing(shippy,startpos);
captureThing(ship);
return;
activated:
if(GetSenderRef()==ship)
{
if(in==1) return;
player=GetSourceRef();
ch2=PlaySoundLocal(inengine,.5,0,0x1);
SetActorFlags(player,0x8);
SetCameraFocus(0,ship);
SetCameraFocus(1,ship);
SendTrigger(-1,trigging,player,0,0,0);
}
else
{
if(in==0) return;
ChangeSoundPitch(ch2,0.1,3);
SetTimerEx(1,10,0,0);
SendTrigger(-1,trigging,-1,0,0,0);
}
return;
pulse:
SetInv(player, 11, 100); // Energy
SetInv(player, 12, 100); // Power
SetInv(player, 15, 30); // Railcharges
SetInv(player, 8, 30); // Sequencer charges
SetInv(player, 4, 30); // TD
SetInv(player, 9, 1); // Concussion Rifle
SetInv(player, 7, 1);
SetInv(player, 5, 1);
SetInv(player, 3, 1);
SetInv(player, 2, 1);
SetInv(player, 1, 1);
SetInv(player, 10, 1);
gas=VectorY(GetThingThrust(player))/4;
gasx=VectorX(GetThingThrust(player));
gass=gass+gas;
look = FireProjectile(player, looker, -1, 8, '0 0 0', '0 0 0', 1, 0x0, 0, 0);
SetThingLook(ship, GetThingLVec(look));
//SetThingVel(ship, VectorScale(GetThingLVec(ship), gass));
call speed;
DestroyThing(look);
DetachThing(ship);
FireProjectile(ship,smoke,-1,-1,'0 -.1 0','0 0 0',0,0,0,0);
printflex(gas);
printflex(gass);
printflex(speedy);
printvector(GetThingLVec(ship));
jkPrintUniString(-1, trigging);
if(gass<0)
{
ChangeSoundPitch(ch1,-(gass/10),0.01);
ChangeSoundPitch(ch2,-(gass/10),0.01);
}
else
{
ChangeSoundPitch(ch1,gass/10,0.01);
ChangeSoundPitch(ch2,gass/10,0.01);
}
return;
damaged:
for(i=0; i<6; i=i+1)
{
if(GetSenderRef()==firea0)
{
KillTimerEx(4);
if(mores!=0) { randomvec=RandVec(); } else { randomvec=VectorSet(0,0,0); }
FireProjectile(ship,fireone0[GetCurWeapon(player)],fireonesnd,-1,randomvec,randomvec,gass+0.01,1,0,0);
mores=1;
SetTimerEx(.1,4,0,0);
}
}
return;
touched:
if(GetSenderRef()==fireb)
{
FireProjectile(ship,firetwo,firetwosnd,-1,'0 0 0','0 0 0',gass+0.01,1,0,0);
}
return;
trigger:
if(GetSourceRef()!=trigging) return;
if(GetParam(0)!=-1) player=GetParam(0);
if(in==0)
{
SetPulse(0.01);
ClearPhysicsFlags(ship,1);
ch1=PlaySoundThing(engine,ship,1,1,10,0x81);
teleportThing(player,hidden);
in=1;
gas=0;
gasx=0;
gass=0;
}
else if(in==1)
{
in=2;
SetPhysicsFlags(ship,1);
gas=0;
gasx=0;
gass=0;
ChangeSoundPitch(ch1,0.1,1);
StopSound(ch1,1);
SetPulse(0);
printflex(gas);
printflex(gass);
print("+========+");
printvector(GetThingLVec(ship));
jkPrintUniString(-1, trigging);
sleep(1);
TeleportThing(player,ship);
in=0;
}
return;
timer:
if(GetSenderID()==10)
{
SetCameraFocus(0,player);
SetCameraFocus(1,player);
StopSound(ch2,0.1);
ClearActorFlags(player,0x8);
}
else if(GetSenderID()==4)
{
mores=0;
}
return;
removed:
if(GetSenderRef()==ship)
{
TeleportThing(player,ship);
ship=CreateThing(shippy,startpos);
gas=0;
gasx=0;
gass=0;
ChangeSoundPitch(ch1,0.1,1);
StopSound(ch1,1);
SetPulse(0);
}
return;
#------------------------------------------------------------
speed:// Apply force to the missile, and slow it down when it turns so much.
#SaberMaster's work. MW...
vec=GetThingVel(ship);
speedy=VectorLen(vec);
newlvec=Getthinglvec(ship);
lvecdist=VectorDist(newlvec, oldlvec);
oldlvec=newlvec;
if(speedy > gass && lvecdist > 0.1) Setthingvel(ship, VectorScale(vec, .75));
ApplyForce(ship, VectorScale(newlvec, gass));
Return;
#------------------------------------------------------------
end
[edit] The changes would be the fireone array and the part between KillTimerEx() and SetTimerEx() in the damaged message
/Edward
[This message has been edited by Edward (edited August 04, 2004).]