Duel Script

By Whatever on Nov 17, 2005

Paste this into a new .mrc file, then save it. Type !duel to start a duel. If no one responds in 20 seconds, the duel will be cancelled. If someone replies, the duel will start. Type !attack to attack when it is your turn. And when you are being attacked you will have 5 seconds to type !block and attempt to block the strike.

on *:TEXT:!duel:%chan:{
  if (!%duel.active) {
    if (!%duel.1) { set %duel.1 $nick | .msg $chan 4 $+ %duel.1 7has set up a Duel. Type 1!duel 7to challenge him. | set %duel.chan $chan | set -u20 %duel 1 | .timerDUEL 1 20 duel-check }
    elseif ((%duel.1 != $null || $nick) && (%duel == 1)) { set %duel.2 $nick | .msg $chan 2 $+ %duel.2 7has challenged 4 $+ %duel.1 }
  }
  else .notice $nick There is already an active Duel. Wait till this Duel has ended before starting another one.
}

on *:TEXT:!end:%chan:{
  if (%duel.active != $null) {
    if ($nick == %owner || %duel.1 || %duel.2) {
      .msg $chan 7Duel ended by 4 $+ $nick
      unset %duel*
      unset %damage
      .timers off
      halt
    }
    else .notice $nick Only %owner or those taking part in the Duel are allowed to use this command
  }
  else .notice $nick There are no active Duels
}

on *:TEXT:!attack:%chan:{
  if (%duel.active == 1) {
    if ($nick == %duel.turn) {
      attack
    }
    elseif (($nick == %duel.1 || %duel.2) && ($nick != %duel.turn)) .notice $nick It is not your turn yet.
  }
  elseif (%duel.active == $null) .notice $nick This is a Duel only command. There are no active Duels right now. Type !duel to start a Duel.
}

on *:TEXT:!block:%chan:{
  if (%duel.active == 1) {
    if ($nick != %duel.turn) {
      defend
    }
  }
  elseif (%duel.active == $null) .notice $nick This is a Duel only command. There are no active Duels right now. Type !duel to start a Duel.
}

