Sign in to follow this  
Followers 0
Homer90001

Sweet Little Fighting System

33 posts in this topic

Hiya. Been working a script that popped into my head for about 2 days. It is a combat system that has three stats (Agility, Strength, and Stamina).

It has a fighting system along with a splashtexton box that allows a view of the health. I also tried to balance it out a little by making it so that your stats total equaled 14. ( 3 stats random number 1-10) and that the damage that you are about to do is at least 5% of the enemies total health( if not, add 10 until this is so)

Just thought I would post what I have here to see what you guys think.

Current Problems:

Sometimes the splash will disappear after one player attacks another, but will return on the next attack.

Wishlist:

Real time Combat (auto fights)

Agility effects attack speed (only would work if above happened)

Items

Different options (defend, etc)

A defensive stat (maybe like armor)

So ya, have fun with this little script. Feel free to use it for whatever, just make sure you give me some props!! :D

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Jacob Pannell

 Script Function:
    Battle

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here




;Splash--------------------------------------------------------------------------------------------------
splashtexton("Battle!","This is Jacob Pannell's version of 'Battle!'. [attachment=19694:Battle_AutoIt_.au3]All rights reserved.")
sleep(2000)
splashoff()
;------vars
$player1roll = "go"
$player2roll = "go"
$p1rollstotal = 0
$p2rollstotal = 0

$p1stm = 0
$p1agi = 0
$p1str = 0

$p2stm = 0
$p2agi = 0
$p2str = 0

$p1status = "fine"
$p2status = "fine"


;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....")
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....")
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5)) + ($p1str * .02)
                until $damage1 >= (.05 * $p2health)
            EndIf
            $p2health = $p2health - $damage1
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
        Else
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5)) + ($p1str * .02)
                until $damage1 >= (.05 * $p2health)
            EndIf
            $p2health = $p2health - $damage1
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
        Else
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    EndIf
EndFunc


func attack2()
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do 
                    $damage2 = $damage2 + int(random(1,5)) + ($p2str * .02)
                until $damage2 >= (.05 * $p1health)
            EndIf
            $p1health = $p1health - $damage2
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5)) + ($p2str * .02)
                until $damage2 >= (.05 * $p1health)
            EndIf
            $p1health = $p1health - $damage2
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    EndIf
EndFunc
            



;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")


;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")


;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))

;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf



    

;Health Printout
;msgbox(64,"Health",$player1name & "'s health is " & $p1health & ".")
;msgbox(64,"Health",$player2name & "'s health is " & $p2health & ".")

;Fight!!!!
while $p1health > 0 and $p2health > 0
    if $turn = "p1" Then
        splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,576,289,1 + 2 + 4,-1,-1,-1)
        attack1()
        $turn = "p2"
    Else
        splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,576,289,1 + 2 + 4,-1,-1,-1)
        attack2()
        $turn = "p1"
    EndIf
WEnd
splashoff()
;determine whos dead
if $p1health = 0 Then
    $p1status = "dead"
elseif $p2health = 0 Then
    $p2status = "dead"
EndIf

;Ending
if $p1status = "dead" Then
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
EndIf

Battle_AutoIt_.au3


"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites



can you upload the images?

Share this post


Link to post
Share on other sites

Its just a little paint image, and i commented it because it was set for my system. It literally just says "Game Over" in really bad writing LOL.


"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites

you could just add a splash screen with the damage dealt sleep and then splash off and continuw

Share this post


Link to post
Share on other sites

Pretty cool :D i like it

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

this is my edit of the script, made the health update as the box with damage dealt appears instead of after you click ok and added an item, shield that has a 50% chance of negating 50% of the damage. you're asked whether or not to use shields at the beginning of the program. gonna add more items later, a sword to just increase damage by a certain amount, amour to increase sta boots to increase agi gauntlets to increase str and might make agi more useful with crits and such. also made the "GUI" look, in my opinion, better.

edit: also fixed an annoying glitch where it would sometimes do like 95.08 damage

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Jacob Pannell

 Script Function:
    Battle

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here




;Splash--------------------------------------------------------------------------------------------------
splashtexton("Battle!","This is Jacob Pannell's version of 'Battle!' by Travis Sims. All rights reserved.",175,75,-1,100,1,-1,-1,-1)
sleep(2000)
splashoff()
;------vars
$player1roll = "go"
$player2roll = "go"
$p1rollstotal = 0
$p2rollstotal = 0
$damage1 = 0
$damage2 = 0
$p1stm = 0
$p1agi = 0
$p1str = 0

$p2stm = 0
$p2agi = 0
$p2str = 0

$p1status = "fine"
$p2status = "fine"
$shieldeffect = 0
$p1shield = 1
$p2shield = 1

;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            if $p2shield = 1 Then
                Shield2()
                EndIf
            $p2health = $p2health - $damage1
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
            
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            if $p2shield = 1 Then
                Shield2()
                EndIf
            $p2health = $p2health - $damage1
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    EndIf
EndFunc


func attack2()
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do 
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            if $p1shield = 1 Then
                Shield1()
                EndIf
            $p1health = $p1health - $damage2
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            if $p1shield = 1 Then
                Shield1()
                EndIf
            $p1health = $p1health - $damage2
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    EndIf
EndFunc
            
func Shield1()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage2 = int($damage2 /2)
    msgbox(64, "shield", $player1name & "took half damage!") 
    EndIf
EndFunc

func Shield2()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage1 = int($damage1 /2)
    msgbox(64, "shield", $player2name & "took half damage!") 
    EndIf
EndFunc

;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")
$Items = msgbox(65,"Items","Use Shields?")
If $Items = 1 Then
    $p1shield = 1
    $p2shield = 1
Else
    $p1shield = 0
    $p2shield = 0
EndIf

;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")


;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))

;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf



    

;Health Printout
;msgbox(64,"Health",$player1name & "'s health is " & $p1health & ".")
;msgbox(64,"Health",$player2name & "'s health is " & $p2health & ".")

;Fight!!!!
while $p1health > 0 and $p2health > 0
    splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
    if $turn = "p1" Then
        
        attack1()
        $turn = "p2"
    Else
        
        attack2()
        $turn = "p1"
    EndIf
WEnd
splashoff()
;determine whos dead
if $p1health = 0 Then
    $p1status = "dead"
elseif $p2health = 0 Then
    $p2status = "dead"
EndIf

