ammo indicator?

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

ammo indicator?

Post by darksmaster923 »

hey guys, i have a scripted player, but i dont really know how to add an ammo indicator for it, since the ammo in the clip variable is in the script and i dont know how to make it show up in the hud
Herp derp.
User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: ammo indicator?

Post by Juutis »

Add an attribute to the player. Something like 'ammo' and then use 'SetAttribute("ammo",<your ammo variable>,"Player");'.

Now the player's attribute called 'ammo' should always have the same value as your ammo variable in the script. Then just define a new HUD element with the 'ammo' attribute.
Pain is only psychological.
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: ammo indicator?

Post by darksmaster923 »

what about the spare clips? i have them in my player.ini, so how would i 'activate' them.
Herp derp.
User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: ammo indicator?

Post by paradoxnj »

Think of the logic that needs to happen.

1. First clip is empty
2. Check if there are spare clips available in inventory
3. If yes, reset ammo value to amount of ammo in spare clip and remove a clip from inventory
4. If no, gun is empty
Many Bothans died to bring you this signature....
Post Reply