K, I am using Hideki's C/S weapon setup *Custom projectiles in multiplayer*. I can't seem to get these cogs to run. It is supposed to pick a random pistol. When it fires, it uses the random int it got before and sends it to the client cog so it knows what projectile to fire. But I never get a weapon mesh to come up, and it crashes when I press the fire button. Everything checks out in CogWriter, so I doubt it's syntax. Here are the cogs:
The main cog:
The client cog:
Eventually all of the weapons for Rogue Squadron CTF 2.0 will be C/S, but I have to debug this first.
------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance
-Tazz
The main cog:
Code:
# Jedi Knight Cog Script
#
# WEAP_BRYAR.COG
#
# WEAPON 2 Script - Random Blaster
#
# Chooses random blaster upon game start. Choices are the Byrar,
# A Mandolorian Pistol, Blastech DL-66, Blastech DL-44, Stouker
# Magnum or the Goldwave Sharpshooter.
#
# - Affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
# (C) 1998, 2002 Tazz --Modifications not supported by LEC.
symbols
model povModel0=bryv.3do local
model weaponMesh0=bryg.3do local
model povModel1=manv.3do local
model weaponMesh1=mang.3do local
model povModel2=pistv.3do local
model weaponMesh2=pistg.3do local
model povModel3=skinv.3do local
model weaponMesh3=sking.3do local
model povModel4=magv.3do local
model weaponMesh4=magg.3do local
model povModel5=gozblastechv.3do local
model weaponMesh5=gozblastechg.3do local
keyframe mountAnim=bryvmnt.key local
keyframe dismountAnim=bryvdis.key local
keyframe povfireAnim=bryvpst1.key local
keyframe holsterAnim=kyhlstr.key local
sound outSound=pistout1.wav local
sound mountSound=df_bry_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound0=pistol-1.wav local
sound fireSound1=firestream.wav local
sound fireSound2=blastek.wav local
sound fireSound3=laser3.wav local
sound fireSound4=magnum.wav local
sound fireSound5=blastechfire.wav local
template projectile0=+bryarbolt local
thing player local
thing victim local
thing potential local
thing dummy local
flex dot local
flex maxDot local
flex fireWait=0.5 local
flex holsterWait local
flex fireDelay=0.6 local
flex powerBoost local
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local
int weaponIndex local
int trackID=-1 local
int mode local
int holsterTrack local
int blah local
message startup
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
end
# ========================================================================================
code
//startup:
//pick a random pistol
Sleep(2);
Return;
# ========================================================================================
fire:
player = GetSourceRef();
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
// Check Ammo - If we are out, autoselect best weapon.
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80);
if(GetAutoSwitch() & 1)
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}
SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0);
//Take away the FireProjectile command, take it to the client cog and replacing it with triggering.
ID = GetCurWeapon(player) * 10 + GetSenderRef();
SendTrigger(-1, ID, player, blah, 0, 0);
//keys should be left here, or somehow broadcasing will make it play more than twice... from the 4th parameter of FireProjectile.
PlayMode(player, 8);
//Sounds should be left here, or somehow broadcasing will make it play more than twice... from the 3rd parameter of FireProjectile.
PlaySoundThing(fireSound[blah], player, 1, -1, -1, 0x80);
ChangeInv(player, 11, -1.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
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();
blah=rand()*6;
// Setup the meshes and models.
jkSetPOVModel(player, povModel0[blah]);
jkSetWeaponMesh(player, weaponMesh0[blah]);
SetArmedMode(player, 1);
// Play mounting sound.
PlayMode(player, 41);
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, 0x14);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, 2);
SetMountWait(player, GetKeyLen(mountAnim));
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
weaponIndex = GetSenderRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 0x18);
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;
# ........................................................................................
autoselect:
player = GetSourceRef();
// If the player has the weapon
if(GetInv(player, 2) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(500.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
endThe client cog:
Code:
# Jedi Knight Cog Script
#
# Client_Bryar.COG
#
# Description
#
#
# This Cog is Not supported by LucasArts Entertainment Co
# This flag makes the cog act locally, no broadcasting, less lag.
flags=0x404
symbols
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local
template projectile0=+bryarbolt local
template projectile1=+mandalorbolt local
template projectile2=+dl66bolt local
template projectile3=+sharpshooterbolt local
template projectile4=+magnumbolt local
template projectile5=+blastechbolt local
int blah local
message trigger
end
# ========================================================================================
code
trigger:
if( (GetSourceRef() == 20) || (GetSourceRef() == 21) ) //Either sent with primary or secondary fire mode...
{
blah = GetParam(1);
FireProjectile(GetParam(0), projectile0[blah] -1, -1, '0.0135 0.1624 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
}
return;
endEventually all of the weapons for Rogue Squadron CTF 2.0 will be C/S, but I have to debug this first.
------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance
-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance
Tazz
Tazz
![http://forums.massassi.net/html/eek.gif [http://forums.massassi.net/html/eek.gif]](http://forums.massassi.net/html/eek.gif)