mIRC Home    About    Download    Register    News    Help

Print Thread
#251903 08/03/15 11:26 AM
Joined: Feb 2015
Posts: 16
U
Pikka bird
OP Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
Hello

I've been looking around for a duel script that will work as I want it. I already have in place a point system.

*user1 types !duel <user2>
*user2 can - deny using a command like !no or, to condense scripts, !duel denied, which ends the duel with a message to the channel eg. <user2> was not brave enough to accept <user1>'s challenge!
- accept using something like !no or !duel accepted (again, to shorten the script). On this branch, both users are given a certain hp (leg. 100) and there will be a turn-based duel, with <user1> being first to hit for a random number (damage) which is substracted from <user2>'s hp, then <user2> hits and so on. When one of them has hp bellow 0, the duel ends and
1. winner is awarded a number of points that are added to his total points
2. loser has taken away the number of points the winner was given

There's already a point system in place, so the point file is created and filled with names+points.
The !duel could use a certain flood control, but not that important.

This will seem relatively simple to the more experienced users here, but my mIRC coding knowledge is limited, my time is even more limited (work and stream can really take huge chunks of time), and the scripts I found around are not that good, or applicable to my needs. I will credit whoever can code this, or help me code this (I'll credit you and your twitch/irc/whatever else links you desire).

Thank you for your time!

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
If you're inexperienced, you should write it yourself since it will be a good exercise. I doubt anyone with experience will write it for you, since it's kinda trivial/boring :p

You can write it within a single on *:TEXT:*:#: { }
and just use a lot of IF statements

Use dynamic variables to check if a duel is going on, whose turn it is to attack, and so on. For example: %duel. [ $+ [ $nick ] ]

Other than that you'll need
$readini /writeini $rand

Joined: Apr 2014
Posts: 24
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Apr 2014
Posts: 24
Check out this script, it's kind of spammy so you might need to add flood control. It's pretty fun to play. I don't know how you would integrate your point system though.
http://hawkee.com/snippet/8020/

Joined: Feb 2015
Posts: 243
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 243
hi.. i don't want to spam my work but my bot has a game simular to what you seek.. scripted by me. I like to call it GunFight.
One player starts the game, picks opponent, if the opponent accepts the bot counts randomly to 3. the 1st player to shoot wins. Just saying.. in case you wanna try it.. You wouldn't be able to use your points system though.. except if you mess around with it. But it already has one. My Site Is On The Signature Below

Joined: Feb 2015
Posts: 16
U
Pikka bird
OP Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
I'll take a look at both and try to make a script. Once done, if working, I'll post it here for future references (I'm sure others would like one).

Joined: Feb 2015
Posts: 16
U
Pikka bird
OP Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
OK, so picked up thedelirious1's script (easier for my level of understanding) and did this

Click to reveal..
Code:
;*****************************************************
;Chat Fighter created by MajiShine
;*****************************************************

;*****************************************************
;Alias Area
;*****************************************************
alias cfover {
unset %chatf | unset %P1 | unset %P2 | unset %turn | unset %P1HP | unset %P2HP | unset %Magnum | unset %Shotgun | unset %Carbine | unset %Blaster | unset %Gatling | unset %Avenger | unset %counter | unset %super | unset %superfail |  unset %super win }
alias setMagnum { unset %kadouken | set %Magnum $rand(10,40) }
alias setShotgun { unset %Shotgun | set %Shotgun $rand(10,40) }
alias setCarbine { unset %Carbine | set %Carbine $rand(10,40) }
alias setBlaster { unset %Blaster | set %Blaster $rand(10,40) }
alias setGatling { unset %Gatling | set %Gatling $rand(10,40) }
alias setAvenger { unset %Avenger | set %Avenger $rand(10,40) }
alias setcounter.chance { unset %counter.chance | set %counter.chance $rand(1,4) }

;*****************************************************
;GAME
;*****************************************************
on *:TEXT:!duel*:#: {
  if (%on.off == $null) { .timer 1 1 .msg $chan Dueling is currently turned off. Please ask undead to turn it on. }

  elseif (%on.off == on) {
    if ($2 == $null) { .msg $chan $nick you must specify someone to fight (EX. !duel enigmafig) | halt }
    if ($nick == $2) { .msg $chan $nick you cannot challenge yourself to fight. | halt }
    if ($2 !ison $chan) { .msg $chan $2 is not online. | halt }
    if (%f) { .msg $chan $nick there is still %f seconds until another duel can begin. | halt }
    elseif (!%f) {
      set %P1 $nick
      set %turn $nick
      set %P2 $2
      splay D:\Stream material\Sounds\DuelCroods.mp3
      .timer 1 1 describe $chan $nick has challenged $2 to a duel! $2 type !accept to fight!
      timerchatfight 1 60 .msg $chan $2 chickened out of the fight and run to the hills all covered in shame.
      timerchatfight2 1 60 cfover
    }
  }
}

on *:TEXT:!accept*:#: {
  if ( %P2 == $nick ) {
    if (!%f) {
      set -z %f 300
      set %chatf on
      set %P1HP 100
      set %P2HP 100
      set %Magnum $rand(10,40)
      set %Shotgun $rand(10,40)
      set %Carbine $rand(10,40)
      set %Blaster $rand(10,40)
      set %Gatling $rand(10,40)
      set %Avenger $rand(10,40)
      set %counter $rand(10,20)
      set %counter.chance $rand(1,10)
      .timer 1 2 .msg $chan There's a showdown in the town! %p1 and %P2 are facing eachother, ready to shoot. %p1 will shoot first... (use !shoot <weapon> to shoot)
      .timer 1 3 .describe $chan Available weapons are  Magnum, Shotgun, Carbine, Blaster, Gatling, Avenger . (EX.  !shoot Magnum)
      timerchatfight off
      timerchatfight2 off
    }
    elseif (%f)  .timer 1 1 .msg $chan $nick there are still %f seconds left until another duel can start. 
  }
  elseif ( %P2 != $nick )  .timer 1 1 .msg $chan $nick you were not challenged by %P1 $+ .
}

