Edward
06-29-2004, 10:24 AM
And I believe it is because that a thing, that has been removed, tries to keep on creating...
# Redeemer sound
#
# By Edward
flags=0x240
symbols
message created
message pulse
sound flying=crowenginewhine02.wav local
template smoke=+flamingsmoke local
int sm local
int ch=1 local
end
#
code
created:
ch=PlaySoundThing(flying,GetSenderRef(),1,0,10,0x8 1);
SetThingPulse(GetSenderRef(),.1);
return;
pulse:
ChangeSoundPitch(ch,2,0.1);
sm=CreateThing(smoke, GetSenderRef());
SetThingVel(sm,VectorSet( (rand()*2.00)-1.00 , (rand()*2.00)-1.00 , (rand()*2.00)-1.00 ));
return;
end
I fire a bolt, and it goes off, leaving smoke and sound. It hits the wall, I see the explosion, and poof, the game crashes. Bolt has this COG in the templates. I believe I need to add a removed message, but how do I do that when I haven't specified the bolt anywhere appart from GetSenderRef()?
Quib Mask
06-29-2004, 11:44 AM
Personally, I don't see any reason this cog would crash the game. Since this is the thing's class cog, if you add message removed, it'll call that message when it's removed, so you could tell it to set GetSenderRef()'s thingpulse to 0 as a safety check.
removed:
SetThingPulse(GetSenderRef(),0);
Return;
Is this a driveable projectile? I noticed "# Redeemer sound" at the top, and that's what Lunatik called his driveable missile. You may have faulty code in your weapon's cog file and that's why it's crashing... consider posting your weapon cog if you can't fix it.
Quib Mask
Edward
06-29-2004, 02:16 PM
Still crashes...
Here are all the codes:
Origin
# Jedi Knight Cog Script
#
# WEAP_CONCRIFLE.COG
#
# WEAPON 9 Script - Concussion Rifle
#
# The trusty weapon of the Bossk race. It fires a concussive blast with a maximum
# range of 30 meters, from there it creates an explosion that has a spread of about
# 4 meters in diameter.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# ================================================== ======================================
symbols
model povModel=conv.3do local
model weaponMesh=cong.3do local
keyframe mountAnim=ConVmnt.key local
keyframe dismountAnim=ConVdis.key local
keyframe povfireAnim=ConVpst1.key local
keyframe holsterAnim=kyhlstr.key local
sound mountSound=df_rif_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=concuss5.wav local
sound outSound=concuss1.wav local
flex fireWait=1.2 local
flex powerBoost local
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local
flex holsterWait local
int dummy local
template projectile=+redeemer local
template projectile3=+redeemer2 local
template exp=+redexp local
template drop=+reddrop local
thing player local
int trackID=-1 local
int mode local
int holsterTrack local
int selectMode=1 local
int flying=0 local
thing other local
message activated
message deactivated
message selected
message deselected
message newplayer
message autoselect
message fire
message timer
message killed
message removed
end
# ================================================== ======================================
code
fire:
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 12) < 8.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}
SetPOVShake('0.0 -.03 0.0', '4.0 0.0 0.0', .05, 80.0);
if(mode == 0)
{
if(flying==0) {
dummy = FireProjectile(player, projectile, fireSound, 18, '0.02 0.15 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
ChangeInv(player, 12, -1.0); } else { CreateThing(exp,dummy); DestroyThing(dummy); flying=0; }
}
else
{
if(flying==0) {
dummy = FireProjectile(player, projectile3, fireSound, 18, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
ChangeInv(player, 12, -1.0);
captureThing(dummy); flying=1; } else { other=CreateThing(drop,dummy); PlaySoundThing(outSound,other,1,0,10,0x80); SetThingVel(other,GetThingLVec(player)); DestroyThing(dummy); flying=0; }
}
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
// Provide a kick backwards
ApplyForce(player, VectorScale(GetThingLVec(player), -80));
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# .................................................. ......................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon( player, fireWait/powerBoost, mode );
Return;
# .................................................. ......................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon( player, mode );
Return;
# .................................................. ......................................
selected:
player = GetSourceRef();
// Play external mounting animation
PlayMode(player, 41);
// Setup the meshes and models.
jkSetPOVModel(player, povModel);
SetArmedMode(player, 1);
jkSetWeaponMesh(player, weaponMesh);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Play mounting sound.
PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
SetMountWait(player, GetKeyLen(mountAnim));
// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, 9);
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 12) < 2.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, AutoSelectWeapon(player, 1));
}
Return;
# .................................................. ......................................
deselected:
player = GetSourceRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 18);
holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if (trackID != -1)
{
jkStopPOVKey(player, trackID, 0);
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
Return;
# .................................................. ......................................
newplayer:
// player = GetSourceRef();
//
// // Make sure that if the player is respawning, the old mount isn't playing anymore.
// if (trackID != -1)
// jkStopPOVKey(player, trackID, 0);
//
DamageThing(dummy,1000,0x4,player); flying=0;
Return;
# .................................................. ......................................
killed:
DamageThing(dummy,1000,0x4,player); flying=0;
return;
autoselect:
selectMode = GetSenderRef();
player = GetSourceRef();
// If the player has the weapon
if(GetInv(player, 9) != 0.0)
{
// If the player has ammo
if(GetInv(player, 12) > 7.0)
{
// query for ammo
if(selectMode == -1)
{
ReturnEx(1000.0);
Return;
}
if((selectMode == 0) && !(GetAutoPickup() & 2))
{
ReturnEx(1000.0);
Return;
}
if((selectMode == 1) && !(GetAutoSwitch() & 2))
{
ReturnEx(1000.0);
Return;
}
if((selectMode == 2) && !(GetAutoPickup() & 2))
{
ReturnEx(1000.0);
Return;
}
ReturnEx(-2.0);
Return;
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# .................................................. ......................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
removed:
if(GetSenderRef()==dummy) flying=0;
return;
end
Templates
+redexp _explosion thingflags=0x1 light=1 timer=1 typeflags=0x7 blasttime=0.9 maxlight=2 force=100 damage=1000 damageclass=0x4 range=2 sprite=redeemerx.spr cog=red_exp_snd.cog
+redeemer _weapon thingflags=0x20000400 timer=60 model3d=con0.3do size=0.01 movesize=0.01 soundclass=redeemer.snd creatething=+lgflash airdrag=0 physflags=0x200 vel=(0/2/0) explode=+redexp fleshhit=+redexp damage=10 typeflags=0x24010E cog=redeemersnd.cog
+redeemer2 +redeemer cog=redeemercam.cog
+reddrop +grenade2 model3d=con0.3do angvel=(46/127/49) explode=+redexp fleshhit=+redexp
+redcross _explosion timer=0.02 sprite=redcross.spr typeflags=0x2
+fs8 _decor timer=0.2 model3d=black.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs7 _decor timer=0.2 model3d=darkgrey.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs6 _decor timer=0.2 model3d=grey.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs5 _decor timer=0.2 model3d=darkred.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs4 _decor timer=0.2 model3d=red.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs3 _decor timer=0.2 model3d=darkyellow.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs2 _decor timer=0.2 model3d=yellow.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+fs1 _decor timer=0.2 model3d=white.3do size=0.0001 movesize=0.0001 cog=spritelike.cog collide=0
+flamingsmoke _debris timer=1 cog=fs.cog thingflags=0x1 light=0.1 collide=0
Smoke/sound Maker
# Redeemer sound
#
# By Edward
flags=0x240
symbols
message created
message pulse
message removed
sound flying=crowenginewhine02.wav local
template smoke=+flamingsmoke local
int sm local
int ch=1 local
end
#
code
created:
ch=PlaySoundThing(flying,GetSenderRef(),1,0,10,0x8 1);
SetThingPulse(GetSenderRef(),.1);
return;
pulse:
ChangeSoundPitch(ch,2,0.1);
sm=CreateThing(smoke, GetSenderRef());
SetThingVel(sm,VectorSet( (rand()*2.00)-1.00 , (rand()*2.00)-1.00 , (rand()*2.00)-1.00 ));
return;
removed:
SetThingPulse(GetSenderRef(),0);
return;
end
Smoke Trail
# Flaming Smoke
#
# By Edward
flags=0x240
symbols
message created
message pulse
thing base
template smoke0=+fs1 local
template smoke1=+fs2 local
template smoke2=+fs3 local
template smoke3=+fs4 local
template smoke4=+fs5 local
template smoke5=+fs6 local
template smoke6=+fs7 local
template smoke7=+fs8 local
int i local
thing s local
end
#
code
created:
base=GetSenderRef();
SetThingPulse(base,0.1);
i=0;
return;
pulse:
s=CreateThing(smoke0[i],GetSenderRef());
attachThingToThing(s,GetSenderRef());
i=i+1;
if(i>7) SetThingPulse(GetSenderRef(),0);
return;
end
Hope this helps.
Whats does Parsec have to say about it?
------------------
Dear lady, can you hear the wind blow, and did you know
Your stairway lies on the whispering wind.
:w (http://shauri.hopto.org)q (http://www.massassi.net/levels/files/2533.shtml)
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.