;Ending
if $p1status = "dead" Then
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
EndIf
Edited by Darth

Share this post


Link to post
Share on other sites

Neat concept. Maybe use a progress bar for each player's health and a combat log to list all the things that have happened.


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

working on special attacks, with animations =), and yes I am stealing his project and mutating it beyond recognition to suite my needs }:D thank you so much for this

Share this post


Link to post
Share on other sites

working on special attacks, with animations =), and yes I am stealing his project and mutating it beyond recognition to suite my needs }:D thank you so much for this

No problem lol. I honestly didn't think it was that good LOL. Have fun!


"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

;determine whos dead
if $p1health = 0 Then
    $p1status = "dead"
elseif $p2health = 0 Then
    $p2status = "dead"
EndIf

Should be changed to:

;determine whos dead
if $p1health <= 0 Then
    $p1status = "dead"
elseif $p2health <= 0 Then
    $p2status = "dead"
EndIf

so that if the players health goes into the negatives, they still will be marked as dead.

EDIT: oh and in both the attack statements the part here:

if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then

you can remove the

if $hitchance2 (or 1) = 4
because it doesn't roll to 4 anymore. Its 6-10 Edited by Homer90001

"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites

this is my edit of the script, made the health update as the box with damage dealt appears instead of after you click ok and added an item, shield that has a 50% chance of negating 50% of the damage. you're asked whether or not to use shields at the beginning of the program. gonna add more items later, a sword to just increase damage by a certain amount, amour to increase sta boots to increase agi gauntlets to increase str and might make agi more useful with crits and such. also made the "GUI" look, in my opinion, better.

edit: also fixed an annoying glitch where it would sometimes do like 95.08 damage

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Jacob Pannell

 Script Function:
    Battle

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here




;Splash--------------------------------------------------------------------------------------------------
splashtexton("Battle!","This is Jacob Pannell's version of 'Battle!' by Travis Sims. All rights reserved.",175,75,-1,100,1,-1,-1,-1)
sleep(2000)
splashoff()
;------vars
$player1roll = "go"
$player2roll = "go"
$p1rollstotal = 0
$p2rollstotal = 0
$damage1 = 0
$damage2 = 0
$p1stm = 0
$p1agi = 0
$p1str = 0

$p2stm = 0
$p2agi = 0
$p2str = 0

$p1status = "fine"
$p2status = "fine"
$shieldeffect = 0
$p1shield = 1
$p2shield = 1

;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            if $p2shield = 1 Then
                Shield2()
                EndIf
            $p2health = $p2health - $damage1
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
            
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            if $p2shield = 1 Then
                Shield2()
                EndIf
            $p2health = $p2health - $damage1
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    EndIf
EndFunc


func attack2()
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do 
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            if $p1shield = 1 Then
                Shield1()
                EndIf
            $p1health = $p1health - $damage2
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            if $p1shield = 1 Then
                Shield1()
                EndIf
            $p1health = $p1health - $damage2
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    EndIf
EndFunc
            
func Shield1()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage2 = int($damage2 /2)
    msgbox(64, "shield", $player1name & "took half damage!") 
    EndIf
EndFunc

func Shield2()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage1 = int($damage1 /2)
    msgbox(64, "shield", $player2name & "took half damage!") 
    EndIf
EndFunc

;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")
$Items = msgbox(65,"Items","Use Shields?")
If $Items = 1 Then
    $p1shield = 1
    $p2shield = 1
Else
    $p1shield = 0
    $p2shield = 0
EndIf

;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")


;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))

;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf



    

;Health Printout
;msgbox(64,"Health",$player1name & "'s health is " & $p1health & ".")
;msgbox(64,"Health",$player2name & "'s health is " & $p2health & ".")

;Fight!!!!
while $p1health > 0 and $p2health > 0
    splashtexton("Health",$player1name & "'s health:" & $p1health & " " & $player2name & "'s health:" & $p2health,175,50,-1,100,1 + 2 + 4,-1,-1,-1)
    if $turn = "p1" Then
        
        attack1()
        $turn = "p2"
    Else
        
        attack2()
        $turn = "p1"
    EndIf
WEnd
splashoff()
;determine whos dead
if $p1health = 0 Then
    $p1status = "dead"
elseif $p2health = 0 Then
    $p2status = "dead"
EndIf

;Ending
if $p1status = "dead" Then
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else
;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
EndIf

I really like the way this one looks. Very nice.


"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Hey Guys, Use AutoIt tags to shorten the code please, this is a long thread. Example:

must use: [ autoit] dont put the space...and then [ /autoit]

Edited by Swift

Share this post


Link to post
Share on other sites

oh yah I forgot to fix that I realized the problem when I killed my brother and it said he had slain me. now trying to learn prospeed to make attack animations.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

here's the newest version, and yes I removed the little credit screen, cause when I run this 50-60+ times an hour it gets annoying fast. also thank you homer for the encouragement =D

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Jacob Pannell

 Script Function:
    Battle

#ce ----------------------------------------------------------------------------








#include-once

$player1name = "Player1"

$player2name = "Player2"

$player1roll = "go"

$player2roll = "go"

$p1rollstotal = 0

$p2rollstotal = 0

$damage1 = 0

$damage2 = 0

$p1health = 0

$p1stm = 0

$p1agi = 0

$p1str = 0

$p2health = 0

$p2starthealth = 0

$p1starthealth = 0

$p2stm = 0

$p2agi = 0

$p2str = 0

$p1status = "fine"

$p2status = "fine"

$shieldeffect = 0

$p1shield = 0

$p2shield = 0

$p1sword = 0

$p2sword = 0

$p1armour = 0

$p2armour = 0

$p1gauntlets = 0

$p2gauntlets = 0

$p1boots = 0

$p2boots = 0

$p1item = 0

$p2item = 0

$p1firesword = 0

$p2firesword = 0

$p1mp = 0

$p2mp = 0

$p1startmp = 0

$p2startmp = 0

$p1healthbar = 0

$p2healthbar = 0

$p1health2 = 0

$p2health2 = 0

$pturn = ""

$Itemdescriptions = "Shield: Absorbs 50% of damage 50% of the time." & @CR & @CR
$Itemdescriptions &= "Sword: Adds 10-60 damage to attacks." & @CR & @CR
$Itemdescriptions &= "Armour: Adds 5 Stamina to the wearer." & @CR & @CR
$Itemdescriptions &= "Gauntlets: Add 5 Strength to the wearer." & @CR & @CR
$Itemdescriptions &= "Boots: Add 5 Agility to the wearer."















