Ammo counter

Started by mrofa, July 03, 2014, 07:02:15 AM

Previous topic - Next topic

mrofa

So i did make a weapon that uses ammo. But the problem i got is that i cant make a damn couter for the ammo, so thers no way to know how much ammo is left.
Ammo clip is on verb level (verb_shoot replacment).
I did try to affect the owner but it seems that all stuff from info tab is read only.
Did try also affect the pawn primary equipment button itself but didnt had much of luck with it.
One way that i did get to do this is to change texture of the gun each time it shots, but this is the way i want to avoid.
Other way was that i can spawn a mote over owner head, which like above need to change textures, and want to avoid this as well.
So any of you guys maybe got a idea how to do that ?

All i do is clutter all around.

Tynan

You could override Equipment and issue a special new override of Command that displays the ammo counter instead of the default Command. That's my first thought.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

mrofa

Im not sure what are default command, and tier code looks like ancient aztec combined with da vinci code :D
Will harras some smart brains for help on this thrugh, thanks :)
All i do is clutter all around.

Tynan

Well, you just need to make a new subclass of Command which displays ammo. Commands are the little buttons that appear along the bottom of the screen when things are selected. Your command doesn't even have to be interactive!

Then, override Equipment with a special subclass, and with its GetCommands(), issue your special command that displays ammo. Done!
Tynan Sylvester - @TynanSylvester - Tynan's Blog

mrofa

Thats a interesting use of getcommand  cool thanks :)
All i do is clutter all around.