mIRC Home    About    Download    Register    News    Help

Print Thread
attack function #140402 25/01/06 08:01 AM
Joined: Jan 2006
Posts: 19
E
evidence22 Offline OP
Pikka bird
OP Offline
Pikka bird
E
Joined: Jan 2006
Posts: 19
heres my code:

on *:TEXT:`att*:#: {
var %atta * $+ $2 $+ *
if ($readini($nick $+ .chr,$nick,entered) = no) { /notice $nick You are not entered. | halt }
if ($readini($3 $+ .chr,$3,entered) = no) { /notice $nick $3 is not entered. | halt }
if ($3 !ison $chan) { /notice $nick $skz($3 is not here) | halt }
if ($readini($nick $+ .chr,battle,attacking) = yes) { notice $nick $skz(You Are Already attacking) | halt }
if (%atta iswm $readini($nick $+ .chr,weapons,attacks)) {
writeini $nick $+ .chr battle attacking yes
timer. $+ $nick $+ attacking1 1 $attacktime($3,$nick) /attack $nick $3 $2
timer. $+ $nick $+ attacking2 1 $attacktime2($3,$nick) writeini $nick $+ .chr battle attacking false
}
else {
/notice $nick $skz(You Dont Know That Move)
/halt
}
}

alias attacktime {
var %time $readini(attacks.dat,$1,time)
var %speed $readini($2 $+ .chr,stats,speed)
var %calci = $calc(%time - %speed),0)
return %calci
}
alias attacktime2 {
set %calci $round($calc($readini(attacks.dat,$1,time) - ($readini($2,stats,speed) / .9)),0)
return %calci
}
alias attack {
writeini $1 $+ .chr battle acc $calc($rand(1, $att))
if ($accuracy < 5) {
writeini $1 $+ .chr battle attacking no
return $skz($1 $+ $aura($1) Goes to hit $2 $+ $aura($2) With A $3 But Missed)
halt
}
Else {
set %atttype $+ $nick $atttype($3)
var %attack = $3
var %power = $readini(attacks.dat,%attack,power)
set %power $round($calc(%power + ($readini($1,stats,str) * 1.5)),0)
set %power $round($calc(%power - ($readini($2,stats,defense) / 2)),0)
if (%power < 1) { var %power = 1 }
if (%power == $null) { var %power = 1 }
var %gexp = $round($calc(%power / 5),0)
writeini $2 $+ .chr $2 hp $calc($readini($2 $+ .chr,$2,Hp) - $readini($1 $+ .chr,$1,damage))
msg %chanset $skz($1 $+ $aura($1) %atttype $+ 's $2 $+ $aura($2) Dealing %power Damage)
dead $2 $1
halt
}
}
alias rannum { return $rand(1,10) $+ $rand(1,10) $+ $rand(1,10) }

my problem is the timers dont work

Re: attack function #140403 25/01/06 08:30 AM
Joined: Mar 2005
Posts: 212
N
NeUtRoN_StaR Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
what error message do you get if any

Last edited by NeUtRoN_StaR; 25/01/06 10:03 AM.
Re: attack function #140404 25/01/06 08:43 AM
Joined: Jan 2006
Posts: 19
E
evidence22 Offline OP
Pikka bird
OP Offline
Pikka bird
E
Joined: Jan 2006
Posts: 19
it does:
timer. $+ $nick $+ attacking1 1 $attacktime($3,$nick) /attack $nick $3 $2
timer. $+ $nick $+ attacking2 1 $attacktime2($3,$nick) writeini $nick $+ .chr battle attacking

Re: attack function #140405 25/01/06 08:45 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
These are not mIRC identifiers, and if you haven't set them in the code, they won't work:

- $accuracy
- $skz
- $aura
- $atttype


Zyzzy smile


"All we are saying is give peace a chance" -- John Lennon
Re: attack function #140406 25/01/06 10:02 PM
Joined: Mar 2005
Posts: 212
N
NeUtRoN_StaR Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
i assume he has them set in some other part of the code