Elite PK Private Server
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Elite PK Private Server

Pking at its finest
 
HomeHome  Play NowPlay Now  DonateDonate  PortalPortal  Latest imagesLatest images  RegisterRegister  Log inLog in  

 

 Coding Forum

Go down 
4 posters
AuthorMessage
Holy One




Posts : 3
Points : 0
Join date : 2008-05-02
Age : 30
Location : Grays, England

Coding Forum Empty
PostSubject: Coding Forum   Coding Forum Icon_minitimeSat May 03, 2008 8:59 am

may i suggest to make a coding forum so coders can place som of there work? then i can have a place to put my stuff to help the server... anyway guv..


i made this a while ago and it was supossed to be a minigame but i didn't finish it so ill paste it here and you can sort through and reorder/change elements to make it work:

go for easiest first..

open up autospawn.cfg and add this line:

Code:
spawn = 200   ####   ####   0   0   0   0   0   1   clanwar guy

basiclly change the first #### to x co-ord and 2nd #### to y co-ord of the guy who will send you to area..

save and close autospawn.cfg

under moo in npchandler:


Code:
if (npcs[i].npcType == 200) {
if (misc.random2(30) <= 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "Calling for true fighters! talk to me to test your courage!!";
}
}


in item3.java add:

Code:
public static int clanwars[] = {##########};

    public static int randomclanwars()
    {
       return clanwars[(int)(Math.random()*clanwars.length)];
    }

in the #### area add the ids of the rewards you want clanwars to give, e.g:

Code:
public static int clanwars[] = {995, 4151, 995, 4154};

    public static int randomclanwars()
    {
       return clanwars[(int)(Math.random()*clanwars.length)];
    }


client shit:

search for:

Code:
   //Attacking in wilderness

repleace it with this:

Code:
   //Attacking in wilderness
      if (IsAttacking == true && IsDead == false && clanwarfight !=1) {
         if (PlayerHandler.players[AttackingOn] != null) {
            if (PlayerHandler.players[AttackingOn].IsDead == false) {
if(PlayerHandler.players[AttackingOn].playerEquipment[playerCape] == 4514 && playerEquipment[playerCape] == 4514) {
sendMessage("You can't attack you're own team!");
IsAttacking = false;
}
 else {
               Attack();
}
            } else {
               ResetAttack();
            }
         } else {
            ResetAttack();
         }
      }
      



   //Attacking in wilderness
      if (IsAttacking == true && IsDead == false && clanwarfight == 1) {
         if (PlayerHandler.players[AttackingOn] != null) {
            if (PlayerHandler.players[AttackingOn].IsDead == false) {
if(PlayerHandler.players[AttackingOn].playerEquipment[playerCape] == 4514 && playerEquipment[playerCape] == 4514) {
sendMessage("You can't attack you're own team!");
IsAttacking = false;
}
 else {
               Attack();
}
            } else {
               ResetAttack();
               clanwarvic();
            }
         } else {
            ResetAttack();
         }
      }

      if (IsDead == true && NewHP <= 1 && clanwars == 1) {
         ApplyDeadClanwars(playerId);
      }

this bit needs tweaking depending if you have dueling or other minigames.

the cape bit in the coding simple means if your wearing one cape the person who wears the same cape as you, you cant fight each other. to add more capes simple just add this line with the cape ids added:

Code:
 || PlayerHandler.players[AttackingOn].playerEquipment[playerCape] == #### && playerEquipment[playerCape] == ####  ||

THINK YOU HAVE THIS BIT ALREADY!!


search case 200: if dont got just change case or summint:


Code:
     case 200: //Lord daquarius
      sendFrame171(1, 2465);
            sendFrame171(0, 2468);
            sendFrame126("What team do you want to be on in clan wars?", 2460);
            sendFrame126("Zamorak", 2461);
            sendFrame126("Saradomin", 2462);
            sendFrame164(2459);
            NpcDialogueSend = true;
            break;

if you do have it, replace the autospawn.cfg id with something else and use that id with the case, e.g case 1536:

add above public void:

Code:

        public void clanwarvic() {
      teleportToX = xxxx;
      teleportToY = xxxx;
      sendMessage("You Were clearly the best lol !");
      addItem(432, 1);
      frame1();
      updateRequired = true;
      appearanceUpdateRequired = true;
                NewHP = getLevelForXP(playerXP[3]);
                setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
                playerLevel[3] = getLevelForXP(playerXP[3]);
                didTeleport = true;
        pkpoints += 1;
        }
                  public boolean ApplyDeadClanwars() {
      if (IsDeadTimer == false) {
         actionAmount++;
         actionTimer = 0;
         ResetAttack();
         ResetAttackNPC();
         pEmote = 0x900;
         IsDeadTimer = true;
                        ApplyDeadClanwars();
      }
   if (actionTimer == 0 && IsDeadTimer == true) {
         teleportToX = xxxx;
         teleportToY = xxxx;
         heightLevel = 0;
         IsDeadTeleporting = true;
         frame1();
         updateRequired = true;
         appearanceUpdateRequired = true;
                        NewHP = getLevelForXP(playerXP[3]);
                        setSkillLevel(3, getLevelForXP(playerXP[3]), playerXP[playerHitpoints]);
                        playerLevel[3] = getLevelForXP(playerXP[3]);
                    clanfunfight = 0;
                        PoisonDelay = 9999999;
                        KillerId = playerId;
                        sendMessage("The fight is over!");
      }
}
      return true;

public void clanwarchest()
{
      sendMessage("You have opened the chest!");
      deleteItem(432,getItemSlot(432),1);
      addItem(995, 2500000);
      addItem(Item3.randomclanwars(), 1);
}

find the itemused with stuff and add this crap:

Code:

else if(useItemID == 432 && (atObjectID == 6448))
{
clanwarchest();
}
else {
sendMessage("You need a crystal key to open this chest!
}


declare this:

Code:
public int clanwarfight = 0;

under case 9157:

Code:
if (NpcDialogue == 200) {
if (playerEquipment[playerHat] == -1 || playerEquipment[playerCape] == -1)
{
telex = xxxx + misc.random(5);
teley = xxxx + misc.random(4);
clanwarfight = 1;
playerEquipment[playerHat]=4515;
playerEquipment[playerCape]=4516;
sendMessage("You are fighting for Zamorak!!");
newheightLevel = 0;
NpcDialogue = 0;
NpcDialogueSend = false;
}
else
{
sendMessage("You cannot wear a cape and/or a hat while playing Clan Wars");
newheightLevel = 0;
NpcDialogue = 0;
NpcDialogueSend = false;
}
}


under case 9158:

Code:
if (NpcDialogue == 200) {
if (playerEquipment[playerHat] == -1 || playerEquipment[playerCape] == -1)
{
telex = xxxx + misc.random(5);
teley = xxxx + misc.random(4);
clanwarfight = 1;
playerEquipment[playerHat]=4513;
playerEquipment[playerCape]=4514;
sendMessage("You are fighting for Saradomin");
newheightLevel = 0;
NpcDialogue = 0;
NpcDialogueSend = false;
}
else
{
sendMessage("You cannot wear a cape and/or a hat while playing ClanWars!");
newheightLevel = 0;
NpcDialogue = 0;
NpcDialogueSend = false;
break;
}
}
Back to top Go down
Guvnor
Admin
Admin
Guvnor


Posts : 19
Points : 0
Join date : 2008-04-24
Age : 33
Location : England

Coding Forum Empty
PostSubject: Re: Coding Forum   Coding Forum Icon_minitimeSat May 03, 2008 10:38 am

This just like castle wars or something?
Back to top Go down
http://www.elite-pk.co.nr
Holy One




Posts : 3
Points : 0
Join date : 2008-05-02
Age : 30
Location : Grays, England

Coding Forum Empty
PostSubject: Re: Coding Forum   Coding Forum Icon_minitimeSat May 03, 2008 10:41 am

sort of yeah, and ty for section
Back to top Go down
I Pker I
In-Game Admin
In-Game Admin
I Pker I


Posts : 13
Points : -7
Join date : 2008-04-24
Age : 30
Location : USA

Coding Forum Empty
PostSubject: Re: Coding Forum   Coding Forum Icon_minitimeThu May 15, 2008 5:10 pm

Mm pretty complicated if you ask me.

~I Pker I~
Back to top Go down
I Fiyr
Admin
Admin



Posts : 21
Points : 5
Join date : 2008-04-24
Age : 30

Coding Forum Empty
PostSubject: Re: Coding Forum   Coding Forum Icon_minitimeThu May 15, 2008 5:43 pm

Well it is an entire minigame, if it weren't complicated it would be... well, for Castlewars probably junk.
Back to top Go down
Sponsored content





Coding Forum Empty
PostSubject: Re: Coding Forum   Coding Forum Icon_minitime

Back to top Go down
 
Coding Forum
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Elite PK Private Server :: Runescape Development :: Tutorials-
Jump to: