Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Possible Event problem

So, I'm making a survival horror game, as some of you know (Thanks again Beran =D) and I decided to put a "taser" in the game to ward off ghosts. Here's how the event goes so far for when the taser has ammo:

>if taser in inventory
  >Show animation "Shock", this event
    >Control Variables "Taser Shots"-=1
    >Control Variables "Enemy Health" -=1

My problem is... well, would this even work? I'd go u to the enemy, press enter, and his health should go down, but If I have two or more enemies on the screen, wouldn't all their health go down?

I don't know, this whole concept is confusing the hell out of me >_<.

Also, would this work for the bullets?

>if taser in inventory
  >Play SE "Reload"
  >Change variables "Taser Sots" +=5
  >change items "Taser Shots" -=1
 
You need variables to track every enemy's health separately, obviously-- also, how do you want the taser to work?  Does it hit the enemy wherever it is on the screen, or only in hand-to-hand, or does it have a range?  If you're using an event-based ABS, you'll need variables to track the X and Y of the player and each on-screen enemy.
 
It seems to me like you want it only to happen when you're next to the enemy? which is easy enough to achieve by just having an "on-action-button" event for the enemy.
As for the actual event. I'm not completely sure what you're trying to achieve. Do you want to have it reload every five shots, thus taking 1 bullet?
If that's the case you need an extra conditional branch in the second part, under the first conditional branch saying
if "Taser shots" is greater than or equal to 1
And in the first part, to ensure that you have a  loaded taser
add a second conditional branch after the first one checking
if variable "Taser shots" is greater than or equal to 1.

As for enemy health, you can circumvent using a ton of variables for the enemies by using a small script. Somewhere, you'll need to initialize the health for each separate enemy like this (in a script call)
$enemy_health = [hp1,hp2,hp3,hp4,hp5,hp6]
You can put as many values in there as you want depending on the number of enemies. and just replace those hp's with an actual value. These hp's will each correspond to an enemy
Then, when you hit the enemy instead of decreasing a variable, decrease the corresponding "array element" like so
$enemy_health[number] -= 1
note that you need to replace the number with the number of the enemy.
Also note that the number for the 1st enemy will be 0, so keep that in mind (that's just how arrays work)
 
Basically, it's not really supposed to be any major game making thing, in fact, you could almost skip it if you wanted. So, just something that runs on the enemy. Every time you'd press the action button, the event would go, taking away the enemy's health and your ammo. Then, a short waiting time, and you'd shoot again.

As for the reloading, that was just a question to see if a item would work. It is a item called Taser Shots, set up to runa coomon event when used, which is what I explained in the first post. Sorry i wasn't clear enough =P.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top