Code:
# Jedi Knight Cog Script # # WEAP_BRYAR.COG # # WEAPON 2 Script - Bryar Pistol # # The trusty weapon of Kyle Katarn. This is actually an older modified rifle # that has been cut down to more of a pistol size. It is very accurate but # somewhat of a low power weapon. This weapon has only one type of fire. # # - Affected by MagSealed sectors/surfaces. # # [YB & CYW] # # (C) 1997 LucasArts Entertainment Co. All Rights Reserved symbols model povModel=PulseV.3DO local model weaponMesh=PulseInHand.3DO local keyframe mountAnim=PulseUp.key local keyframe dismountAnim=PulseDown.key local keyframe povfireAnim=PulseShoot.key local keyframe holsterAnim=kyhlstr.key local keyframe povGren=PulseGrenade.key local keyframe povboredAnim0=PulseV_bored1.key local keyframe povboredAnim1=PulseV_bored2.key local sound outSound=pulse_rifle_empty.wav local sound mountSound=invrotate.wav local sound dismountSound=PutWeaponAway01.wav local sound fireSound=pulse.wav local sound grenadeR=Ed_PulseGrenade_reload.wav local sound grenadeF=Ed_PulseGrenade_Launch.wav local sound boredsnd0=swingfist01.wav local sound boredsnd2=swingfist04.wav local sound boredsnd3=trprout.wav local template projectile=+bryarbolt local template projgren=+grenade3 local thing player local flex fireWait=0.05 local flex holsterWait local flex autoAimFOV=30 local int weaponIndex local int trackID=-1 local int dummy=0 local int mode local int holsterTrack local int onegrenade=0 local int busy=0 local int bob=-1 local int boredtrack=-1 local flex oldammo local int br local message activated message deactivated message selected message deselected message autoselect message fire message timer message pulse message bored0 message bored1 end # ======================================================================================== code fire: player = GetSourceRef(); // Check that the player is still alive. if(GetThingHealth(player) <= 0) { Return; } KillTimerEx(14); SetTimerEx(10,14,0,0); if(boredtrack!=-1) { jkStopPOVKey(player, boredtrack, 0.1); boredtrack=-1; } // Check Ammo - If we are out, autoselect best weapon. if(mode!=1) { if(GetInv(player, 11) < 1.0) { PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80); Return; } SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0); dummy = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2); ChangeInv(player, 130, -1.0); jkPlayPOVKey(player, povfireAnim, 1, 0x38); ChangeFireRate(player, fireWait); } else { if(busy==1) return; if(onegrenade==1) return; busy=1; onegrenade=1; jkPlayPOVKey(player,povGren,1,0x38); PlaySoundThing(grenadeR,player,1,-1,5,0xC0); SetTimerEx(GetKeyLen(povGren)/3,15,0,0); } Return; # ........................................................................................ activated: player = GetSourceRef(); mode = GetSenderRef(); jkSetWaggle(player, '0.0 0.0 0.0', 0); ActivateWeapon( player, fireWait, mode ); Return; # ........................................................................................ deactivated: player = GetSourceRef(); mode = GetSenderRef(); busy=0; jkSetWaggle(player, '10.0 7.0 0.0', 350); DeactivateWeapon( player, mode ); Return; # ........................................................................................ selected: player = GetSourceRef(); SetTimerEx(10,14,0,0); oldammo=GetInv(player,11); SetInv(player,11,GetInv(player,130)); // Setup the meshes and models. jkSetPOVModel(player, povModel); jkSetWeaponMesh(player, weaponMesh); SetArmedMode(player, 1); SetPulse(0.01); // Play mounting sound. PlayMode(player, 41); // 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)); PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80); Return; # ........................................................................................ deselected: player = GetSourceRef(); weaponIndex = GetSenderRef(); PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80); KillTimerEx(14); SetInv(player,11,oldammo); PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80); jkPlayPOVKey(player, dismountAnim, 0, 0x04); if (trackID != -1) { jkStopPOVKey(player, trackID, 1); trackID = -1; } SetPulse(0); holsterWait = GetKeyLen(holsterAnim); SetMountWait(player, holsterWait); holsterTrack = PlayKey(player, holsterAnim, 1, 0x4); SetTimerEx(holsterWait, 2, 0.0, 0.0); 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, 130) != 0.0) { ReturnEx(500.0); } else { ReturnEx(-1.0); } } else { ReturnEx(-1.0); } Return; # ........................................................................................ timer: if(GetSenderID()==15) { if(onegrenade==1) { If(GetInv(player,4)>0) { SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0); dummy = FireProjectile(player, projgren, grenadeF, 8, '0.0135 0.1624 0.0', '0 0 0', 5, 0x21, autoAimFOV, autoAimFOV*2); ChangeInv(player, 4, -1.0); printint(GetInv(player,4)); print("grenades left"); } else { PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80); print("EMPTY!"); } onegrenade=0; } } else if(GetSenderID()==2) { StopKey(player, holsterTrack, 0.0); } else if(GetSenderID()==14) { br=rand()*2; print("bored!"); printint(br); boredtrack=jkPlayPOVKey(player,povboredAnim0[br],1,0x38); if(br==1) { call bored1; } else if(br==0) { call bored0; } KillTimerEx(14); SetTimerEx(10-(rand()*8),14,0,0); } return; pulse: jkSetWaggle(player, '0.0 0.0 0.0', 0); SetInv(player,11,GetInv(player,130)); return; bored0: print("I'm bored. Flip it!"); PlaySoundThing(boredsnd0,player,1,0,1,0x80); sleep(GetKeyLen(povboredAnim0)/4); PlaySoundThing(boredsnd0,player,1,0,1,0x80); return; bored1: print("I'm bored. Swing it!"); PlaySoundThing(boredsnd2,player,1,0,1,0x80); PlaySoundThing(boredsnd3,player,1,0,1,0x80); sleep(GetKeyLen(povboredAnim1)/4); PlaySoundThing(boredsnd2,player,1,0,1,0x80); PlaySoundThing(boredsnd3,player,1,0,1,0x80); return; end
It is at the bottom. Or near there. Timer: SenderID 14, br value.
br=rand()*2; This should give me the numbers 0, 1, and possibly 2, no? The printint() says, 0... 0... 1... 0... 1... etc... OK! If(br==1), then... 'Noa, sorry. Doesa nota computa...' A' Bega Pardon?
You can see that if(br==1), then call the bored1 message. And yet, when the printint says that br=1, it does not call the message. Why not? And if you say that bored0/1 is not a valid message, then don't post and bug SM for a renewed Parsec. Sure, the messages are unknown 'cause they are custom. It worked a while ago when I didn't have if(br==0) and a copy of bored0 called bored2 (exact same contens). So, if Equel is not Equel to Equel, what is Equel Equel to if not Equel to Equel?
pardon my frustration
/Edward