on *:TEXT:!shoot*:#: {
  if  (( %chatf == on )) {
    if  (( %turn == $nick )) && (( %P1 == $nick )) {
      ;***************************************************
      ;Player 1 attack
      ;***************************************************
      if  (( $2 == Magnum )) {
        ;***************************************************
        ;Player 1 Magnum
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Magnum
          .timer 1 2 .describe $chan $nick quickly pulls out the Magnum, making a few new holes in %P2 for %Magnum damage!
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan A well placed shot from %p1 $+ 's 44 takes out %p2 $+ . Good work partner, here's 20 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn!
            setMagnum
            setcounter.chance
          }
        }
      }
      if  (( $2 == Shotgun )) {
        ;***************************************************
        ;Player 1 Shotgun
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan $nick wrongfully maneuvers their shotgun and ends up shooting their legs for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Shotgun
          .timer 1 2 .describe $chan %p1 switfly pulls out their shotgun, blasting %p2 for %shotgun damage. Neat!
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan Alright! %p1 shoves their shotgun in %p2 $+ 's mouth, quickly pulling the trigger and spraying %p2 $+ 's brains everywhere! Collect your 20 cookies my friend, you earned them!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setShotgun
            setcounter.chance
          }
        }
      }
      if  (( $2 == Carbine )) {
        ;***************************************************
        ;Player 1 Carbine
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan $nick is trying to pull their carbine out of their backpack, but it tangles into something, ending up with $nick getting shot for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Carbine
          .timer 1 2 .describe $chan %p1 $nick is swift and on point with the shooting skills. %p1 shoots a flurry  at %p2 for %carbine damage.
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan It's been a tough fight, and %p2 is badly injured and unable to fight back. With a single bullet to the head, %p1 puts %p2 out of their misery. Easiest 20 cookies ever!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setCarbine
            setcounter.chance
          }
        }
      }
      if  (( $2 == blaster )) {
        ;***************************************************
        ;Player 1 Blaster
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan $nick tries to shoot %p2, but since their blaster wasn't properly maintained, it shortcircuited and $nick ended up zapped for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Blaster
          .timer 1 2 .describe $chan PEW PEW! $nick shot a few times from their blaster, hitting %p2 for %blaster damage. Damn, that must burn like hell!
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan A single ray of light sweeps across the arena, cutting %p2 into half. %p1 $+ , here's your 20 cookies my friend, nicely done!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setBlaster
            setcounter.chance
          }
        }
      }
      if  (( $2 == Gatling )) {
        ;***************************************************
        ;Player 1 Gatling
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan Weapon maintenance... Such a great thing when done properly. $nick $+ 's Gatling overheated, burning $nick for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Gatling
          .timer 1 2 .describe $chan A flurry of thing laser beams cuts the air, hitting %p2 all over and dealing %Gatling damage. Ouch!
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan %p1 carefully aims, then executes %p2 with a concentrated flux of rays, turning their body into a warm pile of red ash. EZ 20 cookies!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setGatling
            setcounter.chance
          }
        }
      }
      if  (( $2 == Avenger )) {
        ;***************************************************
        ;Player 1 Avenger
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          .timer 1 1 .describe $chan Using miniguns is not a task for the weak. $nick tries to shoot their Avenger, but gets fingers stuck in the mechanisms and a nice wound for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Avenger
          .timer 1 2 .describe $chan $nick pulls out their CZ57 Avenger minigun and shoots right where %p2 hides. A few bullets get through cover, hitting %p2 for %Avenger damage.
          if (%p2hp <= 0) {
            .timer 2 3 .msg $chan %p2 tried to come out of cover to snipe %p1, only to be welcomed by a flurry of deadly bullets that tore right through their chest, earning %p1 20 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setAvenger
            setcounter.chance
          }
        }
      }

      ;****************************************************
      ;Player 1 no shoot set
      ;****************************************************
      if (( $2 == $null )) {
        set %turn %p2
        dec %P1HP %counter
        .timer 1 1 .describe $chan %p1 $+ 's weapon backfired for %counter damage.  %p1 has %p1hp HP.
        unset %counter.chance
        set %counter.chance $rand(1,10)
        if (%p1hp <= 0) {
          .timer 2 3 .msg $chan Headshot! %p2 scored a perfect hit, right between %p1 $+ '2 eyes. Beautiful!
          writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
          writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
          cfover 
        }
      }
    } 

    if  (( %turn == $nick )) && (( %P2 == $nick )) {
      ;***************************************************
      ;Player 2 attack
      ;***************************************************
      if  (( $2 == Magnum )) {
        ;***************************************************
        ;Player 2 Magnum
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Magnum
          .timer 1 2 .describe $chan $nick quickly pulls out the Magnum, making a few new holes in %P1 for %Magnum damage!
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan A well placed shot from %p2 $+ 's 44 takes out %p1 $+ . Good work partner, here's 20 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setMagnum
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Shotgun )) {
        ;***************************************************
        ;Player 2 Shotgun
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan $nick wrongfully maneuvers their shotgun and ends up shooting their legs for %counter damage! %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Shotgun
          .timer 1 2 .describe $chan %p2 switfly pulls out their shotgun, blasting %p1 for %shotgun damage. Neat!
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan Alright! %p2 shoves their shotgun in %p1 $+ 's mouth, quickly pulling the trigger and spraying %p1 $+ 's brains everywhere! Collect your 20 cookies my friend, you earned them!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setShotgun
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Carbine )) {
        ;***************************************************
        ;Player 2 Carbine
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan $nick is trying to pull their carbine out of their backpack, but it tangles into something, ending up with $nick getting shot for %counter damage. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Carbine
          .timer 1 2 .describe $chan $chan %p2 is swift and on point with the shooting skills. %p2 shoots a flurry  at %p1 for %carbine damage.
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan It's been a tough fight, and %p1 is badly injured and unable to fight back. With a single bullet to the head, %p2 puts %p1 out of their misery. Easiest 20 cookies ever!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn
            setCarbine
            setcounter.chance
          }  
        }
      }
      if  (( $2 == blaster )) {
        ;***************************************************
        ;Player 2 Blaster
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan $nick tries to shoot %p1, but since their blaster wasn't properly maintained, it shortcircuited and $nick ended up zapped for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Blaster
          .timer 1 1 .msg $chan blaster!
          .timer 1 2 .describe $chan PEW PEW! $nick shot a few times from their blaster, hitting %p1 for %blaster damage. Damn, that must burn like hell!
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan A single ray of light sweeps across the arena, cutting %p1 into half. %p2 $+ , here's your 20 cookies my friend, nicely done!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setBlaster
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Gatling )) {
        ;***************************************************
        ;Player 2 Gatling
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan Weapon maintenance... Such a great thing when done properly. $nick $+ 's Gatling overheated, burning $nick for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Gatling
          .timer 1 2 .describe $chan A flurry of thing laser beams cuts the air, hitting %p1 all over and dealing %Gatling damage. Ouch!
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan %p2 carefully aims, then executes %p1 with a concentrated flux of rays, turning their body into a warm pile of red ash. EZ 20 cookies!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setGatling
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Avenger )) {
        ;***************************************************
        ;Player 2 Avenger
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          .timer 1 1 .describe $chan Using miniguns is not a task for the weak. $nick tries to shoot their Avenger, but gets fingers stuck in the mechanisms and a nice wound for %counter damage. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Avenger {
          .timer 1 2 .describe $chan $nick pulls out their CZ57 Avenger minigun and shoots right where %p1 hides. A few bullets get through cover, hitting %p1 for %Avenger damage. }
          if (%p1hp <= 0) {
            .timer 2 3 .msg $chan %p1 tried to come out of cover to snipe %p2, only to be welcomed by a flurry of deadly bullets that tore right through their chest, earning %p2 20 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setAvenger
            setcounter.chance
          }  
        }
      	  }
    }

    ;******************************************************
    ;Player 2 no shoot set
    ;******************************************************
    elseif (( $2 == $null )) {
      set %turn %p1
      dec %P2HP %counter
      .timer 1 1 .describe $chan %p2 $+ 's weapon backfired for %counter damage. BloodTrail
      .timer 1 2 .msg $chan %p1 has %p1hp / %p2 has %p2hp.
      unset %counter.chance
      set %counter.chance $rand(1,10)
      if (%p1hp <= 0) {
        .timer 2 3 .msg $chan Headshot! %p1 scored a perfect hit, right between %p2 $+ '2 eyes. Beautiful!
        writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-20)
        writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+20)
        cfover 
      }
    }
  }
}


