Hi guys, i've searched and searched for a way to spawn a mob from a NPC and couldent find anything on any of the forums, i finaly figured it out after much trial and error, and now im going to release it to make it easier for other people learning to code, this was designed for 5165, NewestCoServer, mabey there are better ways to code it but i dont give a shit this is my way so if you dont like it you can (....) yeh lol :)
This was made for the 2nd reborn quest, but mine is custom made.
Step: 1 Go to NPCDialog and add this.
Step: 2 Go to OldCODB and make a folder called SpecialMap
Step: 3 Create 2 new txt documents 1 called MapMobInfo1 and another called MapSpawn1
Step: 4 Open MapMobInfo1 and add this:
Step: 5 Open MapSpawn1 and add this:
And for the NPC go to OldCODB/NPCs.txt and add this:
F5 Debug
, You need Moss, DreamGrass, and SoulAroma to summon the hill spirit.
Press thanks if i helped.
This was made for the 2nd reborn quest, but mine is custom made.
Step: 1 Go to NPCDialog and add this.
Code:
#region EARTHSEAL
case 3005:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Would you like to summon the HillSpirit"));
GC.AddSend(Packets.NPCLink("Yes Please.", 1));
GC.AddSend(Packets.NPCLink("No i dont have the items.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 1)
{
if (GC.MyChar.InventoryContains(722723, 1) && GC.MyChar.InventoryContains(722724, 1) && GC.MyChar.InventoryContains(722725, 1))
{
GC.MyChar.RemoveItem(GC.MyChar.NextItem(722723));
GC.MyChar.RemoveItem(GC.MyChar.NextItem(722724));
GC.MyChar.RemoveItem(GC.MyChar.NextItem(722725));
{
[COLOR="Red"] string[] FMobs = File.ReadAllLines(@"D:\OldCODB\SpecialMap\MapMobInfo1.txt");
Hashtable Mobs = new Hashtable(FMobs.Length);
for (int i = 0; i < FMobs.Length; i++)
{
if (FMobs[i][0] != '*')
{
Game.Mob M = new NewestCOServer.Game.Mob(FMobs[i]);
Mobs.Add(M.MobID, M);
}
}
string[] FSpawns = File.ReadAllLines(@"D:\OldCODB\SpecialMap\MapSpawn1.txt");
foreach (string Spawn in FSpawns)
{
if (Spawn[0] == '*') return;
string[] SpawnInfo = Spawn.Split(' ');
int MobID = int.Parse(SpawnInfo[0]);
int Count = int.Parse(SpawnInfo[1]);
ushort Map = ushort.Parse(SpawnInfo[2]);
ushort XFrom = ushort.Parse(SpawnInfo[3]);
ushort YFrom = ushort.Parse(SpawnInfo[4]);
ushort XTo = ushort.Parse(SpawnInfo[5]);
ushort YTo = ushort.Parse(SpawnInfo[6]);
if (!Game.World.H_Mobs.Contains(Map))
Game.World.H_Mobs.Add(Map, new Hashtable());
Hashtable MapMobs = (Hashtable)Game.World.H_Mobs[Map];
DMap D = (DMap)DMaps.H_DMaps[Map];
for (int i = 0; i < Count; i++)
{
Game.Mob _Mob = new NewestCOServer.Game.Mob((Game.Mob)Mobs[MobID]);
_Mob.Loc = new NewestCOServer.Game.Location();
_Mob.Loc.Map = Map;
_Mob.Loc.X = (ushort)Program.Rnd.Next(Math.Min(XFrom, XTo), Math.Max(XFrom, XTo));
_Mob.Loc.Y = (ushort)Program.Rnd.Next(Math.Min(YFrom, YTo), Math.Max(YFrom, YTo));
_Mob.StartLoc = _Mob.Loc;
_Mob.EntityID = (uint)Program.Rnd.Next(400000, 500000);
MapMobs.Add(_Mob.EntityID, _Mob);[/COLOR] }
}
}
}
else
{
GC.AddSend(Packets.NPCSay("Sorry you dont have Moss, DreamGrass and SoulAroma"));
GC.AddSend(Packets.NPCLink("I will get them.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
break;
}
#endregion
Step: 3 Create 2 new txt documents 1 called MapMobInfo1 and another called MapSpawn1
Step: 4 Open MapMobInfo1 and add this:
Code:
220 HillSpirit 1 153 50 10000 500 85 0 250 750 10 100 2 True 6 10000 50000 1500 90000 True
Code:
220 1 1700 442 886 435 886
Code:
3005 2210 2 0 1700 444 878
Code:
/tele 1700 444 878
Press thanks if i helped.