Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Easch! A problem...
Easch! A problem...
2004-02-26, 6:34 AM #1
Hi!
I have a really big problem. For the first, weapon 5 can't be selected. I know that in a pulse of 0.1 I SetInv(GetLocalPlayerThing(), 5, 1); but in ONE level, weapon 5 doesn't exist. I know it's not a problem in the weapon cog because, if that was the case, the previous weapon would be looping in its Dismount animation.
Code:
# Always do this:
#
# By Edward
symbols

message		startup
message		pulse

model		pl=newman.3do	local
model		weaponmesh=transportTRAIN_small.3DO	local

end
#
code
startup:
	SetPulse(0.1);
	SetThingModel(GetLocalPlayerThing(),pl);
	ChangeInv(GetLocalPlayerThing(), 13, 1000.0);
	sleep(0.2);
        jkSetWeaponMesh(GetLocalPlayerThing(),weaponmesh);
return;
pulse:
  SetInv(GetLocalPlayerThing(), 2, 0);   // briar
  SetInv(GetLocalPlayerThing(), 3, 1);   // STRifle

  SetInv(GetLocalPlayerThing(), 5, 1);   // Crossbow
  SetInv(GetLocalPlayerThing(), 6, 0);   // Repeater
  SetInv(GetLocalPlayerThing(), 7, 0);   // Railgun

  SetInv(GetLocalPlayerThing(), 9, 0);   // Concussion Rifle

  SetInv(GetLocalPlayerThing(), 15, 0);   // Railcharges
return;
end

This is where I set the weapons you may only have in this perticular level.
Code:
#Level master COG
#Generated by JED 0.95 beta

symbols
message   startup
int       player    local
material	WhiteSaberSide=WhiteSaberSide.mat	local
material	WhiteSaberTip=WhiteSaberTip.mat		local
template	Wall=+ssparks_wall			local
template	Blood=+ssparks_blood			local
template	Saber=+ssparks_saber			local
end

code

startup:
  sleep(1);
  // Register COG as master COG
  SetMasterCOG(GetSelfCOG());
  player = GetLocalPlayerThing();
  JKSetSaberInfo(player,WhiteSaberSide,WhiteSaberTip,0.002,0.002,0.125,Wall,Blood,Saber);
  // Initialise Goals
  SetInv(player, 99, 5000);
  SetGoalFlags(player, 0, 1);
  SetGoalFlags(player, 1, 0);
  // Give player weapons and ammo
  SetInv(player, 1, 1);   // fists
  SetInv(player, 2, 0);   // briar
  SetInv(player, 3, 1);   // ST Rifle
  SetInv(player, 4, 0);   // TD
  SetInv(player, 5, 1);   // Crossbow
  SetInv(player, 6, 0);   // Repeater
  SetInv(player, 7, 0);   // Railgun
  SetInv(player, 8, 0);   // Sequencer charges
  SetInv(player, 9, 0);   // Concussion Rifle
  SetInv(player, 10, 0);   // Lightsaber
  SetInv(player, 11, 0);   // Energy
  SetInv(player, 12, 0);   // Power
  SetInv(player, 15, 0);   // Railcharges
  // Initialize weapon.
  SetFireWait(player, -1);
  SetMountWait(player, 0);
  SetCurInvWeapon(player, 0);
  SelectWeapon(player, AutoSelectWeapon(player, 1));
  sleep(1);
  SetGoalFlags(player, 0, 2);
  SetGoalFlags(player, 1, 1);

  // Force ranking
  SetInv(player, 20, 8);
  SetInv(player, 14, 300);
  SetInv(player, 21, 4.0);
  SetInv(player, 22, 4.0);
  SetInv(player, 24, 4.0);
  SetInvAvailable(player, 21, 1);
  SetInvAvailable(player, 22, 1);
  SetInvAvailable(player, 24, 1);
  SetInvActivated(player, 21, 1);
  SetInvActivated(player, 22, 1);
  SetInvActivated(player, 24, 1);
  sleep(3);
  SetInvActivated(player, 21, 0);
  SetInvActivated(player, 22, 0);
  SetInvActivated(player, 24, 0);
  jkSyncForcePowers();
  Return;