;Includes
#include <GUIConstants.au3>

;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
            
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
            
        Else
            
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
            
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
            
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
        Else
            
            msgbox(64,$player1name & "'s Attack",$player1name & " missed " & $player2name & ".")
        EndIf
    EndIf
EndFunc


func attack2()
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do 
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
            
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
            msgbox(64,$player2name & "'s Attack",$player2name & " attacked " & $player1name & " for " & $damage2 & ".")
        Else
            
            msgbox(64,$player2name & "'s Attack",$player2name & " missed " & $player1name & ".")
        EndIf
    EndIf
EndFunc
            
func Shield1()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage2 = int($damage2 /2)
    msgbox(64, "Shield", $player1name &" " & "took half damage!") 
    EndIf
EndFunc

func Shield2()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage1 = int($damage1 /2)
    msgbox(64, "Shield", $player2name &" " &  "took half damage!") 
    EndIf
EndFunc

func Sword1()
$damage1 = $damage1 + Random(10,60,1)
EndFunc

func Sword2()
$damage2 = $damage2 + Random(10,60,1)
EndFunc

func Gauntlet1()
    $p1str = $p1str + 5
EndFunc 

func Gauntlet2()
    $p2str = $p2str + 5
EndFunc 

Func armour1()
    $p1stm = $p1stm + 5
EndFunc

Func armour2()
    $p2stm = $p2stm + 5
EndFunc

Func boots1()
    $p1agi = $p1agi + 5
EndFunc

Func boots2()
    $p2agi = $p2agi + 5
EndFunc

Func p2update()
    
    
    
    while $p2health2 <> $p2health
    GUICtrlSetData ( $health2txt, "HP:" & " " & $p2health2 )
    $p2health2 = $p2health2 - 1 
    $p2healthbar = 100 * ($p2health2 / $p2starthealth)
    GUICtrlSetData ( $P2BAR, $p2healthbar )
    WEnd
EndFunc

Func p1update()
    
    
    
    while $p1health2 <> $p1health
    GUICtrlSetData ( $health1txt, "HP:" & " " & $p1health2 )
    $p1health2 = $p1health2 - 1 
    $p1healthbar = 100 * ($p1health2 / $p1starthealth)
    GUICtrlSetData ( $P1BAR, $p1healthbar )
    WEnd
EndFunc

;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")

;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")

;Items




$Items = msgbox(68,"Items","Use Items?")

If $Items = 7 Then
    $p1shield = 0
    $p2shield = 0
    $p1sword = 0
    $p2sword = 0
    $p1armour = 0
    $p2armour = 0
    $p1gauntlets = 0
    $p2gauntlets = 0
    $p1boots = 0
    $p2boots = 0
    $p1item = 1
    $p2item = 1
Else
msgbox(64, "Items", $Itemdescriptions)
    $p1item = 0
    $p2item = 0
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Shield", $player1name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p1shield = 1
    $p1item = 1
    
EndIf

EndIf

If $p2item = 0 then

$Items = msgbox(68,"Shield", $player2name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p2shield = 1
    $p2item = 1
    
EndIf

EndIf

If $p1item = 0 then
    
$Items = msgbox(68,"Sword", $player1name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p1sword = 1
    $p1item = 1
    
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Sword", $player2name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p2sword = 1
    $p2item = 1
    
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Armour", $player1name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p1armour = 1
    $p1item = 1
    
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Armour", $player2name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p2armour = 1
    $p2item = 1
    
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Gauntlets", $player1name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p1gauntlets = 1
    $p1item = 1
    
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Gauntlets", $player2name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p2gauntlets = 1
    $p2item = 1
    
    EndIf
EndIf

If $p1item = 0 then
    
$Items = msgbox(68,"Boots", $player1name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p1boots = 1
    $p1item = 1
    
    EndIf
EndIf


If $p2item = 0 then
    
    
$Items = msgbox(68,"Boots", $player2name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p2boots = 1
    $p2item = 1
    
    EndIf

EndIf



;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

If $p1armour = 1 Then
    armour1()
    EndIf

If $p1gauntlets = 1 Then
    Gauntlet1()
    EndIf

IF $p1boots = 1 Then
    Boots1()
EndIf

msgbox(64,$player1name & "'s Stats with bonus", "Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str)
msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd
If $p2armour = 1 Then
    armour2()
    EndIf

If $p2gauntlets = 1 Then
    Gauntlet2()
    EndIf

IF $p2boots = 1 Then
    Boots2()
EndIf

msgbox(64,$player2name & "'s Stats with bonus", "Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str)


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))
$p1starthealth = $p1health
$p2starthealth = $p2health
;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    $pturn = $player1name
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    $pturn = $player2name
    
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf








$parent = GUICreate ("Fight!", 200, 100, 450, 50, $ws_popup)
Opt("GUIOnEventMode", 1)
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$attack = GUICtrlCreateButton ("Attack", 50, 25, 100, 50)
$a = GUICtrlCreateLabel ( $pturn & " choose your action", 50, 5 )
GUICtrlSetBkColor ( $a, $GUI_BKCOLOR_TRANSPARENT )
GUISetState (@SW_SHOW)
GUICtrlSetOnEvent($attack, "attack")

GUICreate ( $player1name , 200, 120 , 100 , 50 , $WS_POPUP, -1, $parent ) 
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$P1BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P1MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p1n = GUICtrlCreateLabel ( $player1name, 100, 5 )
$health1txt = GUICtrlCreateLabel ( "HP:" & " " & $p1health, 5, 20 )
$mana1txt = GUICtrlCreateLabel ( "MP:" & " " & $p1mp, 5, 65 )
GUICtrlSetBkColor ( $health1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p1n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P1BAR, 100)
GUICtrlSetColor ( $P1BAR, 0xff0000)
GUICtrlSetColor ( $P1MBAR, 0x0000ff)

GUISetState (@SW_SHOW)

GUICreate ( $player2name , 200, 120 , 800 , 50 , $WS_POPUP, -1, $parent ) 
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)

$P2BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P2MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p2n = GUICtrlCreateLabel ( $player2name, 100, 5 )
$health2txt = GUICtrlCreateLabel ( "HP:" & " " & $p2health, 5, 20 )
$mana2txt = GUICtrlCreateLabel ( "MP:" & " " & $p2mp, 5, 65 )
GUICtrlSetBkColor ( $health2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p2n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P2BAR, 100)
GUICtrlSetColor ( $P2BAR, 0xff0000)
GUICtrlSetColor ( $P2MBAR, 0x0000ff)

GUISetState (@SW_SHOW)


While(1)
    sleep(100)
WEnd







    


Func Attack()

;Fight!!!!

    if $turn = "p1" Then
        
        attack1()
        $turn = "p2"
        $pturn = $player2name
        GUICtrlSetData($a, $pturn & " choose your action")
    Else
        
        attack2()
        $turn = "p1"
        $pturn = $player1name
        GUICtrlSetData($a, $pturn & " choose your action")
    EndIf



;Ending
if $p1health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else 
    if $p2health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
    EndIf
EndIf
EndFunc
Edited by Darth

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

i did a little edit so that most of the info would scroll up in an edit box, so u dont have u constantly exit the message boxes

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.10.0
 Author:         Jacob Pannell

 Script Function:
    Battle

#ce ----------------------------------------------------------------------------








#include-once

$player1name = "Player1"

$player2name = "Player2"

$player1roll = "go"

$player2roll = "go"

$p1rollstotal = 0

$p2rollstotal = 0

$damage1 = 0

$damage2 = 0

$p1health = 0

$p1stm = 0

$p1agi = 0

$p1str = 0

$p2health = 0

$p2starthealth = 0

$p1starthealth = 0

$p2stm = 0

$p2agi = 0

$p2str = 0

$p1status = "fine"

$p2status = "fine"

$shieldeffect = 0

$p1shield = 0

$p2shield = 0

$p1sword = 0

$p2sword = 0

$p1armour = 0

$p2armour = 0

$p1gauntlets = 0

$p2gauntlets = 0

$p1boots = 0

$p2boots = 0

$p1item = 0

$p2item = 0

$p1firesword = 0

$p2firesword = 0

$p1mp = 0

$p2mp = 0

$p1startmp = 0

$p2startmp = 0

$p1healthbar = 0

$p2healthbar = 0

$p1health2 = 0

$p2health2 = 0

$pturn = ""

$Itemdescriptions = "Shield: Absorbs 50% of damage 50% of the time." & @CR & @CR
$Itemdescriptions &= "Sword: Adds 10-60 damage to attacks." & @CR & @CR
$Itemdescriptions &= "Armour: Adds 5 Stamina to the wearer." & @CR & @CR
$Itemdescriptions &= "Gauntlets: Add 5 Strength to the wearer." & @CR & @CR
$Itemdescriptions &= "Boots: Add 5 Agility to the wearer."















;Includes
#include <GUIConstants.au3>

;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
           
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
            msgbox(64,$player1name & "'s Attack",$player1name & " attacked " & $player2name & " for " & $damage1 & ".")
           GUICtrlSetData($edit, $player1name & " attacked " & $player2name & " for " & $damage1 & "." & @CRLF & GUICtrlRead($edit))

            $time = Random(200, 1000)
            sleep($time)
        Else
           
          GUICtrlSetData($edit, $player1name & " missed " & $player2name & "." & @CRLF& GUICtrlRead($edit))
$time = Random(200, 1000)
            sleep($time)
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
           
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
           
           GUICtrlSetData($edit,$player1name & " attacked " & $player2name & " for " & $damage1 & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        Else
           
                GUICtrlSetData($edit,$player1name & " missed " & $player2name & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    EndIf
EndFunc


func attack2()
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
           
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
            GUICtrlSetData($edit, $player2name & " attacked " & $player1name & " for " & $damage2 & "." & @CRLF & GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        Else
           
            GUICtrlSetData($edit, $player2name & " missed " & $player1name & "." & @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
          GUICtrlSetData($edit,$player2name & " attacked " & $player1name & " for " & $damage2 & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
            Else
           
           GUICtrlSetData($edit,$player2name & " missed " & $player1name & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    EndIf
EndFunc
           
func Shield1()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage2 = int($damage2 /2)
    msgbox(64, "Shield", $player1name &" " & "took half damage!")
    EndIf
EndFunc

func Shield2()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage1 = int($damage1 /2)
    msgbox(64, "Shield", $player2name &" " &  "took half damage!")
    EndIf
EndFunc

func Sword1()
$damage1 = $damage1 + Random(10,60,1)
EndFunc

func Sword2()
$damage2 = $damage2 + Random(10,60,1)
EndFunc

func Gauntlet1()
    $p1str = $p1str + 5
EndFunc 

func Gauntlet2()
    $p2str = $p2str + 5
EndFunc 

Func armour1()
    $p1stm = $p1stm + 5
EndFunc

Func armour2()
    $p2stm = $p2stm + 5
EndFunc

Func boots1()
    $p1agi = $p1agi + 5
EndFunc

Func boots2()
    $p2agi = $p2agi + 5
EndFunc

Func p2update()
   
   
   
    while $p2health2 <> $p2health
    GUICtrlSetData ( $health2txt, "HP:" & " " & $p2health2 )
    $p2health2 = $p2health2 - 1 
    $p2healthbar = 100 * ($p2health2 / $p2starthealth)
    GUICtrlSetData ( $P2BAR, $p2healthbar )
    WEnd
EndFunc

Func p1update()
   
   
   
    while $p1health2 <> $p1health
    GUICtrlSetData ( $health1txt, "HP:" & " " & $p1health2 )
    $p1health2 = $p1health2 - 1 
    $p1healthbar = 100 * ($p1health2 / $p1starthealth)
    GUICtrlSetData ( $P1BAR, $p1healthbar )
    WEnd
EndFunc

;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")

;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")
Dim $GOOEY = GUICreate("Battle",300,200)
Dim $edit = GUICtrlCreateEdit("",10,10,280,180)
GUISetState()
;Items




$Items = msgbox(68,"Items","Use Items?")

If $Items = 7 Then
    $p1shield = 0
    $p2shield = 0
    $p1sword = 0
    $p2sword = 0
    $p1armour = 0
    $p2armour = 0
    $p1gauntlets = 0
    $p2gauntlets = 0
    $p1boots = 0
    $p2boots = 0
    $p1item = 1
    $p2item = 1
Else
msgbox(64, "Items", $Itemdescriptions)
    $p1item = 0
    $p2item = 0
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Shield", $player1name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p1shield = 1
    $p1item = 1
   
EndIf

EndIf

If $p2item = 0 then

$Items = msgbox(68,"Shield", $player2name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p2shield = 1
    $p2item = 1
   
EndIf

EndIf

If $p1item = 0 then
   
$Items = msgbox(68,"Sword", $player1name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p1sword = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Sword", $player2name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p2sword = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Armour", $player1name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p1armour = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Armour", $player2name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p2armour = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Gauntlets", $player1name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p1gauntlets = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Gauntlets", $player2name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p2gauntlets = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then
   
$Items = msgbox(68,"Boots", $player1name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p1boots = 1
    $p1item = 1
   
    EndIf
EndIf


If $p2item = 0 then
   
   
$Items = msgbox(68,"Boots", $player2name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p2boots = 1
    $p2item = 1
   
    EndIf

EndIf



;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

If $p1armour = 1 Then
    armour1()
    EndIf

If $p1gauntlets = 1 Then
    Gauntlet1()
    EndIf

IF $p1boots = 1 Then
    Boots1()
EndIf

msgbox(64,$player1name & "'s Stats with bonus", "Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str)
msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd
If $p2armour = 1 Then
    armour2()
    EndIf

If $p2gauntlets = 1 Then
    Gauntlet2()
    EndIf

IF $p2boots = 1 Then
    Boots2()
EndIf

msgbox(64,$player2name & "'s Stats with bonus", "Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str)


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))
$p1starthealth = $p1health
$p2starthealth = $p2health
;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    $pturn = $player1name
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    $pturn = $player2name
   
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf








$parent = GUICreate ("Fight!", 200, 100, 450, 50, $ws_popup)
Opt("GUIOnEventMode", 1)
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$attack = GUICtrlCreateButton ("Attack", 50, 25, 100, 50)
$a = GUICtrlCreateLabel ( $pturn & " choose your action", 50, 5 )
GUICtrlSetBkColor ( $a, $GUI_BKCOLOR_TRANSPARENT )
GUISetState (@SW_SHOW)
GUICtrlSetOnEvent($attack, "attack")

GUICreate ( $player1name , 200, 120 , 100 , 50 , $WS_POPUP, -1, $parent )
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$P1BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P1MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p1n = GUICtrlCreateLabel ( $player1name, 100, 5 )
$health1txt = GUICtrlCreateLabel ( "HP:" & " " & $p1health, 5, 20 )
$mana1txt = GUICtrlCreateLabel ( "MP:" & " " & $p1mp, 5, 65 )
GUICtrlSetBkColor ( $health1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p1n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P1BAR, 100)
GUICtrlSetColor ( $P1BAR, 0xff0000)
GUICtrlSetColor ( $P1MBAR, 0x0000ff)

GUISetState (@SW_SHOW)

GUICreate ( $player2name , 200, 120 , 800 , 50 , $WS_POPUP, -1, $parent )
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)

$P2BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P2MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p2n = GUICtrlCreateLabel ( $player2name, 100, 5 )
$health2txt = GUICtrlCreateLabel ( "HP:" & " " & $p2health, 5, 20 )
$mana2txt = GUICtrlCreateLabel ( "MP:" & " " & $p2mp, 5, 65 )
GUICtrlSetBkColor ( $health2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p2n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P2BAR, 100)
GUICtrlSetColor ( $P2BAR, 0xff0000)
GUICtrlSetColor ( $P2MBAR, 0x0000ff)

GUISetState (@SW_SHOW)


While(1)
    sleep(100)
WEnd







   


Func Attack()

;Fight!!!!

    if $turn = "p1" Then
       
        attack1()
        $turn = "p2"
        $pturn = $player2name
        GUICtrlSetData($a, $pturn & " choose your action")
    Else
       
        attack2()
        $turn = "p1"
        $pturn = $player1name
        GUICtrlSetData($a, $pturn & " choose your action")
    EndIf



;Ending
if $p1health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else
    if $p2health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
    EndIf
EndIf
EndFunc

this would be great with animations and network support for online play.

might even be able to use direct 3d or open gl plugins, think the first online 3d game in autoit.

Edited by emoyasha

Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

working on 2D animations online play is gonna be hard as hell though

Share this post


Link to post
Share on other sites

no.. not really make it client to client.

clients connect, then send attack data back and foruth, same system, just make it send the attacks over a netowk.

so like player 1 has an attack button and so dose player 2. bu tonly for theirselves.


Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

Nice script,

why not use sprite animation? Recently mario script

make me scream about Autoit potential. And why not take your PC configuration,

to randomize stat of your autoit alter-ego? a sort of tamagotchi with your battle system feature ?

i dream? :D

Share this post


Link to post
Share on other sites

i did a little edit so that most of the info would scroll up in an edit box, so u dont have u constantly exit the message boxes

CODE WOULD GO HERE

this would be great with animations and network support for online play.

might even be able to use direct 3d or open gl plugins, think the first online 3d game in autoit.

I really like this addition. You should also modify the shield functions to do the same, as they still allow a message box to a pop up.

I really like this work that all of you have done. To think that just a simple idea I had is turning into something pretty cool. :D


"A man who has never gone to school may steal from a freight car; but if he has a university education, he may steal the whole railroad." - Theodore Roosevelt

Share this post


Link to post
Share on other sites

well :) i did that and added a kind of spell support. here is the new code, it may be a little buggy but of course i did it in a half hour lol

#include-once

$player1name = "Player1"

$player2name = "Player2"

$player1roll = "go"

$player2roll = "go"

$p1rollstotal = 0

$p2rollstotal = 0

$damage1 = 0

$damage2 = 0

$p1health = 0

$p1stm = 0

$p1agi = 0

$p1str = 0

$p2health = 0

$p2starthealth = 0

$p1starthealth = 0

$p2stm = 0

$p2agi = 0

$p2str = 0

$p1status = "fine"

$p2status = "fine"

$shieldeffect = 0

$p1shield = 0

$p2shield = 0

$p1sword = 0

$p2sword = 0

$p1armour = 0

$p2armour = 0

$p1gauntlets = 0

$p2gauntlets = 0

$p1boots = 0

$p2boots = 0

$p1item = 0

$p2item = 0

$p1firesword = 0

$p2firesword = 0

$p1mp = 100 

$p2mp = 100

$p1startmp = 100

$p1mana = 100

$p1mana = 100

$p2startmp = 100

$p1healthbar = 0

$p2healthbar = 0

$p1health2 = 0

$p2health2 = 0

$pturn = ""

$Itemdescriptions = "Shield: Absorbs 50% of damage 50% of the time." & @CR & @CR
$Itemdescriptions &= "Sword: Adds 10-60 damage to attacks." & @CR & @CR
$Itemdescriptions &= "Armour: Adds 5 Stamina to the wearer." & @CR & @CR
$Itemdescriptions &= "Gauntlets: Add 5 Strength to the wearer." & @CR & @CR
$Itemdescriptions &= "Boots: Add 5 Agility to the wearer."















;Includes
#include <GUIConstants.au3>

;----fucntions
func roll1()
    SplashTextOn($player1name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p1stm = int(random(1,10))
        $p1agi = int(random(1,10))
        $p1str = int(random(1,10))
        $player1statstotal = $p1stm + $p1agi + $p1str
    Until $player1statstotal = 14
    sleep(1000)
    splashoff()
EndFunc




func roll2()
    SplashTextOn($player2name & "'s Stats","Rolling....", 100, 50, -1, 100, 1)
    do
        $p2stm = int(random(1,10))
        $p2agi = int(random(1,10))
        $p2str = int(random(1,10))
        $player2statstotal = $p2stm + $p2agi + $p2str
    Until $player2statstotal = 14
    sleep(1000)
    splashoff()
EndFunc

func attack1()
    $spellawns = InputBox("spell", "would you like to use a spell?")
    If $spellawns = "yes" Then
           $spell = InputBox("Spell", "please input a spell")
   $damage1 = StringLen ($spell) * 7.5
   if StringIsAlNum($spell) Then
       Switch $spell
    Case StringIsUpper ( $spell )
$spell = $Spell + 80
if $spell = "FINGEROFDEATH1" Then
    $damage1 = 9999
Else
    EndIf
    
        
    case StringIsLower ( $spell )
        $damage1 = StringLen ($spell) * 8.5
    Case Else
        MsgBox(64, "invalad spell try again")
EndSwitch
Else
       $damage1 = StringLen ($spell) * 4.5
       
       
   endif 
   
   $p1manaloss = $damage1 / 7
   $p1mana = $p1mana - $p1manaloss
     $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
             GUICtrlSetData($edit, $player1name & " attacked " & $player2name & " with a spell for " & $damage1 & "." & @CRLF & GUICtrlRead($edit))
p1updatemana()
  GUICtrlSetData($edit, $player1name & "Lost "& $p1manaloss& " Mana Points." & @CRLF & GUICtrlRead($edit))

    Else
    EndIf
    
    
    if $p1agi > $p2agi Then
        $hitchance1 = int(random(6,10))
        if $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 = 9 or $hitchance1 = 10 Then
            $damage1 = ($p1str * 10) + int(random(5,26))
            if $damage1 < (.05 * $p2health) Then
                do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
           
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
            
           GUICtrlSetData($edit, $player1name & " attacked " & $player2name & " for " & $damage1 & "." & @CRLF & GUICtrlRead($edit))

            $time = Random(200, 1000)
            sleep($time)
        Else
           
          GUICtrlSetData($edit, $player1name & " missed " & $player2name & "." & @CRLF& GUICtrlRead($edit))
$time = Random(200, 1000)
            sleep($time)
        EndIf
    Elseif $p1agi < $p2agi or $p1agi = $p2agi then
        $hitchance1 = int(random(1,10))
        if $hitchance1 = 2 or $hitchance1 = 4 or $hitchance1 = 6 or $hitchance1 = 8 or $hitchance1 or 10 then
            $damage1 = ($p1str * 10) + int(random(2,13))
            if $damage1 < (.05 * $p2health) Then
                Do
                    $damage1 = $damage1 + int(random(1,5) + ($p1str * .02))
                until $damage1 >= (.05 * $p2health)
            EndIf
            If $p1sword = 1 Then
                Sword1()
            EndIf
            if $p2shield = 1 Then
                Shield2()
            EndIf
           
            $p2health2 = $p2health
            $p2health = $p2health - $damage1
            p2update()
           
           GUICtrlSetData($edit,$player1name & " attacked " & $player2name & " for " & $damage1 & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        Else
           
                GUICtrlSetData($edit,$player1name & " missed " & $player2name & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    EndIf
EndFunc


func attack2()
    
        $spellawns = InputBox("spell", "would you like to use a spell?")
    If $spellawns = "yes" Then
           $spell = InputBox("Spell", "please input a spell")
   $damage2 = StringLen ($spell) * 7.5
   if StringIsAlNum($spell) Then
       Switch $spell
    Case StringIsUpper ( $spell )
$spell = $Spell + 80
if $spell = "FINGEROFDEATH1" Then
    $damage2 = 9999
Else
    EndIf
    
        
    case StringIsLower ( $spell )
        $damage2 = StringLen ($spell) * 8.5
    Case Else
        MsgBox(64, "invalad spell try again")
EndSwitch
Else
       $damage2 = StringLen ($spell) * 7.5
       
       
   endif 
   
   $p2manaloss = $damage2 / 7
   $p2mana = $p2mana - $p2manaloss
     $p1health1 = $p1health
            $p1health = $p1health - $damage1
            p2update()
             GUICtrlSetData($edit, $player2name & " attacked " & $player1name & " with a spell for " & $damage2 & "." & @CRLF & GUICtrlRead($edit))
p1updatemana()
  GUICtrlSetData($edit, $player2name & "Lost "& $p2manaloss& " Mana Points." & @CRLF & GUICtrlRead($edit))

    Else
    EndIf
    if $p2agi > $p1agi Then
        $hitchance2 = int(random(6,10))
        if $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 = 9 or $hitchance2 = 10 Then
            $damage2 = ($p2str * 10) + int(random(5,26))
            if $damage2 < (.05 * $p1health) Then
                do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
           
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
            GUICtrlSetData($edit, $player2name & " attacked " & $player1name & " for " & $damage2 & "." & @CRLF & GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        Else
           
            GUICtrlSetData($edit, $player2name & " missed " & $player1name & "." & @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    Elseif $p2agi < $p1agi or $p2agi = $p1agi then
        $hitchance2 = int(random(1,10))
        if $hitchance2 = 2 or $hitchance2 = 4 or $hitchance2 = 6 or $hitchance2 = 8 or $hitchance2 or 10 then
            $damage2 = ($p2str * 10) + int(random(2,13))
                if $damage2 < (.05 * $p1health) Then
                Do
                    $damage2 = $damage2 + int(random(1,5) + ($p2str * .02))
                until $damage2 >= (.05 * $p1health)
            EndIf
            If $p2sword = 1 Then
                Sword2()
            EndIf
            if $p1shield = 1 Then
                Shield1()
            EndIf
            $p1health2 = $p1health
            $p1health = $p1health - $damage2
            p1update()
          GUICtrlSetData($edit,$player2name & " attacked " & $player1name & " for " & $damage2 & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
            Else
           
           GUICtrlSetData($edit,$player2name & " missed " & $player1name & "."& @CRLF& GUICtrlRead($edit))
            $time = Random(200, 1000)
            sleep($time)
        EndIf
    EndIf
EndFunc
           
func Shield1()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage2 = int($damage2 /2)
    GUICtrlSetData($edit,$player1name &" " & "took half damage!."& @CRLF& GUICtrlRead($edit))
   
    EndIf
EndFunc

func Shield2()
    $shieldeffect = Random(1,2,1)
    if $shieldeffect = 2 then
    $damage1 = int($damage1 /2)
    GUICtrlSetData($edit,$player2name &" " &  "took half damage!."& @CRLF& GUICtrlRead($edit))
   
    EndIf
EndFunc

func Sword1()
$damage1 = $damage1 + Random(10,60,1)
EndFunc

func Sword2()
$damage2 = $damage2 + Random(10,60,1)
EndFunc

func Gauntlet1()
    $p1str = $p1str + 5
EndFunc

func Gauntlet2()
    $p2str = $p2str + 5
EndFunc

Func armour1()
    $p1stm = $p1stm + 5
EndFunc

Func armour2()
    $p2stm = $p2stm + 5
EndFunc

Func boots1()
    $p1agi = $p1agi + 5
EndFunc

Func boots2()
    $p2agi = $p2agi + 5
EndFunc

Func p2update()
   
   
   
    while $p2health2 <> $p2health
    GUICtrlSetData ( $health2txt, "HP:" & " " & $p2health2 )
    $p2health2 = $p2health2 - 1
    $p2healthbar = 100 * ($p2health2 / $p2starthealth)
    GUICtrlSetData ( $P2BAR, $p2healthbar )
    
    WEnd
EndFunc

Func p2updatemana()
   
   
GUICtrlSetData ( $mana1txt, "MP:" & " " & $p1mana )
    GUICtrlSetData ( $P2MBAR, $p2mana )
    if $p2mana < 1 Then
        msgbox(64, "Game Over", $player2name & " has died due to loss of all mp " &$player1name& " has won")
    Exit
    Else
        attack1()
        endif 
         
        
    
   
EndFunc

Func p1update()
   
   
   
    while $p1health2 <> $p1health
    GUICtrlSetData ( $mana1txt, "MP:" & " " & $p1health2 )
    $p1health2 = $p1health2 - 1
    $p1healthbar = 100 * ($p1health2 / $p1starthealth)
    GUICtrlSetData ( $P1BAR, $p1healthbar )
    WEnd
EndFunc

Func p1updatemana()
   
   
   
    GUICtrlSetData ( $mana1txt, "MP:" & " " & $p1mana )
    GUICtrlSetData ( $P1MBAR, $p1mana )
    if $p1mana < 1 Then
        msgbox(64, "Game Over", $player1name & " has died due to loss of all mp " &$player2name& " has won")
        Exit
    Else
        attack2()
        endif 
EndFunc



   


;START PROGRAM!!!______________________________________________________________________________________
msgbox(64,"Welcome","Welcome to battle!")

;Names
$player1name = inputbox("Name?","What is the first character's name?","Player1")
msgbox(64,"Thank You","Thank you " & $player1name & ".")
$player2name = inputbox("And you?","And the second players name is?","Player2")
msgbox(64,"Thanks","Thanks " & $player2name & ".")
Dim $GOOEY = GUICreate("Battle",300,200)
Dim $edit = GUICtrlCreateEdit("",10,10,280,180)
GUISetState()
;Items




$Items = msgbox(68,"Items","Use Items?")

If $Items = 7 Then
    $p1shield = 0
    $p2shield = 0
    $p1sword = 0
    $p2sword = 0
    $p1armour = 0
    $p2armour = 0
    $p1gauntlets = 0
    $p2gauntlets = 0
    $p1boots = 0
    $p2boots = 0
    $p1item = 1
    $p2item = 1
Else
msgbox(64, "Items", $Itemdescriptions)
    $p1item = 0
    $p2item = 0
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Shield", $player1name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p1shield = 1
    $p1item = 1
   
EndIf

EndIf

If $p2item = 0 then

$Items = msgbox(68,"Shield", $player2name & " " & "would you like to use a Shield?")

If $Items = 6 Then
    $p2shield = 1
    $p2item = 1
   
EndIf

EndIf

If $p1item = 0 then
   
$Items = msgbox(68,"Sword", $player1name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p1sword = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Sword", $player2name & " " & "would you like to use a Sword?")

If $Items = 6 Then
    $p2sword = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Armour", $player1name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p1armour = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Armour", $player2name & " " & "would you like to use Armour?")

If $Items = 6 Then
    $p2armour = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then

$Items = msgbox(68,"Gauntlets", $player1name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p1gauntlets = 1
    $p1item = 1
   
    EndIf
EndIf

If $p2item = 0 then

$Items = msgbox(68,"Gauntlets", $player2name & " " & "would you like to use Gauntlets?")

If $Items = 6 Then
    $p2gauntlets = 1
    $p2item = 1
   
    EndIf
EndIf

If $p1item = 0 then
   
$Items = msgbox(68,"Boots", $player1name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p1boots = 1
    $p1item = 1
   
    EndIf
EndIf


If $p2item = 0 then
   
   
$Items = msgbox(68,"Boots", $player2name & " " & "would you like to use Boots?")

If $Items = 6 Then
    $p2boots = 1
    $p2item = 1
   
    EndIf

EndIf



;Stats
msgbox(64,"Stats","We will now determine stats.")



;player1
while $player1roll = "go"
    roll1()
    $yesorno = msgbox(4,$player1name & "'s Stats","Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str & ".Good?")
    if $yesorno = 6 Then
        ExitLoop
    ElseIf $yesorno = 7 Then
        $p1rollstotal = $p1rollstotal + 1
        if $p1rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd

If $p1armour = 1 Then
    armour1()
    EndIf

If $p1gauntlets = 1 Then
    Gauntlet1()
    EndIf

IF $p1boots = 1 Then
    Boots1()
EndIf

msgbox(64,$player1name & "'s Stats with bonus", "Stamina is " & $p1stm & ". Agility is " & $p1agi & ". Strength is " & $p1str)
msgbox(64,"Player2","Now time for player two. Press 'ok' to roll for your stats!")



;player2
while $player2roll = "go"
    roll2()
    $yesorno2 = msgbox(4,$player2name & "'s Stats","Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str & ".Good?")
    if $yesorno2 = 6 Then
        ExitLoop
    ElseIf $yesorno2 = 7 Then
        $p2rollstotal = $p2rollstotal + 1
        if $p2rollstotal = 3 Then
            msgbox(64,"Sorry","You can only roll 3 times.")
            ExitLoop
        EndIf
    EndIf
WEnd
If $p2armour = 1 Then
    armour2()
    EndIf

If $p2gauntlets = 1 Then
    Gauntlet2()
    EndIf

IF $p2boots = 1 Then
    Boots2()
EndIf

msgbox(64,$player2name & "'s Stats with bonus", "Stamina is " & $p2stm & ". Agility is " & $p2agi & ". Strength is " & $p2str)


;Health
$p1health = 500 + ($p1stm * 10) + int(random(50,200))
$p2health = 500 + ($p2stm * 10) + int(random(50,200))
$p1starthealth = $p1health
$p2starthealth = $p2health
;Start!!!
msgbox(64,"Who goes first","Now we roll to see who goes first.")
msgbox(64,$player1name & "'s roll","Press OK to roll, " & $player1name & ".")
$p1roll = int(random(1,10))
msgbox(64,$player2name & "'s roll","Press OK to roll, " & $player2name & ".")
$p2roll = int(random(1,10))


msgbox(64,"Rolls","Player 1 rolled a " & $p1roll & ". Player 2 rolled a " & $p2roll & ".")

if $p1roll > $p2roll then
    $turn = "p1"
    $pturn = $player1name
    msgbox(64,"Going first..",$player1name & " will go first.")
Else
    $turn = "p2"
    $pturn = $player2name
   
    msgbox(64,"Going first..",$player2name & " will go first.")
EndIf








$parent = GUICreate ("Fight!", 200, 100, 450, 50, $ws_popup)
Opt("GUIOnEventMode", 1)
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$attack = GUICtrlCreateButton ("Attack", 50, 25, 100, 50)
$a = GUICtrlCreateLabel ( $pturn & " choose your action", 50, 5 )
GUICtrlSetBkColor ( $a, $GUI_BKCOLOR_TRANSPARENT )
GUISetState (@SW_SHOW)
GUICtrlSetOnEvent($attack, "attack")

GUICreate ( $player1name , 200, 120 , 100 , 50 , $WS_POPUP, -1, $parent )
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$P1BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P1MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p1n = GUICtrlCreateLabel ( $player1name, 100, 5 )
$health1txt = GUICtrlCreateLabel ( "HP:" & " " & $p1health, 5, 20 )
$mana1txt = GUICtrlCreateLabel ( "MP:" & " " & $p1mp, 5, 65 )
GUICtrlSetBkColor ( $health1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana1txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p1n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P1BAR, 100)
GUICtrlSetColor ( $P1BAR, 0xff0000)
GUICtrlSetColor ( $P1MBAR, 0x0000ff)

GUISetState (@SW_SHOW)

GUICreate ( $player2name , 200, 120 , 800 , 50 , $WS_POPUP, -1, $parent )
GUICtrlCreatePic (@ScriptDir & "\BG.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)

$P2BAR = GUICtrlCreateProgress ( -1, 35 , 200 , 25 , $PBS_SMOOTH)
$P2MBAR = GUICtrlCreateProgress ( -1, 80 , 200 , 25 , $PBS_SMOOTH)
$p2n = GUICtrlCreateLabel ( $player2name, 100, 5 )
$health2txt = GUICtrlCreateLabel ( "HP:" & " " & $p2health, 5, 20 )
$mana2txt = GUICtrlCreateLabel ( "MP:" & " " & $p2mp, 5, 65 )
GUICtrlSetBkColor ( $health2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $mana2txt, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $p2n, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetData ( $P2BAR, 100)
GUICtrlSetColor ( $P2BAR, 0xff0000)
GUICtrlSetColor ( $P2MBAR, 0x0000ff)
    GUICtrlSetData ( $P1MBAR,$p1mp)
    GUICtrlSetData ( $P2MBAR,$p2mp)
GUISetState (@SW_SHOW)


While(1)
    sleep(100)
WEnd







   


Func Attack()

;Fight!!!!

    if $turn = "p1" Then
       
        attack1()
        $turn = "p2"
        $pturn = $player2name
        GUICtrlSetData($a, $pturn & " choose your action")
    Else
       
        attack2()
        $turn = "p1"
        $pturn = $player1name
        GUICtrlSetData($a, $pturn & " choose your action")
    EndIf



;Ending
if $p1health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player2name & " has slain " & $player1name & "!!!!!")
    Exit
Else
    if $p2health <= 0 Then
    ;splashimageon("GAME OVER!!","C:\Documents and Settings\UIL\Desktop\game.jpg")
    sleep(1000)
    splashoff()
    msgbox(64,"WINNER!!",$player1name & " has slain " & $player2name & "!!!!!")
    Exit
    EndIf
EndIf
EndFunc

Admin Of:http://notmyspace.info [Under Development, looking for volunteers to help improve]http://PSNetCards.co.ukhttp://ZacnAndLindsey.com [Under development, not quite sure what to do with it yet]http://revelm.com------------------------------------Radio Streams:http://75.185.53.88:8000 [128kb/s 44kHz]http://75.185.53.88:8002 [22kb/s 22kHz](works on mobile phones)-----------------------------------My Server:Owned By: http://jumpline.comIP:66.84.19.220Bandwidth:200GBStorage Space:1TBNetwork Connection: 1GB/S[up and down]Operating System: Red Hat LinuxInstalled Apps:Webmail, phpBB, Majordomo, phpMyAdmin, MySQL, Active Server Pages, FrontPage Extensions 2002, GraphicsMagick, Mod Perl, Perl, PHP: Hypertext Preprocessor, Python(want cheap good webhosting, or need a place to park your domain? contact me)-----------------------------------

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0