Creating an "ammo" system w/o a weapon?

MysticalMist

Well-known member
I am currently working on a project where I have a player that throws ninja stars. However, I only want him to have a limited amount that stars that can only be replenished through collectables or is reset upon death. What is the best way to make it a variable that can be easily shown and adjusted?
 
I am currently working on a project where I have a player that throws ninja stars. However, I only want him to have a limited amount that stars that can only be replenished through collectables or is reset upon death. What is the best way to make it a variable that can be easily shown and adjusted?

I would just make it an entity variable. Pretty simple really. That said, the engine has a very, VERY old but still working native projectile feature. It sets the projectile model to shoot, counts ammo, has replenish capability with items, and even optionaly displays remaining shots. It's all really crude, but it is there if you want to go that route.

DC
 
I would just make it an entity variable. Pretty simple really. That said, the engine has a very, VERY old but still working native projectile feature. It sets the projectile model to shoot, counts ammo, has replenish capability with items, and even optionaly displays remaining shots. It's all really crude, but it is there if you want to go that route.

DC

Alright, sounds good!

My next step at this point I think, is adding a check to make sure the key is disabled once the star count reaches zero.

For reference, here is how the variable is referenced in the throw animation:
Code:
anim freespecial5 #neutral toss
    delay    3
    offset    60 126
    bbox 47 54 27 74

    frame data/Chars/hanzo/throw/1.png
    frame data/Chars/hanzo/throw/2.png
    frame data/Chars/hanzo/throw/3.png
    sound data/sounds/throw.wav
    @cmd projectile 1 "h_star" 20 1 50 0 0 0
        @script
    void self    = getlocalvar("self");
     if(frame==3){
    void star = getentityvar(self,"StarCount");
    setentityvar(self,"StarCount",star-1);
      }
    @end_script
    frame data/Chars/hanzo/throw/4.png
    frame data/Chars/hanzo/throw/5.png
    delay 6
    frame data/Chars/hanzo/throw/6.png
    delay 4
    frame data/Chars/hanzo/throw/7.png
    frame data/Chars/hanzo/throw/8.png
    frame data/Chars/hanzo/throw/9.png

He also has a jumping and crouching version of this animation, but you get the idea. I'm sadly not as smart with code as one may assume o_O
 
Back
Top Bottom