on *:TEXT:!setduel*:#: {
  if ($nick isop $chan) {
    if ($2 == on) {
      set %on.off on | .msg $chan Dueling is now on.
    }
    elseif ($2 == off) {
      unset %on.off | unset %f | cfover | .msg $chan Dueling is now off.
    }
  }
}



When someone wins the winning messages gets sent twice. Any idea why?

Joined: Jun 2014
Posts: 248
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Jun 2014
Posts: 248
cause those timers are set to fire twice.

Joined: Feb 2015
Posts: 16
U
Pikka bird
OP Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
Cool, worked like a charm. Thank you for the time and patience. What should I link to in the credits?

Joined: May 2015
Posts: 11
S
Pikka bird
Offline
Pikka bird
S
Joined: May 2015
Posts: 11
Hey I just saw this great job but I didnt notice anything regarding your point system did you manage to integrate that and I just hadnt noticed or....?

Joined: Feb 2015
Posts: 16
U
Pikka bird
OP Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
Integrating the points system is easily done via one line of text for the winner

Code:
writeini -n Points.ini $+(#,.,<winner>) Points $calc($readini(Points.ini,$+(#,.,<winner>),Points)+50)


where you replace <winner> with $nick or $2. Following is the entire script for my duel. Please note that this is not working properly with the new twitch irc v3 features, for unknown reasons so far (at least to me)

Click to reveal..

Code:
;*****************************************************
;Chat Fighter created by MajiShine
;*****************************************************

;*****************************************************
;Alias Area
;*****************************************************
alias cfover { unset %chatf | unset %f | unset %P1 | unset %P2 | unset %turn | unset %P1HP | unset %P2HP | unset %Magnum | unset %Shotgun | unset %Carbine | unset %Blaster | unset %Gatling | unset %Avenger | unset %counter }
alias setMagnum { unset %Magnum | set %Magnum $rand(10,40) }
alias setShotgun { unset %Shotgun | set %Shotgun $rand(10,40) }
alias setCarbine { unset %Carbine | set %Carbine $rand(10,40) }
alias setBlaster { unset %Blaster | set %Blaster $rand(10,40) }
alias setGatling { unset %Gatling | set %Gatling $rand(10,40) }
alias setAvenger { unset %Avenger | set %Avenger $rand(10,40) }
alias setcounter.chance { unset %counter.chance | set %counter.chance $rand(1,10) }

;*****************************************************
;GAME
;*****************************************************

on *:TEXT:!duel*:#: {
  set %IsDuel = 1
  if (%on.off == $null) { .timer 1 1 .msg $chan Dueling is currently turned off. Please ask any mod to turn it on. }
  elseif (%on.off == on) {
    if ($2 == $null) { .msg $chan $nick you must specify someone to fight (EX. !duel undeadpuff) | halt }
    if ($nick == $2) { .msg $chan $nick you cannot challenge yourself to fight. | halt }
    if ($2 !ison $chan) { .msg $chan $2 is not online. | halt }
    if (%f) { .msg $chan $nick , you have to wait %f seconds until another duel can begin. | halt }
    if (%IsDuel == 1) { .msg $chan Someone was already provoked, please wait for them to accept or for the challenge to expire | halt }
    elseif (!%f) {
      ;set %IsDuel 0
      set %P1 $nick
      set %turn $nick
      set %P2 $2
      splay D:\Stream material\Sounds\DuelCroods.mp3
      .timer 1 1 describe $chan $nick has challenged $2 to a duel! $2 type !accept to fight!
      timerchatfight 1 60 .msg $chan $2 chickened out of the fight and run to the hills all covered in shame.
      timerchatfight2 1 60 cfover
    }
  }
}