end

This would be the start of the one level.
Code:
# Jedi Knight Cog Script
#
# WEAP_STRIFLE.COG
#
# WEAPON 5 script - Crossbow
#
# The standard rifle used by the tuskans.  Not as accurate as the Bryar Pistol.
# 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=strv.3do                   local
model		newguy=newmang.3do		local
model		guy=newman.3do			local

keyframe    mountAnim=STRvUP.key               local
keyframe    dismountAnim=StrVdis.key            local
keyframe    povfireAnim=STRvshoot.key            local
keyframe    holsterAnim=putaway.key             local

sound       mountSound=df_rif_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local
sound       fireSound=bcfire01.wav              local
sound       outSound=pistout1.wav                local

template    projectile=+crossbowbolt4	local

thing       player                              local

flex        fireWait=0.1                        local
flex        holsterWait                         local
flex        powerBoost                          local
flex        autoAimFOV=25                       local
flex        autoAimMaxDist=5                    local

int         dummy                               local
int         trackID=-1                          local
int         fireChannel=-1                      local
int         holsterTrack                        local
int         mode                                local

message     activated
message     deactivated
message     selected
message     deselected
message     autoselect
message     fire
message     timer
message		pulse

end

# ========================================================================================

code

fire:
   player = GetSourceRef();
   mode = GetSenderRef();

   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

   // Check Ammo - If we are out, autoselect best weapon.
   // It should always use two energy cells, but -- as in DF --
   // allow the last fire if there is only one left...
   if(GetInv(player, 12) < 1.0)
   {
      PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      Return;
   }

   // Get random aiming error

   SetPOVShake('0.0 -.003 0.0', '1.5 0.0 0.0', .05, 80.0);
   dummy = FireProjectile(player, projectile, fireSound, 8, '0.0368 0.0896 0.00','0 0 0', 1.0, 0x30, autoAimFOV, autoAimFOV*2);
   // SetThingVel(dummy, vectorScale(GetThingVel(dummy), 0.01));

   ChangeInv( player, 12, -1.0 );
   jkPlayPOVKey( player, povfireAnim, 1, 0x38 );

   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, fireWait/powerBoost);

   Return;

# ........................................................................................

activated:
   player = GetSourceRef();
   mode = GetSenderRef();
   if(GetInv(player, 12) < 1.0)
   {
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      else
         PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);

      Return;
   }

   jkSetWaggle(player, '0.0 0.0 0.0', 0);
   powerBoost = GetInv(player, 63);
   ActivateWeapon(player, fireWait/powerBoost, mode);
   Return;

# ........................................................................................

deactivated:
   player = GetSourceRef();
   jkSetWaggle(player, '10.0 7.0 0.0', 350);
   DeactivateWeapon(player, mode);
   Return;

# ........................................................................................

selected:
   // Play external animation
   PlayMode(player, 41);

   // Set up meshes and models.
   jkSetPOVModel(player, povModel);
   SetArmedMode(player, 1);

   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   // Play sound and animation.
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   SetMountWait(player, GetKeyLen(mountAnim));

   // Set flags, etc.
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 5);

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
   }
SetActorFlags(player, 0x2000);
SetThingModel(player,newguy);
   Return;

# ........................................................................................

deselected:
   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);
   
SetThingModel(player,guy);
   Return;

# ........................................................................................
autoselect:
   // If the player has the weapon
   if(GetInv(player, 5) != 0.0)
   {
      // If the player has ammo
      if(GetInv(player, 12) > 1.0)
      {
         ReturnEx(700.0);
      }
      else
      {
         ReturnEx(-1.0);
      }
   }
   else
   {
      ReturnEx(-1.0);
   }

   Return;

# ........................................................................................

timer:
   StopKey(player, holsterTrack, 0.0);
   Return;
pulse:
jkSetWaggle(player, '0.0 0.0 0.0', 0);
return;
end

And this is the weapon COG.

I know you'd like the whole level to check out all phenomenons, but it's a bit of a secret project. And I can't think of anything in the level that would do it, nor did I have anything to do with the weapons in any of my other COGs. I could give you level status: 138 things and 776 sectors.

