I'd like to improve this script but i lack skills to do so! I need help :) here is what id like to do : adding a victory counter , implenting experience system ( each win gives 1 exp point , 10 points = 1 level up and each level grants +1 acre damage on attacks(cap damage at +20). also adding a new attack that would Leach oppenent's acres) Please help me :) here's the script
on $*:text:!duelcmds:*:{
msg $nick 12,0 ~ Attacks ~
msg $nick !trad (1 hit 30-120 acres)
msg $nick !double tap ( 2 hits 20-40 acres)
msg $nick !Ll (1 Spell 1-200 acres)
msg $nick !Tornadoe (1 spell 50-70 acres)
msg $nick 0,12 ~ Others ~
msg $nick !delete
msg $nick !duel
msg $nick !stopduel
}
on *:text:!duel*:#: {
if (%fight2 == active) {
msg $chan 1,9 a Match is already underway! Wait your turn!
}
if (%fight == active) {
set %player2 $nick
if (%player2 = %player1) { halt }
msg $chan 1,9 the match is set! 9,1 %player1 1,9 vs 9,1 %player2
notice %player1 Type "!duelcmds" for the commands list.
notice %player2 Type "!duelcmds" for the commands list.
set %fight2 active
set %p1acres 400
set %p2acres 400
set %stamina1 0
set %stamina2 0
set %turn 1
}
else {
set %fight active
set %player1 $nick
msg $chan 1,9 $nick 9,1 has declared a challenge type !duel to fight them
}
}
on *:text:!double tap*:#: {
if (%turn == 1) {
if ($nick == %player1) {
if (%stamina2 < 10) {
set %hit1 $rand(20,40)
set %hit2 $rand(20,40)
inc %stamina1 2
msg $chan 1,9 %player1 9,1 has hit 1,9 %hit1 9,1 and 1,9 %hit2
dec %p2acres %hit1
dec %p2acres %hit2
msg $chan 1,9 %player2 9,1 has 1,9 %p2acres 9,1 acres left
set %turn 2
}
if (%p2acres <= 0) {
msg $chan 4,1 %player1 1,4 has killed 4,1 %player2
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
else if (%stamina1 >= 10) {
notice %player1 you are out of stamina
}
}
else {
if (%turn == 2) {
if ($nick == %player2) {
if (%stamina2 < 10) {
set %hit1 $rand(20,40)
set %hit2 $rand(20,40)
inc %stamina2 2
msg $chan 1,9 %player2 9,1 has hit 1,9 %hit1 9,1 and 1,9 %hit2
dec %p1acres %hit1
dec %p1acres %hit2
msg $chan 1,9 %player1 9,1 has 1,9 %p1acres 9,1 acres left
set %turn 1
if (%p1acres <= 0) {
msg $chan 4,1 %player2 has killed 1,4 %player1
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
else if (%stamina2 >= 10) {
notice %player2 you are out of stamina
}
}
}
}
}
on *:text:!trad*:#: {
if (%turn == 1) {
if ($nick == %player1) {
if (%stamina2 < 10) {
set %hit1 $rand(30,120)
inc %stamina1 4
msg $chan 1,9 %player1 9,1 has hit 1,9 %hit1
dec %p2acres %hit1
msg $chan 1,9 %player2 9,1 has 1,9 %p2acres 9,1 acres left
set %turn 2
}
if (%p2acres <= 0) {
msg $chan 4,1 %player1 1,4 has killed 4,1 %player2
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
else if (%stamina1 >= 10) {
notice %player1 you are out of stamina
}
}
else {
if (%turn == 2) {
if ($nick == %player2) {
if (%stamina2 < 10) {
set %hit1 $rand(30,120)
inc %stamina2 4
msg $chan 1,9 %player2 9,1 has hit 1,9 %hit1
dec %p1acres %hit1
msg $chan 1,9 %player1 has 9,1 %p1acres 1,9 acres left
set %turn 1
if (%p1acres <= 0) {
msg $chan 1,9 %player2 9,1 has killed 1,9 %player1
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
else if (%stamina2 >= 10) {
notice %player2 4,0 you are out of stamina
}
}
}
}
}
on *:text:!Ll*:#: {
if (%turn == 1) {
if ($nick == %player1) {
set %turn 2
set %hit1 $rand(1,200)
msg $chan 1,9 %player1 has hit a 9,1 %hit1
dec %p2acres %hit1
msg $chan 1,9 %player2 9,1 has 1,9 %p2acres 9,1 acres left
if (%p2acres <= 0) {
msg $chan 1,9 %player1 9,1 has killed 1,9 %player2
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
}
else if (%turn == 2) {
if ($nick == %player2) {
set %turn 1
set %hit1 $rand(1,200)
msg $chan 1,9 %player2 has hit a 9,1 %hit1
dec %p1acres %hit1
msg $chan 1,9 %player1 9,1 has 1,9 %p1acres 9,1 acres left
if (%p1acres <= 0) {
msg $chan 1,9 %player2 9,1 has killed 1,9 %player1
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
}
}
on *:text:!Tornadoe*:#: {
if (%turn == 1) {
if ($nick == %player1) {
set %turn 2
set %hit1 $rand(50,70)
msg $chan 1,9 %player1 has hit a 9,1 %hit1
dec %p2acres %hit1
msg $chan 1,9 %player2 has 9,1 %p2acres 1,9 acres left
if (%p2acres <= 0) {
msg $chan 1,9 %player1 9,1 has killed 1,9 %player2
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
}
if (%turn == 2) {
if ($nick == %player2) {
set %turn 1
set %hit1 $rand(50,70)
msg $chan 1,9 %player2 has hit a 9,1 %hit1
dec %p1acres %hit1
msg $chan 1,9 %player1 9,1 has 1,9 %p1acres 9,1 acres left
if (%p1acres <= 0) {
msg $chan 1,9 %player2 9,1 has killed 1,9 %player1
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else {
}
}
}
}
on *:text:!delete*:#: {
if (%turn == 1) {
if ($nick == %player1) {
msg $chan msg $chan 4,1 %player2 1,4 has won the duel by default
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
else{
}
if (%turn == 2) {
if ($nick == %player2) {
msg $chan 4,1 %player1 1,4 has won the duel by default
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
}
}
on *:text:!stopduel*:#: {
msg $chan 12Duel STOPPED
unset %fight
unset %player1
unset %player2
unset %fight2
unset %p1acres
unset %p2acres
unset %stamina1
unset %stamina2
unset %turn
unset %hit1
unset %hit2
}
If you were to set all of your variables like so:
%duel.fight
%duel.player1
%duel.player2
this would avoid it not playing well with other scripts, and also allow you to do this:
unset %duel.*
and unset them all in one go.
I would also suggest trying to learn hash tables, and they would be better suited to this purpose.
I'm a bit lazy, so I'm just going to point out stuff that should help you both have a better working game system and understand more about mirc scripting.
Victory counter, experience system and general user data should be kept in a ini file. Try /help $readini and /writeini.
But in a nutshell is something like:
set %newexp $readini(userdata.ini,%player,EXP) + 1
/writeini userdata.ini %player EXP %newexp
set %newvalue $readini(userdata.ini,%player,WIN) + 1
/writeini userdata.ini %player WIN %newexp
Levels can be determined by the ammount of exp (on a basic game system) so, imagine you need 10 exp points to get from level 0 to 1:
set %multiplier 10
set %exp $readini(userdata.ini,%player,EXP)
set %level %exp / %multiplier
echo your level is $int(%level)
Gaining strength from you level is as easy as
set %str 1 + %level
This should be enough to get you going again :)
BONUS
alias turn {
if ($1=next) { set %turn %turn +1 | return %turn }
if ($1=stop) { unset %turn }
}
;changing turn
msg chan Turn: $turn(next) is up! :)
;stoping turns (or reset)
/turn stop
*Note: I don't do MS in a long time, some of that code might be wrong (syntax) but the idea is there :)
edit: You can also download my "SLAP the game" script (it's in here somewhere) and read through it so you can learn more neat stuff :)
.