on *:TEXT:!deny:#: {
  msg $chan Duel refused! Guess $nick doesn't have the guts to do it...
  cfover
}

on *:TEXT:!accept*:#: {
  if ( %P2 == $nick ) {
    if (!%f) {
      set -z %f 100
      set %chatf on
      set %P1HP 100
      set %P2HP 100
      set %Magnum $rand(10,40)
      set %Shotgun $rand(10,40)
      set %Carbine $rand(10,40)
      set %Blaster $rand(10,40)
      set %Gatling $rand(10,40)
      set %Avenger $rand(10,40)
      set %counter $rand(10,40)
      set %counter.chance $rand(1,10)
      .timer 1 2 .msg $chan There's a showdown in the town! %p1 and %P2 are facing eachother, ready to shoot. %p1 will shoot first... (use !shoot <weapon> to shoot)
      .timer 1 3 .describe $chan Available weapons are  Magnum, Shotgun, Carbine, Blaster, Gatling, Avenger . (EX.  !shoot Magnum)
      timerchatfight off
      timerchatfight2 off
    }
    elseif (%f)  .timer 1 1 .msg $chan $nick there are still %f seconds left until another duel can start. 
  }
  elseif ( %P2 != $nick )  .timer 1 1 .msg $chan $nick you were not challenged by %P1 $+ .
}

on *:TEXT:!shoot*:#: {
  if  (( %chatf == on )) {
    if  (( %turn == $nick )) && (( %P1 == $nick )) {
      ;***************************************************
      ;Player 1 attack
      ;***************************************************
      if  (( $2 == Magnum )) {
        ;***************************************************
        ;Player 1 Magnum
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Magnum
          .timer 1 2 .describe $chan $nick quickly pulls out the Magnum, making a few new holes in %P2 for %Magnum damage!
          if (%p2hp <= 0) {
            .timer 1 3 .msg $chan A well placed shot from %p1 $+ 's 44 takes out %p2 $+ . Good work partner, here's 50 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn!
            setMagnum
            setcounter.chance
          }
        }
      }
      if  (( $2 == Shotgun )) {
        ;***************************************************
        ;Player 1 Shotgun
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Shotgun
          .timer 1 2 .describe $chan %p1 switfly pulls out their shotgun, blasting %p2 for %shotgun damage. Neat!
          if (%p2hp <= 0) {
            .timer 1 3 .msg $chan Alright! %p1 shoves their shotgun in %p2 $+ 's mouth, quickly pulling the trigger and spraying %p2 $+ 's brains everywhere! Collect your 50 cookies my friend, you earned them!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setShotgun
            setcounter.chance
          }
        }
      }
      if  (( $2 == Carbine )) {
        ;***************************************************
        ;Player 1 Carbine
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Carbine
          .timer 1 2 .describe $chan %p1 $nick is swift and on point with the shooting skills. %p1 shoots a flurry  at %p2 for %carbine damage.
          if (%p2hp <= 0) {
            .timer 1 3 .msg $chan It's been a tough fight, and %p2 is badly injured and unable to fight back. With a single bullet to the head, %p1 puts %p2 out of their misery. Easiest 50 cookies ever!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setCarbine
            setcounter.chance
          }
        }
      }
      if  (( $2 == blaster )) {
        ;***************************************************
        ;Player 1 Blaster
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Blaster
          .timer 1 2 .describe $chan PEW PEW! $nick shot a few times from their blaster, hitting %p2 for %blaster damage. Damn, that must burn like hell!
          if (%p2hp <= 0) {
            .timer 1 3 .msg $chan A single ray of light sweeps across the arena, cutting %p2 into half. %p1 $+ , here's your 50 cookies my friend, nicely done!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setBlaster
            setcounter.chance
          }
        }
      }
      if  (( $2 == Gatling )) {
        ;***************************************************
        ;Player 1 Gatling
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Gatling
          .timer 1 2 .describe $chan A flurry of thin laser beams cuts the air, hitting %p2 all over and dealing %Gatling damage. Ouch!
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan %p1 carefully aims, then executes %p2 with a concentrated flux of rays, turning their body into a warm pile of red ash. EZ 50 cookies!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setGatling
            setcounter.chance
          }
        }
      }
      if  (( $2 == Avenger )) {
        ;***************************************************
        ;Player 1 Avenger
        ;***************************************************
        set %turn %P2
        if (( %counter.chance == 1 )) {
          dec %p1hp %counter
          if (%p1hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p1 loses 10 cookies, %p2 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+10)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p1 has %p1hp HP. %p2 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P2HP %Avenger
          .timer 1 2 .describe $chan $nick pulls out their CZ57 Avenger minigun and shoots right where %p2 hides. A few bullets get through cover, hitting %p2 for %Avenger damage.
          if (%p2hp <= 0) {
            .timer 1 3 .msg $chan %p2 tried to come out of cover to snipe %p1, only to be welcomed by a flurry of deadly bullets that tore right through their chest, earning %p1 50 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)+50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)-50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p2 turn.
            setAvenger
            setcounter.chance
          }
        }
      }

      ;****************************************************
      ;Player 1 no shoot set
      ;****************************************************
      if (( $2 == $null )) {
        msg $chan $nick, Please use !shoot <weapon> to fight in the duel. Available weapons are  Magnum, Shotgun, Carbine, Blaster, Gatling, Avenger .
      } 
    } 

    if  (( %turn == $nick )) && (( %P2 == $nick )) {
      ;***************************************************
      ;Player 2 attack
      ;***************************************************
      if  (( $2 == Magnum )) {
        ;***************************************************
        ;Player 2 Magnum
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Magnum
          .timer 1 2 .describe $chan $nick quickly pulls out the Magnum, making a few new holes in %P1 for %Magnum damage!
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan A well placed shot from %p2 $+ 's 44 takes out %p1 $+ . Good work partner, here's 50 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setMagnum
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Shotgun )) {
        ;***************************************************
        ;Player 2 Shotgun
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Shotgun
          .timer 1 2 .describe $chan %p2 switfly pulls out their shotgun, blasting %p1 for %shotgun damage. Neat!
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan Alright! %p2 shoves their shotgun in %p1 $+ 's mouth, quickly pulling the trigger and spraying %p1 $+ 's brains everywhere! Collect your 50 cookies my friend, you earned them!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setShotgun
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Carbine )) {
        ;***************************************************
        ;Player 2 Carbine
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Carbine
          .timer 1 2 .describe $chan %p2 is swift and on point with the shooting skills. %p2 shoots a flurry  at %p1 for %carbine damage.
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan It's been a tough fight, and %p1 is badly injured and unable to fight back. With a single bullet to the head, %p2 puts %p1 out of their misery. Easiest 50 cookies ever!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn
            setCarbine
            setcounter.chance
          }  
        }
      }
      if  (( $2 == blaster )) {
        ;***************************************************
        ;Player 2 Blaster
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Blaster
          .timer 1 2 .describe $chan PEW PEW! $nick shot a few times from their blaster, hitting %p1 for %blaster damage. Damn, that must burn like hell!
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan A single ray of light sweeps across the arena, cutting %p1 into half. %p2 $+ , here's your 50 cookies my friend, nicely done!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setBlaster
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Gatling )) {
        ;***************************************************
        ;Player 2 Gatling
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Gatling
          .timer 1 2 .describe $chan A flurry of thing laser beams cuts the air, hitting %p1 all over and dealing %Gatling damage. Ouch!
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan %p2 carefully aims, then executes %p1 with a concentrated flux of rays, turning their body into a warm pile of red ash. EZ 50 cookies!
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setGatling
            setcounter.chance
          }  
        }
      }
      if  (( $2 == Avenger )) {
        ;***************************************************
        ;Player 2 Avenger
        ;***************************************************
        set %turn %P1
        if (( %counter.chance == 1 )) {
          dec %p2hp %counter
          if (%p2hp <= 0) {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, %p2 loses 10 cookies, %p1 wins 10 cookies.
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+10)
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-10)
            cfover
          }
          else {
            .timer 1 1 .describe $chan $nick $+ 's weapon jams and explodes, hurting $nick for %counter health. %p2 has %p2hp HP. %p1 $+ 's turn to shoot!
          }
          unset %counter.chance
          set %counter.chance $rand(1,10)
        }
        else {
          dec %P1HP %Avenger {
          .timer 1 2 .describe $chan $nick pulls out their CZ57 Avenger minigun and shoots right where %p1 hides. A few bullets get through cover, hitting %p1 for %Avenger damage. }
          if (%p1hp <= 0) {
            .timer 1 3 .msg $chan %p1 tried to come out of cover to snipe %p2, only to be welcomed by a flurry of deadly bullets that tore right through their chest, earning %p2 50 cookies.
            writeini -n Points.ini $+(#,.,%p1) Points $calc($readini(Points.ini,$+(#,.,%p1),Points)-50)
            writeini -n Points.ini $+(#,.,%p2) Points $calc($readini(Points.ini,$+(#,.,%p2),Points)+50)
            cfover 
          }
          else {
            .timer 1 3 .msg $chan %p1 has %p1hp HP/ %p2 has %p2hp HP., it is now %p1 turn.
            setAvenger
            setcounter.chance
          }  
        }
      }
    }

    ;******************************************************
    ;Player 2 no shoot set
    ;******************************************************
    ;elseif (( $2 == $null )) {
    ;  msg $chan $nick, Please use !shoot <weapon> to fight in the duel. Available weapons are  Magnum, Shotgun, Carbine, Blaster, Gatling, Avenger .
    ;} 
  }
}


on *:TEXT:!setduel*:#: {
  if ($nick isop $undeadpuff) {
    if ($2 == on) {
      set %on.off on | .msg $chan Dueling is now on.
    }
    elseif ($2 == off) {
      unset %on.off | unset %f | cfover | .msg $chan Dueling is now off.
    }
  }
}


Last edited by UnDeadPuff; 19/06/15 10:41 AM.

Link Copied to Clipboard