MegaRPG NPC Module

By LucSatise on Jul 23, 2008

This is the NPC Module for MegaRPG.

Use With MegaRPG Base Code v2.0 and Rank Module v2.0

Making NPC's:

  • Load This Script into Bot
  • Replace 2 Parts of Base Code and Ranks Module
  • In Bot Window type: /auser 500
  • To Save from Readini Problem Please Also type in bot window: /writeini Admins.ini Admin Yes

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)
  }
}

Comments

Sign in to comment.
LucSatise   -  Aug 11, 2008

yeh because ive added the NPC\'s and admin as colours in the `Entered, You have to replace the base code with what is on the base code list =]

 Respond  
Nuk3d   -  Aug 10, 2008

i looked at mine and it had a extra line for magic
if ($readini(Players.ini,$2,Fighting) != Yes) { notice $nick $Left $2 is not Fighting. Try !entered $Right | halt }

 Respond  
Eugenio   -  Aug 09, 2008

cool beanz coz its abit weird having 5+ snippets all for one code, and I think the max amount of lines allowed for a snippet is 1500 so obv. all these snippets combined are more than that therefore I think you should zip it up and shove it in the addon section.
`-.-´

 Respond  
LucSatise   -  Aug 09, 2008

@Eugenio: That means u gotta wait till like all the modules are done. I prob will once i actually stop doing MegaRPG ;p

@EL Um yeh i\'l do it when i get a chance. im a bit busy getting ready to go on holiday and stuff just now so it might have to wait at least a week.

 Respond  
EL   -  Aug 08, 2008

Y0 you gunna me the npc fighting module LuC?.`-.-´

 Respond  
Eugenio   -  Aug 08, 2008

imo you should put these in a zip and make this an addon =/
all the diff snippets you uploaded for one code.

`-.-´

 Respond  
Nuk3d   -  Aug 08, 2008

i also just got that too lol

 Respond  
Sacred   -  Aug 06, 2008

Alright, I appreciate it. Great job btw, lol.

 Respond  
LucSatise   -  Aug 05, 2008

:/ sheesh hold i\'l redo the base code cos its only tht tht has those attacks

 Respond  
Sacred   -  Aug 05, 2008

Using the latest basecode and all the latest modules I get that problem, though.

 Respond  
LucSatise   -  Aug 05, 2008

keep up that got done ages ago -.-

 Respond  
Sacred   -  Aug 04, 2008

Would you mind fixing the \"NPC is not fighting\" thing with magic and fairydust?

 Respond  
LucSatise   -  Jul 30, 2008

hmm Yeh i found tht bug im updating the base code Now.

 Respond  
Wizjany   -  Jul 26, 2008

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 andfairydust
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

 Respond  
LucSatise   -  Jul 25, 2008

Update: Edited how long each different NPC takes to revive (now depends on level)

 Respond  
LucSatise   -  Jul 23, 2008

Im releasing them individually for 3 reasons:

  1. The code if they were put together is too big and difficult to manage
  2. When editing its easy to find different parts
  3. Users dont HAVE to use the modules (even tho base code is upgraded for them if they request and pm me i will send them unedited base code)
 Respond  
Typo   -  Jul 23, 2008

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.

 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.