- Quick Links -


Jedi Knight modifying site

Visitor No.72282
Since July 1999

Theme :

Massassi Temple MILLENNIUM
LucasArts Entertainment Company

- Random Picture -

On The Edge

On The Edge

Forum Projects Documents Features Extra Links
Using Custom Projectiles in Multi Player Games

DOWNLOAD


1

In this tutorial I'm going to tell how to make new projectiles work in multi player games. Thanks to Hell Raiser for the idea.

Obviously LEC made the static jkl'ed weapons not to appear in multi player games. Leave out the reason, it just happens. Using Fireprojectile will not create a thing on others' computer unless it's in the original gob.

To overcome this situation SendTrigger is a good verb to use.


2

Create the new weapon templates in the static.jkl as you want. In the weapon cog add the following. The ID is just an example to distinguish the projectile with a unique number. This example shows part of Bryar Pistol cog.

   FireProjectile(player, NewTemplate, sound, Key, the rest...);

Either in single player or multiplayer, do the same. Now you can remove the FireProjectile line and replace with these lines.

   //A unique ID to be retrieved in the trigger message with GetSourceRef().
   ID = GetCurWeapon(player) * 10 + mode;

   //Make sure to place this in here, or you won't here the sound anytime. Reasons stated below.
   PlaySoundThing(sound, player, 1, -1, -1, 0x80);

   //Make sure to place this in here as well, or you won't see the external key anytime. Reasons stated below. 
   //subMode can either be 8 for small fire key(bryar etc) and 18 for big fire key(concussion etc). 
   PlayMode(player, subMode); 

   //Send the trigger, so every player's computer will receive the action
   //with the player(shooter) value attached to execute the fire action.
   SendTrigger(-1, ID, player, 0, 0, 0);

Close the cog.


3

Now, the real purpose of sending trigger is to execute the action locally on each computer. So, create a new cog with flags=0x240 just above symbols at the top which will make the cog results not to be broadcasted to other computers. Add a trigger message.

In the trigger message of that cog add this,

   //Fire at everyone's(including yourself) computer.
   if( (GetSourceRef() == 20) || (GetSourceRef() == 21) )      //In this case, bryar is weapon 2
   {                                                                                     //and fire mode could be 1 or 0. So it will receive unique 20 or 21.
      FireProjectile(GetParam(0), NewTemplate, -1, -1, the rest...);   //Let Param(0) (player value sent) fire the projectile.
   }

   return;

Make really sure to change the sound and key mode parameter to -1 in trigger message, or you'll here double sounds or/and keys from other computers.

With the new cog you just created only containing the trigger message, its existence has to be recognized by JK in some way in order for it to work.

If you're making a level(which in this case you should just simply edit the master.tpl with your new ones) don't worry and JED will write up jkl file with the cog mentioned.

But if you're making a modification patch, you need an alternative way. My method was to place a new entry in items.dat(just 116) and add the cog name as it does with other forces and items. (You can leave the flag as 0x000) In that way when JK loads, it will know that the cog is used and will call all the messages including trigger.(Examples shown below as items.dat)


4

This does not cause any recognizable lags at all. Plus, because other player's movement and the trigger info arrives at the same time, nothing will look funny, they fire when they did.

Notes :

1. Do not forget to add trigger message in the symbols section.

2. Make sure every projectile in every weapon has its own unique ID that can be retrieved in the trigger message.

3. Make sure to keep the sound and key mode parameter to be -1 or you'll hear the firing sound or keys played more than twice.


Resources

weap_bryar.cog

client_bryar.cog

items.dat


Forum Projects Documents Features Extra Links

Top - Home - Back

PHP Apache Valid XHTML 1.0! Valid CSS!

This site is developed using PHP under Apache server
with XHTML, JavaScript, CSS and Cookie technology.

Certain parts of this site require Cookie support.

This site is best viewed with Internet Explorer 5.5, Netscape 6.0, Opera 6.0 or Mozilla 1.0 and above
at resolution 800 * 600 and higher.

Nothing on this site is made, distributed, or supported by LEC.
Please use and download all materials at your own risk.

© 1999-2004 Hideki.

This page was last modified on Sat, 30 Jul 2011 17:28:41 +0000.