Wednesday, 2025-07-23, 8:39 AM

Welcome Nomad | RSS
Liamigo Online Entertainment
MainRegistrationLogin
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Liam's Pets
LiamigoDate: Saturday, 2009-02-28, 7:53 AM | Message # 1
Creator Of Dynastyscape
Group: Administrators
Messages: 421
Reputation: 12
Status: Offline
AHMG to big to fit into one post!

Liam's Pets Tutorial

LIAMS BUGFIXES SOLD SEPERATELY. (Free of charge when liams energy bar is full)

Server Base: Dynastyscape
Base that you'll be able to get: Devolution V7, Uber Server 3, Devolution V1 -6, Cheezscape (Already Has most), Project 16 (Already has full I think)
Difficulty: 8 - Ill post the Liamigo Tutorial Difficulty Index Shortly
Required Knowledge: Ints, Booleans, Java (IF you dont know what that is, go die in a hole), Playertokens, Voids, Ctrl+C and Ctrl+V, Ctrl+F, Basic Typing Skills, Sight, Touch and Smell if you screw up that bad your computer kamikazes.
Credits: The real RSPS god, Xero(Xerocheez) for most of this, Me for bugfixes and posting this after 2005.
Leechers: Will be castrated with a Dog Collar.

OK, The actual tutorial:

MAKE BACKUPS IF YOU ARENT CONFIDENT

Step 1: Adding Following

Lets open NPChandler.java Search for: 'Summon'
Along with some old codes by Xero, you should find this:

Code
public void newSummonedNPC(int npcType, int x, int y, int heightLevel,
    int rangex1, int rangey1, int rangex2, int rangey2,
    int WalkingType, int HP, boolean Respawns, int summonedBy) {
   // first, search for a free slot
   int slot = -1;
   for (int i = 1; i < maxNPCSpawns; i++) {
    if (npcs[i] == null) {
     slot = i;
     break;
    }
   }

   if (slot == -1)
    return; // no free slot found
   if (HP <= 0) { // This will cause client crashes if we don't
    // use this <img src="http://s102.ucoz.net/sm/1/smile.gif" border="0" align="absmiddle" alt="smile"> - xero
    HP = 100;
   }
   NPC newNPC = new NPC(slot, npcType);
   newNPC.absX = x;
   newNPC.absY = y;
   newNPC.makeX = x;
   newNPC.makeY = y;
   newNPC.moverangeX1 = rangex1;
   newNPC.moverangeY1 = rangey1;
   newNPC.moverangeX2 = rangex2;
   newNPC.moverangeY2 = rangey2;
   newNPC.walkingType = WalkingType;
   newNPC.HP = HP;
   newNPC.MaxHP = HP;
   newNPC.MaxHit = (int) Math.floor((HP / 10));
   if (newNPC.MaxHit < 1) {
    newNPC.MaxHit = 1;
   }
   newNPC.heightLevel = heightLevel;
   newNPC.Respawns = Respawns;
   newNPC.followPlayer = summonedBy;
   newNPC.followingPlayer = true;
   npcs[slot] = newNPC;
  }

If you cant, add it within your other voids einstein then continue. If you do have this (ALREADY IN YOUR SOURCE), close npchandler.java and skip to step 2.

Still in Npchandler.java, add this below the above.

CONTINUED...


 
LiamigoDate: Saturday, 2009-02-28, 7:53 AM | Message # 2
Creator Of Dynastyscape
Group: Administrators
Messages: 421
Reputation: 12
Status: Offline
Code
    public void FollowPlayer(int NPCID) {
    int follow = npcs[NPCID].followPlayer;
    int playerX = server.playerHandler.players[follow].absX;
    int playerY = server.playerHandler.players[follow].absY;
    npcs[NPCID].RandomWalk = false;
    if ((server.playerHandler.players[follow] != null)
      && (npcs[NPCID].effects[0] == 0)) {
     if (playerY < npcs[NPCID].absY) {
      npcs[NPCID].moveX = GetMove(npcs[NPCID].absX, playerX);
      npcs[NPCID].moveY = GetMove(npcs[NPCID].absY, playerY + 1);
     } else if (playerY > npcs[NPCID].absY) {
      npcs[NPCID].moveX = GetMove(npcs[NPCID].absX, playerX);
      npcs[NPCID].moveY = GetMove(npcs[NPCID].absY, playerY - 1);
     } else if (playerX < npcs[NPCID].absX) {
      npcs[NPCID].moveX = GetMove(npcs[NPCID].absX, playerX + 1);
      npcs[NPCID].moveY = GetMove(npcs[NPCID].absY, playerY);
     } else if (playerX > npcs[NPCID].absX) {
      npcs[NPCID].moveX = GetMove(npcs[NPCID].absX, playerX - 1);
      npcs[NPCID].moveY = GetMove(npcs[NPCID].absY, playerY);
     }
     npcs[NPCID].getNextNPCMovement();
     npcs[NPCID].updateRequired = true;
    }
   }

Now search for boolean process. For the retards of the group, boolean process is where ints and others need to be updated every halfsecond. For instance, In Dynastyscape, the wilderness levels are under boolean process because they need to be updated everytime you move. Anyways...

Add this with your other ints under boolean process

public int GetMove(int Place1, int Place2) { // Thanks to diablo for this! - Go Xero...
// Fixed my npc follow code <3
if ((Place1 - Place2) == 0)
return 0;
else if ((Place1 - Place2) < 0)
return 1;
else if ((Place1 - Place2) > 0)
return -1;
return 0;
}

Great! Now close it and save it if your following this tutorial and you want to save what youve done so far...

CONTINUED...


 
LiamigoDate: Saturday, 2009-02-28, 7:59 AM | Message # 3
Creator Of Dynastyscape
Group: Administrators
Messages: 421
Reputation: 12
Status: Offline
Step 2: Liams Spawning Tester

This goes with your voids.

Code
  /*PETS - LIAMIGO*/
   public void SpawnPet(int ID) {
     server.npcHandler.newSummonedNPC(ID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(ID), false, playerId);
   }
   /* END PETS - LIAMIGO*/

Now lets make a command to test your spawning.

if (command.equalsIgnoreCase("spawnmehcat") && (playerRights > 2)) {
spawnPet(774);
dS("Ahmg! Liam spawned meh a pet! Tankyah vewy mucha!"); //This is sendMessage for you guys
}

Save, Compile, Run.

Errors - post.

What this does:

Makes a npc of your choice (Defined in spawnpet) (Ie. for noobs spawnPet(NPCID); ) follow you.
From there you can add your own bugfixes, which I am not adding at the moment.
You can create your own ways of getting cats, be warned, duplicate cats are a problem with my bugfix. But thats for you guys to explore.

Post or refer to Leechers above.

Regards,

Liam


 
BlackhawkeDate: Saturday, 2009-02-28, 3:54 PM | Message # 4
Earl
Group: Moderators
Messages: 310
Reputation: 1
Status: Offline
Thanks So Much ! biggrin This Really Helped

 
absolutezeroDate: Sunday, 2009-03-01, 1:50 PM | Message # 5
Adventurer
Group: Users
Messages: 42
Reputation: 0
Status: Offline
Thank you! biggrin biggrin

- cool absolutezero cool -



Party people!
 
  • Page 1 of 1
  • 1
Search:


Copyright Liamigo Online Entertainment © 2025Make a free website with uCoz