mIRC Home    About    Download    Register    News    Help

Print Thread
#140476 26/01/06 01:10 AM
Joined: Jan 2006
Posts: 19
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Jan 2006
Posts: 19
alias dead {
if ($readini($1 $+ .chr,stats,hp) < 1) {
writeini $1 $+ .chr battle entered no
removeword $1
writeini $1 $+ .chr battle dead yes
var %money = $readini($1 $+ .chr,stats,level)
var %randmoney1 = $round($calc(%money / 1.5))
var %randmoney2 = $round($calc(%money * 1.5) * 5)
var %money = $rand(%randmoney1,%randmoney2)
var %exp22 $readini($2 $+ .chr,stats,exp)
if (%exp22 < 1) { writeini $2 $+ .chr stats exp 1 }
var %exp = $readini($1 $+ .chr,stats,level)
var %exp1 = $calc(%exp * 5)
if (%exp1 < 1) { var %exp1 = 1 }
var %exp = $rand(%exp1,$calc(%exp * 10))
msg %chanset $skz($1 $+ $aura($1) Was Killed By $2 $+ $aura($2))
/notice $2 $skz(You Have Gained %exp Exp And $chr(36) $+ %money)
writeini $2 $+ .chr battle attacking false
writeini $1 $+ .chr battle attacking false
/checklevel $2
mode %chanset -v $1
writeini $2 $+ .chr stats money $calc($readini($2 $+ .chr,stats,money) + %money)
writeini $2 $+ .chr stats exp $calc($readini($2 $+ .chr,stats,exp) + %exp)
timer $+ $1 off
timer $+ $2 off
}
}

my problem is, is that it doesnt calculate the money or exp correct, is it my formula or an error in the coding?

#140477 26/01/06 02:37 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The coding looks correct, so I'm thinking that it's something in your calculations. One thing that makes it difficult to determine is your usage of $rand in the calculation of %exp & %money.

It might help if you would give us an example of what you're getting versus what you would be expecting to get.

Also, for future reference, when posting code, please use the Code Tags

#140478 26/01/06 08:16 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
This is what i think it does currently
Code:
[color:blue];
;$1 = person who died? (or at least person who might have died if HP is &lt; 1 ---- defined as P1 (player1)
;$2 = killer? --- defined as P2 (player2)
;[/color]
alias dead {
  if ($readini($1 $+ .chr,stats,hp) &lt; 1) {
    [color:blue];^ checks if P1 is dead[/color]
    writeini $1 $+ .chr battle entered no 
    removeword $1
    writeini $1 $+ .chr battle dead yes
    [color:blue];^ doing some things to set P1 as not active or dead[/color]
    var %money = $readini($1 $+ .chr,stats,level)
    var %randmoney1 = $round($calc(%money / 1.5))
    var %randmoney2 = $round($calc(%money * 1.5) * 5)
    var %money = $rand(%randmoney1,%randmoney2)
    [color:blue];^ generates a random money amont from P1 money amount this well be from a random number from 66% to 500%
    ;ie if P1 had $1000 it well be a random number from $667 to $5000[/color]
    [color:red];THIS DOES NOT CHANGE P1 CURRENT MONEY LEVEL[/color] 
    var %exp22 $readini($2 $+ .chr,stats,exp)
    if (%exp22 &lt; 1) { writeini $2 $+ .chr stats exp 1 }
    var %exp = $readini($1 $+ .chr,stats,level)
    var %exp1 = $calc(%exp * 5)
    if (%exp1 &lt; 1) { var %exp1 = 1 }
    var %exp = $rand(%exp1,$calc(%exp * 10))
    [color:blue];^ generate a random number from P1 "level" value, the random value well normally be in the range of 500% to 1000% of P1 "level" (see note below)
    ;This has a possable fault in it, assuming that "level" is &lt;=0 or $null, then only the 500% value is corrected to "1", the 1000% value is still x10 of "level"[/color] 
    msg %chanset $skz($1 $+ $aura($1) Was Killed By $2 $+ $aura($2))
    /notice $2 $skz(You Have Gained %exp Exp And $chr(36) $+ %money)
    [color:blue];^ report outcome of fight[/color] 
    writeini $2 $+ .chr battle attacking false
    writeini $1 $+ .chr battle attacking false
    /checklevel $2
    mode %chanset -v $1 
    [color:blue];^ alter status's of P1 and P2[/color] 
    writeini $2 $+ .chr stats money $calc($readini($2 $+ .chr,stats,money) + %money)
    writeini $2 $+ .chr stats exp $calc($readini($2 $+ .chr,stats,exp) + %exp)       
    [color:blue];^ add gained exp and money to P2[/color] 
    timer $+ $1 off 
    timer $+ $2 off
    [color:blue];^ shut down fight timers?[/color] 
  }
}


you well notice that in the %exp calculation descript tion i mentioned "level", this is becuase the source of the value is from $readini($1 $+ .chr,stats,level) and not from exp due to the nature of the game i cant tell if this is the right or wrong source.

* Something that would have helped alot was if u told us what u had expected the exp and money values to be (ranged) for say $100 and "level/exp" of 100


Link Copied to Clipboard