Newbie Spellweaver
- Joined
- Apr 16, 2008
- Messages
- 11
- Reaction score
- 0
Not really sure if this had been released yet, but I managed to figure out how to make NPCs spawn Mobs.
Im using TitanMS ver009b
SHOULD work on other TitanMS Revs too!
By the way this spawns a MOB or MOBS on the Character's Pos.
EDIT: I Figured out how to spawn MOB or MOBS on a Specific Pos. too.
Hope I helped by contributing this.
Files to be Edited: NPCs.cpp & NPCs.h
Firstly, Open & add this to the top of NPCs.cpp, IF not already there :
Secondly, search for :
Thirdly, add this UNDER it then Save :
Fourthly, Open NPCs.h then search for :
Fifthly, add this UNDER it :
DONE~!
Example of how to Script NPCs to spawn mobs :
To Figure out X and Y in the NPC code. IN GAME, go to the map that the NPC is in and type " !pos " and you should get something like...
Use the X and Y for the "x, y" in the NPC code to spawn the mob there!
Example:
I ENTIRELY figured out this by myself.
Credits to Me.
Im using TitanMS ver009b
SHOULD work on other TitanMS Revs too!
By the way this spawns a MOB or MOBS on the Character's Pos.
EDIT: I Figured out how to spawn MOB or MOBS on a Specific Pos. too.
Hope I helped by contributing this.
Files to be Edited: NPCs.cpp & NPCs.h
Firstly, Open & add this to the top of NPCs.cpp, IF not already there :
Code:
#include "Mobs.h"
Secondly, search for :
Code:
void [B]NPC[/B]::sendStyle(int [B]styles[/B][], char [B]size[/B]){
[B]Packet[/B] [B]packet[/B] = npcPacket(7);
packet.addByte(size);
for(int i=0; i<size; i++)
packet.addInt(styles[i]);
packet.packetSend(player);
}
Code:
void [B]NPC[/B]::spawnMob(int [B]mobid[/B]){
if(Mobs::mobinfo.find(mobid) != Mobs::mobinfo.end())
Mobs::spawnMob(player, mobid);
}
void NPC::spawnMobPos(int mobid, int xx, int yy){
if(Mobs::mobinfo.find(mobid) != Mobs::mobinfo.end())
Mobs::spawnMobPos(player, mobid, xx, yy);
}
Code:
void teleport(int [B]mapid[/B]);
Fifthly, add this UNDER it :
Code:
void spawnMob(int [B]mobid[/B]);
void spawnMobPos(int [B]mobid[/B], int xx, int yy);
Example of how to Script NPCs to spawn mobs :
Code:
void NPCsScripts::npc_[I][B]NPC[/B][/I] [I][B]ID HERE[/B][/I](NPC* npc){
int state = npc->getState();
if(state == 0){
npc->addText("I will now Spawn a [B]Mob[/B].");
npc->sendOK();
npc->end();
npc->spawnMob([I][B]MOB[/B] [B]ID HERE[/B][/I]);
[I][B][U]OR[/U][/B][/I]
npc->spawnMobPos([I][B]MOB[/B] [B]ID[/B][/I], [B][I]x[/I][/B], [B][I]y[/I][/B]);
}
}
Code:
[Notice] X: 596 Y: 100
Example:
The MobID "9300003" is "King Slime (PC)"
Code:
npc->spawnMobPos([I][B]9300003[/B][/I], [B][I]596[/I][/B], [B][I]0[/I][/B]);
Credits to Me.
Last edited: