Conforums Support
Board Enhancements >> Hacks >> Simple RPG Code
http://support.conforums.com/index.cgi?board=code&action=display&num=1155978268

Simple RPG Code
Post by Garet on Aug 19th, 2006, 04:04am

Just a Simple RPG code..............
Includes features such as


Code submitted by Zando

These Attributes are worked out depending on a user's post count. Every 5 levels a user will gain a class Rank. The Class Ranks are

  • Peasent (lvl 0-4)
  • Page (lvl 5-9)
  • Squire (lvl 10-14)
  • Knight (lvl 15-19)
  • Lord (lvl 20-49)
  • Champion (lvl over 50)


    Put this following code in your Main Footers


    <script type="text/javascript">
    <!--

    /*
    Medievil Madness
    Coded By Zando
    http://eldesigns.conforums.com
    Do not repost or redistribute without permission
    */

    var num="50"; // NUMBER OF POSTS BEFORE LVL UP

    var td=document.getElementsByTagName("td")
    for(z=0;z<td.length;z++){
    if(td[z].width=="30%" && td[z].innerHTML.match(/Posts: (\d+)/)){
    var level=RegExp.$1;
    td[z].align="center";
    var lev=Math.floor(level/num)
    td[z].innerHTML+="<font size='1'>Level: "+lev+"<br></font>";
    if(lev<=5){
    td[z].innerHTML+="<font size='1'>Class: Peasent</font>";
    }
    if(lev<=9 && lev>5){
    td[z].innerHTML+="<font size='1'>Class: Page</font>";
    }
    if(lev>9 && lev<=14){
    td[z].innerHTML+="<font size='1'>Class: Squire</font>";
    }
    if(lev>14 && lev<=19){
    td[z].innerHTML+="<font size='1'>Class: Knight</font>";
    }
    if(lev>19 && lev<50){
    td[z].innerHTML+="<font size='1'>Class: Lord</font>";
    }
    if(lev>50){
    td[z].innerHTML+="<font size='1'>Class: Champion</font>";
    }
    td[z].innerHTML+="<font size='1'><br>HP: "+lev*6+"<br>MP: "+lev*5+"<br>ATK: "+Math.floor((lev*5*6)/3)+"<br>DEF: "+Math.floor((lev*5*6)/4)+"</font>";
    }}

    //-->
    </script>





    Put the following code in your Board Footers



    <script type="text/javascript">
    <!--

    /*
    Medievil Madness
    Coded By Zando
    http://eldesigns.conforums.com
    Do not repost or redistribute without permission
    */

    var num="50"; // NUMBER OF POSTS BEFORE LVL UP

    var td=document.getElementsByTagName("td")
    for(z=0;z<td.length;z++){
    if(td[z].width=="20%" && td[z].className.match(/windowbg|windowbg2/) && td[z].vAlign=="top" && td[z].innerHTML.match(/Posts: (\d+)/)){
    var level=RegExp.$1;
    td[z].align="center";
    var lev=Math.floor(level/num)
    td[z].innerHTML+="<font size='1'>Level: "+lev+"<br></font>";
    if(lev<=5){
    td[z].innerHTML+="<font size='1'>Class: Peasent</font>";
    }
    if(lev<=9 && lev>5){
    td[z].innerHTML+="<font size='1'>Class: Page</font>";
    }
    if(lev>9 && lev<=14){
    td[z].innerHTML+="<font size='1'>Class: Squire</font>";
    }
    if(lev>14 && lev<=19){
    td[z].innerHTML+="<font size='1'>Class: Knight</font>";
    }
    if(lev>19 && lev<50){
    td[z].innerHTML+="<font size='1'>Class: Lord</font>";
    }
    if(lev>50){
    td[z].innerHTML+="<font size='1'>Class: Champion</font>";
    }
    td[z].innerHTML+="<font size='1'><br>HP: "+lev*6+"<br>MP: "+lev*5+"<br>ATK: "+Math.floor((lev*5*6)/3)+"<br>DEF: "+Math.floor((lev*5*6)/4)+"</font>";
    }}

    //-->
    </script>




    Where it has the number 50, that is the number of posts require before someone levels up. So at the moment every 50 posts you will level up.

    Make sure you have the same number in both codes....

    Enjoy