This is the NPC Module for MegaRPG.
Use With MegaRPG Base Code v2.0 and Rank Module v2.0
Making NPC's:
Commands:
/msg NPC Add <NPC-Name> <NPC-Level> /msg <BOT>
NPC Del
Adding an NPC will automatically give it HP/MHP, Attack and Defence stats depending on the Level you give it.
When someone typed `Entered they will see Who is entered including NPC's but there will be 3 different colors.
Normal: Player
Red: NPC
Blue: Admin
;NPC Maker
on 500:TEXT:`NPC *:?:{
if ($2 == Add) && ($3) && ($4) {
if ($istok(%NPC.Names,$3,32)) { notice $nick $left NPC Already Exists $right }
if (!$istok(%NPC.Names,$3,32)) {
createNPC $3 $4
set %NPC.Names $addtok(%NPC.Names,$3,32)
notice $nick $left NPC $3 Stats: $right
notice $nick $left Level:15 $readini(NPC.ini,$3,Lvl) 14|| HP:15 $readini(NPC.ini,$3,HP) $+ 14/15 $readini(NPC.ini,$3,MHP) $right
notice $nick $Left Character Name:15 $readini(NPC.ini,$3,Name) 14|| Attack:15 $readini(NPC.ini,$3,Atk) 14|| Defence:15 $readini(NPC.ini,$3,Def) $right
msg %MainChannel $left NPC Created:15 $3 $right
}
}
if ($2 == Del) && ($3) {
if (!$istok(%NPC.Names,$3,32)) { notice $nick $Left NPC Doesn't Exist $right | halt }
remini NPC.ini $3
set %NPC.Names $remtok(%NPC.Names,$3,32)
notice $nick $Left NPC15 $3 14Deleted $right
msg %Mainchannel $left 15 $+ $3 14Has been Removed from the Game. $right
set %BattleArena $remtok(%BattleArena,4 $+ $3 $+ 15,32)
}
}
alias createNPC {
if (!$1) || (!$2) { halt }
writeini NPC.ini $1 Name $1
writeini NPC.ini $1 Lvl $2
writeini NPC.ini $1 MHP $rand($calc($2 * 10),$calc($2 * 100))
writeini NPC.ini $1 Atk $rand($calc($2 * 5),$calc($2 * 50))
writeini NPC.ini $1 Def $rand($calc($2 * 5),$calc($2 * 50))
timer 1 5 NPCHeal $1
}
alias NPCHeal {
writeini NPC.ini $1 HP $readini(NPC.ini,$1,MHP)
set %BattleArena $addtok(%BattleArena,4 $+ $1 $+ 15,32)
msg %MainChannel $left 15 $+ $1 14Has Entered the Arena $right
}
on *:TEXT:`NPCStats *:%MainChannel:{
msg %MainChannel $left NPC $2 Stats: $right
msg %MainChannel $left Level:15 $readini(NPC.ini,$2,Lvl) 14|| HP:15 $readini(NPC.ini,$2,HP) $+ 14/15 $+ $readini(NPC.ini,$2,MHP) $right
msg %MainChannel $Left Character Name:15 $readini(NPC.ini,$2,Name) 14|| Attack:15 $readini(NPC.ini,$2,Atk) 14|| Defence:15 $readini(NPC.ini,$2,Def) $right
}
alias NPCDeathCheck {
if ($readini(NPC.ini,$1,HP) <= 0) {
set %EXPGained $rand(1,$calc($readini(NPC.ini,$1,Lvl) * 50))
writeini Players.ini $2 EXP $calc($readini(Players.ini,$2,EXP) + %EXPGained)
msg %MainChannel $left 15 $+ $2 $+ 14(15 $+ $readini(Players.ini,$2,Character_Name) $+ 14) has killed15 $1 $right
notice $2 $left You have gained15 %EXPGained 14Experience for killing15 $1 $right
timerHeal $+ $1 1 $calc($readini(NPC.ini,$1,Lvl) * 0.3) NPCHeal $1
levelcheck $2
set %BattleArena $remtok(%BattleArena,4 $+ $1 $+ 15,32)
}
}
is there a way to choose what npcs are fighting? it doesn\'t have a \"fighting\" thing in the NPC.ini, changing the variable won\'t work, and i can\'t find where to set that...
edit: I tested it on my admin account, and all the attacks work except for magic and
fairydust
whenever i tried to use those attacks, it told me that the npc that i directed it at wasn\'t fighting, even though it was in the arena
Im releasing them individually for 3 reasons:
Just out of curiosity, why are you releasing your game in peices that cannot be used as standalones? It seems like it would be a lot more appropriate to release it as a complete addon instead of multiple snippets.
Just wondering.
It looks like youve put a lot of work nto this tho and your code at a glance looks very clean. I especially like how I noticed in one of the other ones that you use aliases as if they were a variable and doing that had never crossed my mind before. That could come in handy.