Discord
Login
Community
DARK THEME

How to make ai for my Russian roulette style game?

I am trying to make a buckshot roulette type of game and I was wondering how to make a good ai for the opponent Here's the current code and I'll explain whats happening

// Shoot function is obvious meaning shoot
// reallshell is how many real shells are left. 
// shells are just in total how many shells
//he will shoot you automatically if on one health
// badhurt is if he gets hurt then he ill immediately shoot you 
badguyai = function()
  if whosturn == "enemy" and play == true then
    time = time + 1
  if time == 101 then
    time = 0
  end
// the time is just so he doesn't do it in rapid succession
  if time == 100 then
      if realshell + (realshell/2) >= shells - badaiturn or badhurt == true or playerhealth == 1 and realshell != 0 then
      shoot("player")
      badaiturn = badaiturn + 1
      whosturn = ("player")
      badhurt = false
      badaiturn = 0
      atwho = "me"
    else
      shoot("enemy")
      badaiturn = badaiturn + 1
      atwho = "him"
    end
  end
  end
end

Heres the project link: https://microstudio.dev/i/DanMan97/buckshotorsomething2/

I just learned that the actual ai in buckshot is dumb

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community