alias duel-check {
  if (%duel.1 && %duel.2 != $null) {
    .msg %duel.chan 7Setting up duel. Duel will start in 3 seconds.
    .timerSTART 1 3 startduel
  }
  elseif (%duel.2 == $null) { .msg %duel.chan 7No one has dared to take up 4 $+ %duel.1 $+ 's 7challenge. Duel cancelled. | unset %duel* }
}

alias hp-check {
  if (%duel.2.hp <= 0) {
    .msg %duel.chan 4 $+ %duel.1 7has defeated 2 $+ %duel.2 7in battle.
    unset %duel*
    unset %block*
    unset %damage
    halt
  }
  if (%duel.1.hp <= 0) {
    .msg %duel.chan 2 $+ %duel.2 7has defeated 4 $+ %duel.1 7in battle.
    unset %duel*
    unset %block*
    unset %damage
    halt
  }
}

alias startduel {
  set %duel.1.hp 50
  set %duel.2.hp 50
  set %duel.active 1
  .msg %duel.chan 7Duel start! 4 $+ %duel.1 7will face off with 2 $+ %duel.2 $+ .
  set %duel.first $rand(1,10)
  if (%duel.first <= 5) { .msg %duel.chan 4 $+ %duel.1 7will start first. | set %duel.turn %duel.1 }
  if (%duel.first > 5) { .msg %duel.chan 4 $+ %duel.2 7will start first. | set %duel.turn %duel.2 }
  unset %duel.first
}

alias attack {
  if (%duel.turn == %duel.1) {
    .msg %duel.chan 4 $+ %duel.1 7swings at 2 $+ %duel.2 7with his sword...
    set %damage $rand(0,20)
    .timerattack 1 5 hit
  }
  elseif (%duel.turn == %duel.2) {
    .msg %duel.chan 2 $+ %duel.2 7swings at 4 $+ %duel.1 7with his sword...
    set %damage $rand(0,20)
    .timerattack 1 5 hit
  }
}

alias hit {
  if (%duel.turn == %duel.1) {
    dec %duel.2.hp %damage
    .msg %duel.chan 4 $+ %duel.1 7hits 2 $+ %duel.2 7for %damage damage. 2 $+ %duel.2 7has %duel.2.hp hitpoints left.
    hp-check
    set %duel.turn %duel.2
    .msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
  }
  elseif (%duel.turn == %duel.2) {
    dec %duel.1.hp %damage
    .msg %duel.chan 2 $+ %duel.2 7hits 4 $+ %duel.1 7for %damage damage. 4 $+ %duel.1 7has %duel.1.hp hitpoints left.
    hp-check
    set %duel.turn %duel.1
    .msg %duel.chan 7It is now 2 $+ %duel.1 $+ 's 7turn.
  }
  unset %damage
}

alias defend {
  timerattack off
  if (%duel.turn == %duel.1) {
    set %block $rand(1,10)
    if (%block <= 7) {
      .msg %duel.chan 2 $+ %duel.2 7successfully blocks 4 $+ %duel.1 $+ 's 7attack. 
      set %duel.turn %duel.2
      .msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
    }
    elseif (%block > 7) {
      set %block.damage $floor($calc(%damage/2))
      dec %duel.2.hp %block.damage
      .msg %duel.chan 2 $+ %duel.2 7manages to block 4 $+ %duel.1 $+ 's 7attack. But the force of the blow does %block.damage damage to 2 $+ %duel.2 $+ . %duel.2 7has %duel.2.hp hitpoints left.
      hp-check
      set %duel.turn %duel.2
      .msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
    }
    if (%duel.turn == %duel.2) {
      set %block $rand(1,10)
      if (%block <= 7) {
        .msg %duel.chan 4 $+ %duel.1 7successfully blocks 2 $+ %duel.2 $+ 's 7attack. 
        set %duel.turn %duel.1
        .msg %duel.chan 7It is now 4 $+ %duel.1 $+ 's 7turn.
      }
      elseif (%block > 7) {
        set %block.damage $floor($calc(%damage/2))
        dec %duel.1.hp %block.damage
        .msg %duel.chan 4 $+ %duel.1 7manages to block 2 $+ %duel.2 $+ 's 7attack. But the force of the blow does %block.damage damage to 4 $+ %duel.1 $+. %duel.1 7has %duel.1.hp hitpoints left.
        hp-check
        set %duel.turn %duel.1
        .msg %duel.chan 7It is now 4 $+ %duel.1 $+ 's 7turn.
      }
    }
  }
  unset %damage
  unset %block*
}

Comments

Sign in to comment.
VinX   -  Jul 29, 2009

@dragon_3290 : whats the prob ?

@Whatever : nice script :)) thanks

i changed the %chan to #vinx and it workd

More
 Respond  
shugo103   -  Feb 08, 2007

Hmm... i think i have seen this script... on this very web site.. lol... I will look for it now ^^

More
 Respond  
dragon_3290   -  Feb 04, 2007

mine no work :(

More
 Respond  
Nyt3mare   -  Dec 07, 2006

I don\'t know who you are, Whatever, but if I find out, I\'m gonna be pissed. That\'s my script, and you stole it. I do know, how ever, that you\'ve gotta be from the aXpi server.

More
 Respond  
Master Smiley   -  Nov 20, 2006

yeah that is what mine does....

More
 Respond  
Master Smiley   -  Sep 03, 2006

yeah it always does 1 damage when i block, could you fix that? also, can you make a persional stats counter, like wins and losses?

More
 Respond  
drumkid007   -  Aug 12, 2006

mine doesnt work

More
 Respond  
Master Smiley   -  Aug 10, 2006

it wont let me block, it always does 1 damage to me, when i type block

More
 Respond  
Whatever   -  Nov 18, 2005

I prefer Pikachu xD

More
 Respond  
Sasuke   -  Nov 18, 2005

Raichu, Bublasaur or Charmeleon\'s my favorite XD

More
 Respond  
Raichu   -  Nov 18, 2005

very fun script u made!

More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.