Oh, I do take powercells but still nothing happens. Oh, and also, this weapons COG was taken from the ST-rifle cog, because I wanted them to do the same thing only with different power sources and bolts. One with energy and one with power. AND, when I switch between ST-rifle, and Crossbow, the pick-out animation (which is the same) goes all hay wire. I pick out ST-rifle, it's normal. I pick out Crossbow straight after, it's down in the corner, hard to see, with the hand looping in its put-away animation.

/Edward


[This message has been edited by Edward (edited February 26, 2004).]
Edward's Cognative Hazards
2004-02-26, 9:58 AM #2
Quote:
<font face="Verdana, Arial" size="2">AND, when I switch between ST-rifle, and Crossbow, the pick-out animation (which is the same) goes all hay wire. I pick out ST-rifle, it's normal. I pick out Crossbow straight after, it's down in the corner, hard to see, with the hand looping in its put-away animation.
</font>

The animation looping probably means you are loading the same weapon model as the last one that was selected (for POV). If this is the case, copy the file and give it a different name and select it for the other weapon cog.

And for the top, you're trying to NOT have the crossbow be able to be selected, right? Or is it supposed to be available but it isn't being set that way? Sorry, I'm just a bit confused by what you said there.
Quote:
<font face="Verdana, Arial" size="2">For the first, weapon 5 can't be selected. I know that in a pulse of 0.1 I SetInv(GetLocalPlayerThing(), 5, 1); but in ONE level, weapon 5 doesn't exist.</font>


------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited February 26, 2004).]
May the mass times acceleration be with you.
2004-02-26, 10:16 AM #3
I have given it a different object. But the animations are the same.
And I did some testing on why I don't have weapon 5. This project, I decided to make a little mod out of it (because of the new weapons). I tried it in the original JK levels AND, weapon 5 works only in some levels. It doesn't work in 3, 6, 9, 10, 11, 12, 13, 17, 19, 20, 21. Lightside that is. Any ideas?
Edward's Cognative Hazards
2004-02-26, 11:49 AM #4
Whoa! That looks like the SAME levels my first zoom crosshairs didn't work in! Didn't fire the template in those levels. Wierd!

I never figured that out. [http://forums.massassi.net/html/frown.gif]

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-02-26, 9:06 PM #5
Done some more tests. I set the SaberInfo in the pulse, and in those levels I've given, the saber doesn't turn white! My guess is that, a COG somewhere is dissabling weapon 5, and isn't letting the pulse COG activate. I put the SaberInfo in the start right after the little sleep and still nothing. And yes, I have set an item to run the COG. Something like:
always , 120 , 1 , 1 , 0x120 , cog=AlwaysTop.cog

NO! TEACHER DRAGS ME AWAY!!! AAAAAAAAAAAH! CAN'T FINISH!
Edward's Cognative Hazards
2004-02-26, 11:24 PM #6
Hmmm, I remember something similar from the distant past. While working on PWP3, I noticed that some cogs just didn't work in some levels. Couldn't ever find a solution to this problem, so I dropped the project.

[wild speculations]Maybe JK has a limited script buffer size, that only allows so and so many bytes of code? Or it could just be a maximum cog script limit per level.[/wild speculations]

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

[This message has been edited by zagibu (edited February 27, 2004).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-02-27, 10:08 AM #7
Quote:
<font face="Verdana, Arial" size="2">While working on PWP3, I noticed that some cogs just didn't work in some levels. Couldn't ever find a solution to this problem, so I dropped the project.</font>

Wait, does that mean you aren't making it anymore?

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.
2004-02-27, 12:47 PM #8
Well, what else could it mean?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2004-02-28, 8:50 AM #9
[edit]Never mind, I'm derailing the thread. Zagibu, check your email (used the one on the PWP3 site).

Sorry, Edward. As I said, I have no idea on the solution to this bug of yours. [http://forums.massassi.net/html/frown.gif]

------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team

[This message has been edited by Darth Slaw (edited February 28, 2004).]
May the mass times acceleration be with you.

↑ Up to the top!