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.

ForumsJedi Knight and Mysteries of the Sith Editing Forum → Making concrifle use new ammo type
Making concrifle use new ammo type
2006-01-15, 5:16 AM #1
Yup, I can't do it. I'm convinced there is a way. I used the Imperial Key bin in the items.dat and set up the conc rifle in weap_conrifle.cog to use the new bin number for ammo in every place, I made the new pickup template and in it, attached it to the new powerup cog, so all I really need to know is if its possible? Am I not supposed to use the imperial key bin? Do I need to do something to kyle.cog?

Thank you very much.
2006-01-15, 1:28 PM #2
It probably already does use the right ammo. The problem is, that the displaying of the ammo numbers is hardcoded. Concrifle will always display power cells, no matter what you make it consume. You can work around this with help of the selected/deselected cog messages, by inserting some code that sets power cells to your new bin upon selection and resets it to the prior state upon deselection.
Oh my, I hope you understand me...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-01-15, 10:39 PM #3
This was just so I can control Concussion Rifle ammo in my levels. I started off making the pick-ups only give me one, and the Con Rifle only gives me 3 and no Power Cell, and uses 1 per shot, yet the ammo displayed is as if I did get some powercell, and I can fire it more than 4 times.

Yer not saying that normal? But it is possible? It's been done?


Thank you for your attention
2006-01-15, 11:29 PM #4
Now it's up to me to play the confused one...you did what? As I understood it before, you wanted to make the concy use another ammo bin than power cells...right? If so, you have to know that it will always DISPLAY power cell ammo, but you can work around this issue. To do this, you need to edit weap_concrifle.cog. I can show you the code, if you need it...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-01-16, 3:32 PM #5
remember that when u make a pic up for this new conc rifle, that you add some extra code in the power up code.

if the impkey = binx..
and
Conc rifle weapon number = N

ChangeInv(player, binx, 1.0)
If(GetInvWeapon(player) == N) ChangeInv(player, powercell (12), same value)

You know what I mean, if you have the weapon, this new conc rifle will also had powercells of the same value as well, so it displays properly)

i dont know if tahts what you mean.
Code:
if(getThingFlags(source) & 0x8){
  do her}
elseif(getThingFlags(source) & 0x4){
  do other babe}
else{
  do a dude}
2006-01-18, 8:56 AM #6
And thank you again.

I did this

[items.dat]

#################
#Inventory Items#
#################

# Note that the icon names are taken from these names:
# ==========================================================
bactatank 40 0 5 0x102 cog=item_bacta.cog
irgoggles 41 0 1 0x102 cog=item_irgoggles.cog
fieldlight 42 1 1 0x122 cog=item_fieldlight.cog
#stouker charges
stoukercharges 43 0 6 0x080
wrench 44 0 1 0x042 cog=item_wrench.cog
datadisk 45 0 1 0x042 cog=item_datadisk.cog
keyred 46 0 1 0x042 cog=item_keyred.cog
keyblue 47 0 1 0x042 cog=item_keyblue.cog
keyyellow 48 0 1 0x042 cog=item_keyyellow.cog
wrchblue 49 0 1 0x042 cog=item_wrenchblue.cog
wrchyellow 50 0 1 0x042 cog=item_wrenchyellow.cog
keygreen 51 0 1 0x042 cog=item_keygreen.cog
# ==========================================================

and then this

###################
# Ammo and Energy #
###################

#==========================================================
#energy is used for bryar pistol and stormtrooper rifle.
energy 11 0 500 0x080

#power is used for the the bowcaster, repeater and concussion rifle.
power 12 0 500 0x080

#battery is used for other inventory items.
battery 13 0 200 0x020

#force is used for the force powers.
forcemana 14 0 400 0x000

#rail charges
railcharges 15 0 30 0x080

#stouker charges -conc
stoukercharges 43 0 6 0x080
# ======================================================

See, I made a new ammo type, that way I can populate muh map with power cell weapons while still limiting conc usage.

I used bin 43 since 11 through 15 are ammo but 16 is already used.

In the pick up for stouker charges- the new conc ammo, it gives you 1 ammo (one bin 43)
when you pick up the conc rifle, pow_concrifle, it gives you 3 ammo.

Yet I can fire it more than 3 times.
2006-01-18, 1:47 PM #7
As I told you, check weap_concrifle.cog. There is a line under activated: or fire: that says: ChangeInv(player, 12, -1) or something. This means, subtract one from power cells...enter your new bin there. But the main problem will remain, because it will still DISPLAY power cells, no matter what you do. Apply my above mentioned workaround and your done.
This, at least, is how I remember it. I'm on a linux machine here, so I can't run any tests to verify it.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-01-20, 6:50 AM #8
It has been done though? Cause I'm sure the cogs are all right.
2006-01-20, 12:52 PM #9
Originally posted by Ruthven:
remember that when u make a pic up for this new conc rifle, that you add some extra code in the power up code.

if the impkey = binx..
and
Conc rifle weapon number = N

ChangeInv(player, binx, 1.0)
If(GetInvWeapon(player) == N) ChangeInv(player, powercell (12), same value)

You know what I mean, if you have the weapon, this new conc rifle will also had powercells of the same value as well, so it displays properly)

i dont know if tahts what you mean.


There's one other thing that needs to be fixed:

Selected:
OldRifleAmmo = GetInv(player, 12);
SetInv(player, 12, GetInv(player, newAmmoBin));


Deselected:
SetInv(player, 12, OldRifleAmmo);

The idea behind it is that when you select the Concussion you get the amount of powercells you currently have and saves it for later resetting of the bin. Then it sets the powercell ammo to whatever the amount in your new ammo is. Then Ruthven's code will actually work in both the pickup and in the weapon cog itself. It basically decreases the new ammo by a certain number, then sets the powercell ammo to the same number. The Deselected code will reset the powercell ammo to where it was before you selected the concussion rifle so that when you select another weapon that uses powercells it will be correct.

It's all a little foggy (it's been a long time) but hopefully you understand the principle. If you understand that, the rest is easy.
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2006-01-21, 10:32 AM #10
It has been done, yes, and it works the way we all told you. You have a new bin set up, that's good. But you still need to apply the workaround detailed by Tazz. I repeat the problem: Even if you make the concrifle use your new bin everywhere, it will still display power cells. Because the numbers in the hud are hardcoded...they can't be controlled by cog. The workaround works like Tazz posted. As soon as a player selects the concrifle, it caches the amount of power cells, then sets the amount of power cells to the amount of your new bin. The concrifle then still uses power cells (ignore my post about changing it, this is wrong) - make sure you adjust the consumption rate. If the player deselects the concrifle, the current amount of power cells (which actually is the amount of your new bin) is written back to your new bin (Tazz forgot that step, it is necessary, though) and the power cells are restored to the cached value (the value prior to the selection of the concrifle).

Tazz code repeated and updated:
Code:
selected:
// Cache old pcell amount
OldAmmo = GetInv(player, 12);
// Set pcell amount equal to new ammo amount
SetInv(player, 12, NewAmmoBin);
...

deselected:
// Update new ammo amount with current pcell amount
SetInv(player, NewAmmoBin, GetInv(player, 12));
// Restore old pcell amount
SetInv(player, 12, OldAmmo);
...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-01-23, 8:15 AM #11
Werd. Thanks for all the help!

↑ Up to the top!