Junior Spellweaver
- Joined
- Aug 12, 2006
- Messages
- 115
- Reaction score
- 2
BEFORE YOU ADD THIS INTO YOUR SOURCE , PLEASE MAKE A BACKUP !!
Put this into your rs2e foldar
Open main.java
under
Add
Open GameEngine.java add
under
Add
under
Add
Under
Add
replace ur public gameengine with this *cba doing add under **** lol*
Add
replace ur
With
Add
add
go into the Players foldar open player.java add
add under
this
under
add this
open
PlayerInstance.java
add
Now add this to strem.java , in Util folder
just before the last ' } '
And into your build.cmd
add this
you might need to change the last number of jdk1.6.0_06 to the one that your jdk version is.
Now add this in your data foldar
And here is what Ian... , from Rune-Server , the creator of this tutorial got as a result
Put this into your rs2e foldar
To view the content, you need to sign in or register
Open main.java
under
Code:
m.ge = new GameEngine();
Add
Code:
m.ge.load();
Open GameEngine.java add
Code:
import RS2E.NPCs.*;
under
Code:
public class GameEngine
{
Add
Code:
public int maxNPCs = 150;
public int maxListedNPCs = 7000;
under
Code:
public Player[] players;
Add
Code:
public NPC[] npcs;
public NPCList[] npcLists;
Under
Code:
public Items item;
Add
Code:
public NPCMovement moveN;
public NPCUpdate updateN;
replace ur public gameengine with this *cba doing add under **** lol*
Code:
public GameEngine()
{
players = new Player[maxPlayers];
npcs = new NPC[maxNPCs];
npcLists = new NPCList[maxListedNPCs];
globalStream = new Stream(new byte[15000]);
pkt = new Packet();
frame = new Frames();
moveP = new PlayerMovement();
updateP = new PlayerUpdate();
mapData = new MapData();
moveN = new NPCMovement();
updateN = new NPCUpdate();
}
Add
Code:
public void load()
{
LoadNPCLists lnl = new LoadNPCLists();
lnl = null;
}
replace ur
Code:
public void process()
With
Code:
public void process()
{
if(item == null)
{
item = new Items();
}
long processTime = 0;
if(System.currentTimeMillis() - lastEntityUpdate >= 600)
{
for(Player p : players)
{
if(p == null)
{
continue;
}
else if(p.disconnected[0] && p.disconnected[1])
{
removePlayer(p);
continue;
}
p.process();
if(p.isOnline)
{
moveP.getNextPlayerMovement(p);
}
}
long updateTime = System.currentTimeMillis();
for(Player p : players)
{
if(p != null && p.isOnline && !p.disconnected[0] && !p.disconnected[1])
{
updateP.update(p);
p.lastUpdate = updateTime;
}
}
for(Player p : players)
{
if(p != null)
{
if(p.isOnline)
{
updateP.clearUpdateFlags(p);
}
}
}
for(NPC n : npcs)
{
if(n != null && updateN != null)
{
updateN.clearUpdateFlags(n);
n.process();
if(!n.isDead)
{
if(n.randomWalk && !n.isUnderPlayerAttack)
{
moveN.randomWalk(n);
}
}
else
{
if(!n.deadEmoteDone)
{
n.requestAnim(NPCAttack.getDeathAnimation(n.npcType), 0);
n.deadEmoteDone = true;
n.combatDelay = 3;
}
else if(n.deadEmoteDone && !n.hiddenNPC && n.combatDelay <= 0)
{
n.hiddenNPC = true;
}
else if(n.hiddenNPC && n.respawnDelay <= 0)
{
if(n.needsRespawn)
{
newNPC(n.npcType, n.makeX, n.makeY, n.heightLevel, n.moveRangeX1, n.moveRangeY1,
n.moveRangeX2, n.moveRangeY2, true);
Main.m.log("New NPC");
}
npcs[n.npcIndex] = null;
rebuildNPCs();
}
}
}
}
lastEntityUpdate = System.currentTimeMillis();
}
}
Add
Code:
private void removePlayer(Player p)
{
if(p != null)
{
int index = p.playerIndex;
players[index].destruct();
players[index] = null;
}
}
public void rebuildNPCs()
{
for(Player p : players)
{
if(p != null)
{
p.rebuildNPCList = true;
}
}
}
add
Code:
public int newNPC(int type, int absX, int absY, int height, int mRX1, int mRY1, int mRX2, int mRY2, boolean needsRespawn)
{
int index = -1;
for(int i = 1; i < maxNPCs; i++)
{
if(npcs[i] == null)
{
index = i;
break;
}
}
if(index == -1)
{
Main.m.log("Max number of NPCs spawned");
return -1;
}
NPC n = npcs[index] = new NPC(type, index);
n.absX = absX;
n.absY = absY;
n.makeX = absX;
n.makeY = absY;
n.heightLevel = height;
n.moveRangeX1 = mRX1;
n.moveRangeY1 = mRY1;
n.moveRangeX2 = mRX2;
n.moveRangeY2 = mRY2;
n.needsRespawn = needsRespawn;
NPCList nl = npcLists[type];
if(nl != null)
{
n.name = nl.getName();
n.combatLevel = nl.getCb();
n.maxHP = nl.getHP();
n.currentHP = n.maxHP;
n.maxHit = nl.getMaxHit();
n.atkType = nl.getAtk();
n.weakness = nl.getWeakness();
n.respawnDelay = nl.getSpawnTime();
}
return index;
}
public String getNPCName(int npcType)
{
if(npcType > maxListedNPCs)
{
return new String("NPCType = " + npcType);
}
else if(npcLists[npcType] != null)
{
return npcLists[npcType].getName();
}
else
{
return new String("NPCType = " + npcType);
}
}
go into the Players foldar open player.java add
Code:
import RS2E.NPCs.*;
add under
Code:
public void destruct()
{
teleportToX = teleportToY = absX = absY = 0;
playerListSize = 0;
this
Code:
npcListSize = 0;
Code:
playerList = null;
add this
Code:
npcList = null;
npcInListBitmap = null;
open
PlayerInstance.java
add
Code:
import RS2E.NPCs.*;
Code:
public NPC[] npcList;
public byte[] npcInListBitmap;
public boolean rebuildNPCList = false;
public int npcListSize = 0;
Now add this to strem.java , in Util folder
just before the last ' } '
Code:
public void resetOffset()
{
currentOffset = 0;
}
And into your build.cmd
add this
Code:
@echo ------------ Compiling NPC's ------------
"C:\Program Files\Java\jdk1.6.0_06\bin\javac.exe" ./RS2E/NPCs/*.java
you might need to change the last number of jdk1.6.0_06 to the one that your jdk version is.
Now add this in your data foldar
To view the content, you need to sign in or register
And here is what Ian... , from Rune-Server , the creator of this tutorial got as a result
![NaikBoi - [TUT 503] 40% NPC Spawn - RaGEZONE Forums NaikBoi - [TUT 503] 40% NPC Spawn - RaGEZONE Forums](https://forum.ragezone.com/images/404_image.png)