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 → Need help with client cog
Need help with client cog
2001-06-30, 7:26 AM #1
I need help with my client cog for the concrifle. I already put the info in the items.dat file so thats not the problem.
This is the client cog.
Code:
flags=0x404

symbols

flex	autoAimFOV=30		local
flex	autoAimMaxDist=5		local

template	projectile=+concbullet		local	
template 	projectile3=+concblast2		local

message		trigger

end

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

code

trigger:
	

	if(GetSourceRef() == 90)
	{
		FireProjectile(player, projectile, fireSound, 18, '0.02 0.15 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
	}
        else
        if(GetSourceRef() == 91)
        {
	FireProjectile(player, projectile3, fireSound, 18, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
        }

		return;

end


This is the fire area in the weap_concrifle.cog file.

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);
   //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, 0, 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, player, 1, -1, -1, 0x80);

   
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   // Provide a kick backwards
   ApplyForce(player, VectorScale(GetThingLVec(player), -80));

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

   Return;


I've been trying to figure out for a few hours now why when I test it nothing comes out of the concrifle.
Any and all help is Extremely Appreciated.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-06-30, 8:09 AM #2
Try replacing the FireProjectile line from the clientcog with this:
FireProjectile(GetParam(0), projectile, -1, -1, '0.02 0.15 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimMaxDist);
2001-06-30, 8:18 AM #3
I changed it like you said and I tested it and nothing came out of the concrifle like before. [http://forums.massassi.net/html/frown.gif] Do you have any other ideas?
thx for trying to help
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-06-30, 1:29 PM #4
Why are you using 'flags=0x404' at the start of your cog? Try changing it to 'flags=0x240'

According to the JK-Specs:
LOCAL 0x40 Cog runs on the client and server
SERVER 0x80 Cog runs only on the server, client messages are forwarded to the server
GLOBAL 0x100 Cog runs locally on all machines
NOSYNC 0x200 COG results are not broadcast to the other machines.

Raynar


------------------
... the Jedi I admire the most, met up with Darth Maul, now he's toast ...
Rbots - a project to develop a working Bot for Jedi Knight... download the latest development version here
Pagewizard_YKS: "making your own lightsaber doesn't make you a nerd... "
Raynar - the man with a 10.75" ePenis
2001-07-02, 4:51 AM #5
nope still didn't work... [http://forums.massassi.net/html/frown.gif]
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-02, 6:12 AM #6
In your trigger (client) cog, replace GetSourceRef() with GetSenderID() for both instances.

[This message has been edited by Jipe (edited July 02, 2001).]
2001-07-02, 11:31 AM #7
Nope that didn't work either. [http://forums.massassi.net/html/frown.gif]
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-02, 12:44 PM #8
now that I look at it closely, there's undefined variables in the trigger (client) cog.. player and fireSound.. you can either pass them through the SendTrigger() as parameters, or just fill in as numbers. you do already have the player passed, but you aren't defining it - use GetParam(2) instead of player, since it's the 3rd parameter in the SendTrigger() being sent.

this is in addition to using GetSenderID() [http://forums.massassi.net/html/wink.gif]

in the weapon cog, you also might want to print out the ID variable to the screen to make sure you're getting the right numbers (90 or 91) sent
2001-07-02, 1:43 PM #9
Hmmmm who wrote that note saying

Quote:
<font face="Verdana, Arial" size="2">//keys should be left here, or somehow broadcasing will make it play more than twice... from the 4th parameter of FireProjectile.</font>


The reason that happens is becase in the trigger cog you have

Code:
fireSound, 18,


That 18 plays a keymode.

Just if you wanted to know.
2001-07-02, 1:53 PM #10
My client cogs work, and they're pretty much the same as yours... but in the FireProjectile line, you should replace
fireSound, 18
with
-1, -1
or else keys and sounds with happen twice.
BTW Seifer, I think that quote is by Hideki in his client cog tutorial.
2001-07-02, 2:07 PM #11
This is what it looks like now.
Code:
flags=0x404

symbols

flex	autoAimFOV=30		local
flex	autoAimMaxDist=5		local

template	projectile=+concbullet		local	
template 	projectile3=+concblast2		local

message		trigger

end

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

code

trigger:
	

	if(GetSenderID() == 90)
	{
	FireProjectile(GetParam(2), projectile, -1, -1, '0.02 0.15 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimMaxDist);


	}
        else
        if(GetSenderID() == 91)
        {
	FireProjectile(GetParam(2), projectile3, -1, -1, '0.02 0.15 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimMaxDist);


        }

		return;

end

The GetParam(2) didn't work. [http://forums.massassi.net/html/frown.gif]
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-02, 2:13 PM #12
Yeah that is a quote by Hideki in his client cog tutorial. I was following his tutorial on it cause i'm new to coging.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-02, 3:43 PM #13
Anyone else have a idea cause i'm running out of them.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-03, 12:31 AM #14
Make sure you put the player or the other packet of info you wanted in the right slot.

So ..

SendTrigger(-1, 10, param0, param1, param2, param3);
2001-07-03, 5:37 AM #15
This is mine right now
SendTrigger(-1, ID, player, 0, 0, 0);

so acording to what you just said the GetParam(2) should be GetParam(0).
Whats the 10 for though? is that for the ID?
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-03, 5:40 AM #16
Ok this is how it looks now.
Code:
flags=0x404

symbols

flex	autoAimFOV=30		local
flex	autoAimMaxDist=5		local

template	projectile=+concbullet		local	
template 	projectile3=+concblast2		local

message		trigger

end

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

code

trigger:
	
	 if(GetSenderID() == 90)
	{
		FireProjectile(GetParam(0), projectile, -1, 8, '0.02 0.15 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	}
        else
        if(GetSenderID() == 91)                         
        {
                FireProjectile(GetParam(0), projectile3, -1, 8, '0.02 0.15 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	}

	return;

	

end

It still doesn't work. I'm starting to think it's something wrong with how I put the code in the weap_concrifle.cog file.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-03, 11:44 AM #17
Ok in conc_rifle.cog put under id = Getcurweapon(player)

printint(id);

Then try teh cog, tell me what it says at the top of the screen when you fire.
2001-07-03, 12:19 PM #18
When I shoot, it prints 90 for primary and 91 for secondary.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-03, 2:21 PM #19
Use GetSourceRef() instead of GetSenderID(), SendTrigger is unique in retrieving its ID as GetSourceRef().

And also in the trigger cog, let both the "8" in the FireProjectile line to be "-1" in the 4th parameter, so it won't double play the key.

I'd like to see the current weap_cocrifle.cog. The trigger cog seems ok, still except for the "flags=0x404" should be "flags=0x240".

And as for the debugging, try placing
"PrintInt(GetSourceRef());" just below "trigger:", so it can check either the trigger has arrived or not, and take away the "printint(id);" in the weap_concrifle.cog as it will definitely print anyway.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited July 03, 2001).]
2001-07-03, 3:07 PM #20
*Is impressed by all the fancy computer talk*
2001-07-04, 4:15 AM #21
Here is what the client cog looks like.
Code:
flags=0x240

symbols

flex	autoAimFOV=30		local
flex	autoAimMaxDist=5		local

template	projectile=+concbullet		local	
template 	projectile3=+concblast2		local

message		trigger

end

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

code

trigger:
	
	 if(GetSourceRef() == 90)
	{
		 FireProjectile(GetParam(0), projectile, -1, -1, '0.02 0.15 0.0', '0 0 0', 1, 0x20, -1, -1);
	}
        else
        if(GetSourceRef() == 91)                         
        {
                 FireProjectile(GetParam(0), projectile3, -1, -1, '0.02 0.15 0.0', '0 0 0', 1, 0x20, -1, -1);
	}

	return;

	

end


Here is what the fire: section looks like in the weap_concrifle.cog file.
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);
   //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, 0, 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, player, 1, -1, -1, 0x80);

   
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   // Provide a kick backwards
   ApplyForce(player, VectorScale(GetThingLVec(player), -80));

   ChangeInv(player, 12, -8.0);

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

   Return;
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-04, 4:53 AM #22
How did the print do?

The cog seems fine, and it now won't autoaim.
What does the cog do now?Still nothing?

You may have had a mistake in the items.dat, if still not working.

------------------
http://millennium.massassi.net/ - Millennium
2001-07-04, 5:27 AM #23
well when I put PrintInt(GetSourceRef()); right under trigger: it didn't say anything when I shot with the gun.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-04, 5:31 AM #24
I just checked my items.dat file and theres nothin' wrong with it.
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-04, 6:00 AM #25
That means the trigger did not arrive.
Let me see the items.dat.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited July 04, 2001).]
2001-07-04, 6:21 AM #26
k here is the items.dat file.
Code:
# ========================================================================================
# Bins 99 - 115 are RESERVED
# ========================================================================================
# They will store the number of the first goal description text in cogStrings.uni, and the
# display status of up to 16 goals (0 to 15).
# ========================================================================================

stringOffset            99              0       99999   0x000

goal00                  100             0       1000    0x040
goal01                  101             0       1000    0x040
goal02                  102             0       1000    0x040
goal03                  103             0       1000    0x040
goal04                  104             0       1000    0x040
goal05                  105             0       1000    0x040
goal06                  106             0       1000    0x040
goal07                  107             0       1000    0x040
goal08                  108             0       1000    0x040
goal09                  109             0       1000    0x040
goal10                  110             0       1000    0x040
goal11                  111             0       1000    0x040
goal12                  112             0       1000    0x040
goal13                  113             0       1000    0x040
goal14                  114             0       1000    0x040
goal15                  115             0       1000    0x040
color_toggle		116		    0		1	  0x120   cog=color_toggle.cog
ghook                   117             1       1       0x122   cog=item_hook.cog
Client			118		    0		0	  0x000   cog=client_bryar.cog
Client			119		    0		0	  0x000   cog=client_strifle.cog
Client			112		    0		0	  0x000   cog=client_thermdet.cog
Client			121		    0 	0 	  0x000   cog=client_crossbow.cog
Client			122		    0       0       0x000   cog=client_repeater.cog				
Client			123		    0		0	  0x000   cog=client_raildet.cog	
Client			124		    0		0	  0x000   cog=client_concrifle.cog

hotkeyOffset            150             0       99999   0x000
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-04, 1:36 PM #27
You can place all your client codes in 1 cog.
In this case, try changing the bin entry names. All the same doesn't look nice.

------------------
http://millennium.massassi.net/ - Millennium
2001-07-04, 1:47 PM #28
i'll try puting all the client cogs into one cog. what do ya mean by changing the bin entry names?
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-04, 4:33 PM #29
they're all called "Client"
2001-07-05, 6:04 AM #30
Ok I put all the client cogs into one cog and then tested it and only 2 guns work now. this is weird
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-05, 1:41 PM #31
Tell me how the cog is(maybe post again) or I can't help.

------------------
http://millennium.massassi.net/ - Millennium
2001-07-06, 4:24 AM #32
heres what the cog looks like.
Code:
symbols

flex            autoAimFOV=30                   local
flex            autoAimMaxDist=5                local

template        projectile=+repeate1            local
template        projectile1=+concbullet         local
template        projectile2=+concblast2         local
template        projectile3=+disc               local
template        projectile4=+disc2              local
template        projectile5=+disc3              local
template        projectile6=+lasershot          local
template	  projectile7=+stlaser            local
template	  projectile8=+grenade1           local
template	  projectile9=+grenade2           local
template	  projectile10=+raildet           local
template	  projectile11=+raildet2          local

vector          randVec                         local

message         trigger

end

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

code

trigger:

	if(GetSourceRef() == 60) || (GetSourceRef() == 61) )
	{
		FireProjectile(GetParam(0), projectile, -1, 8, '0.0186 0.0102 0.00', '0 0 0', 1.0, 0x30, 25, 50);
	        FireProjectile(GetParam(0), projectile, -1, 8, '0.0186 0.0102 0.00', '4.0 0 0', 1.0, 0, 25, 5);
        	FireProjectile(GetParam(0), projectile, -1, 0, '0.0186 0.0102 0.00', '-2.5 2.5 0', 1.0, 0, 25, 5);
        	FireProjectile(GetParam(0), projectile, -1, 0, '0.0186 0.0102 0.00', '-2.5 -2.5 0', 1.0, 0, 25, 5);

        }
        else if( (GetSourceRef() == 90) || (GetSourceRef() == 91) )
	{
		randVec = VectorSet((Rand()-0.4)*2, (Rand()-0.4)*2, 0.0);
                FireProjectile(GetParam(0), projectile2, -1, 8, '0.0135 0.1624 0.0', randVec, 1.0, 0x30, autoAimFOV, autoAimFOV*2);
	        FireProjectile(GetParam(0), projectile1, -1, 8, '0.0135 0.05 0.0', '0 90 0', 1, 0x20, autoAimFOV, autoAimFOV*2);

	}
        else if( (GetSourceRef() == 50) || (GetSourceRef() == 51) )
	{
		FireProjectile(GetParam(0), projectile5, -1, 8, '0.055 0.1896 0.00', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	        FireProjectile(GetParam(0), projectile4, -1, 8, '0.055 0.05 0.00', '0 90 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	        FireProjectile(GetParam(0), projectile5, -1, 8, '-0.055 0.1896 0.00', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	        FireProjectile(GetParam(0), projectile4, -1, 8, '-0.055 0.05 0.00', '0 90 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
        }
        else if( (GetSourceRef() == 20) || (GetSourceRef() == 21) )
	{
                FireProjectile(GetParam(0), projectile6, -1, -1, '0.0135 0.1624 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	}
	else if( (GetSourceRef() == 30) || (GetSourceRef() == 31) )
	{
		FireProjectile(GetParam(0), projectile7, -1, -1, '0.0135 0.05 0.02', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	}
	else if( (GetSourceRef() == 40) || (GetSourceRef() == 41) )
      {
		FireProjectile(GetParam(0), projectile8, -1, 8, '0.0135 0.1624 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
		FireProjectile(GetParam(0), projectile9, -1, 8, '0.0135 0.1624 0.0', '0 0 0', 1, 0x20, autoAimFOV, autoAimFOV*2);
	}
	else if( (GetSourceRef() == 70) || (GetSourceRef() == 71) )
      {
		FireProjectile(GetParam(0), projectile10, -1, -1, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, -1, -1);
		FireProjectile(GetParam(0), projectile11, -1, -1, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, -1, -1);
	}
        return;
end

heres what the items.dat file looks like now.
Code:
stringOffset            99              0       99999   0x000

goal00                  100             0       1000    0x040
goal01                  101             0       1000    0x040
goal02                  102             0       1000    0x040
goal03                  103             0       1000    0x040
goal04                  104             0       1000    0x040
goal05                  105             0       1000    0x040
goal06                  106             0       1000    0x040
goal07                  107             0       1000    0x040
goal08                  108             0       1000    0x040
goal09                  109             0       1000    0x040
goal10                  110             0       1000    0x040
goal11                  111             0       1000    0x040
goal12                  112             0       1000    0x040
goal13                  113             0       1000    0x040
goal14                  114             0       1000    0x040
goal15                  115             0       1000    0x040
color_toggle		116		    0       1	  0x120   cog=color_toggle.cog
ghook                   117             1       1       0x122   cog=item_hook.cog
Client			118		    0		0	  0x000   cog=client_guns.cog
	


hotkeyOffset            150             0       99999   0x000
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher
2001-07-06, 8:35 AM #33
This still doesn't print anything if print placed right below trigger:?

1 note is that you need to have randVec defined BEFORE you send the trigger or else all the clients will get a different value. So have it defined in the weapon cog, send each x, y values in the remaining parameter and set the vector back up in the trigger cog.

And this cog will fire both primary and secondary if one of the fire key is pressed so I suggest you do it this way rather.

if(GetSourceRef() == 90)
{
//do conc primary fire
}
else
if(GetSourceRef() == 91)
{
//do conc secondary fire
}

The name of the trigger cog is named "client_guns.cog" right? [http://forums.massassi.net/html/smile.gif]

The codes just look fine.

If nothing still happens, send me the 1 of the weapon cog, the trigger cog and the items.dat to hideki@massassi.net and I'll take a look.

------------------
http://millennium.massassi.net/ - Millennium

[This message has been edited by Hideki (edited July 06, 2001).]
2001-07-06, 10:29 AM #34
YaY!!! It Works. [http://forums.massassi.net/html/smile.gif]
I thank all of you for helping me. [http://forums.massassi.net/html/biggrin.gif]
Thanks!!
"It's best to keep your mouth shut and look like an idiot than to open it and prove it"
- Robert Fletcher

↑ Up to the top!