Below is a totally redone version of the infamous longbow cog for the RoX TC.
Not too long a go, bel Iblis e-mailed me a new player model (i.e. playermodel in the symbols section) with the bow in the left hand for added realism, along with 2 keys, armbow (for the firing) and getarrow (for reloading).
Unfortunately, he made several errors. Firstly, the bow replaced the Thermal Detonator, and the 'detg.3do' was replaced with an arrow. However this was built off of the bryar pistol cog, and thus ingame, Tahben appeared with the bow in the left hand and the broadsword (the bryar replacement) in the right. I was able to fix this, but instead of playing the armbow or getarrow keys, Tahben simply swings the arrow around as if it were a broadsword. I checked the keys, and they all look fine, and it is thus that I am at a loss as to what is wrong. I'd write a new one myself, but I've never done weapon cogs before and am thus none too knowledegable about them.
Not too long a go, bel Iblis e-mailed me a new player model (i.e. playermodel in the symbols section) with the bow in the left hand for added realism, along with 2 keys, armbow (for the firing) and getarrow (for reloading).
Unfortunately, he made several errors. Firstly, the bow replaced the Thermal Detonator, and the 'detg.3do' was replaced with an arrow. However this was built off of the bryar pistol cog, and thus ingame, Tahben appeared with the bow in the left hand and the broadsword (the bryar replacement) in the right. I was able to fix this, but instead of playing the armbow or getarrow keys, Tahben simply swings the arrow around as if it were a broadsword. I checked the keys, and they all look fine, and it is thus that I am at a loss as to what is wrong. I'd write a new one myself, but I've never done weapon cogs before and am thus none too knowledegable about them.
Code:
# Jedi Knight Missions Cog Script # # WEAP_BRYAR_M.COG # # WEAPON 2 Script - Bryar Pistol # # Yes I changed it now it changes player model and is an MP nightmare but hey Kyle ain't # no lefty so I had to do this for the bow to work! # # - Affected by MagSealed sectors/surfaces. # # [YB & CYW] + [RF] # # (C) 1997 LucasArts Entertainment Co. All Rights Reserved symbols model povModel=detv.3do local model povModel_m=detv_m.3do local model weaponMesh=detg.3do local model noweaponMesh=fistg.3do local model playermodel=kkbow.3do local model playermodelold=kk.3do local keyframe bow1=armbow.key local keyframe bow2=getarrow.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 fireSound=Bow_fire.wav local sound failSound=weapfail.wav local template projectileB=+swsparks local template projectile=+bowarrow local thing player local thing victim local thing potential local flex dot local flex maxDot local flex fireWait=1.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 dummy=0 local int mode local int holsterTrack local int step=1 local int key=-1 local message activated message deactivated message selected message deselected message autoselect message fire message timer end # ======================================================================================== code fire: player = GetSourceRef(); // Check that the player is still alive. if(GetThingHealth(player) <= 0) { Return; } if(step == 0) { // 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, GetWeaponBin(AutoSelectWeapon(player, 1))); Return; } SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0); if (GetInv(player, 93) > 0.0) { Return; } else { step=1; key = PlayKey(player, bow1, 1, 0x14); Return; } } if(step == 1) { ChangeInv(player, 11, -1.0); StopKey(player, key, 0); step=0; PlayKey(player, bow2, 1, 0x2c); dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2); Return; } Return; # ........................................................................................ activated: player = GetSourceRef(); mode = GetSenderRef(); if (GetInv(player, 93) > 0.0) SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0); 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(); // Setup the meshes and models. if (GetInv(player, 67) == 0.0) jkSetPOVModel(player, povModel); // Kyle hand else jkSetPOVModel(player, povModel_m); // Mara Hand jkSetWeaponMesh(player, weaponMesh); //Implementing the bow hand SetThingModel(player, playermodel); 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. jkSetWaggle(player, '10.0 7.0 0.0', 350); // Clear saber flags, and allow activation of the weapon jkClearFlags(player, 0x5); SetCurWeapon(player, 2); step=0; PlayKey(player, bow2, 1, 0x2c); Return; # ........................................................................................ deselected: player = GetSourceRef(); weaponIndex = GetSenderRef(); PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80); //De-implementing the bow hand SetThingModel(player, playermodelold); 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); StopKey(player, key, 0); step=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; end