Hello, this is my first major tutorial, i decided to make one because i want to get noticed, that and a Tamer class sucks with only one summon, lol. And yes, I am leaving out a few other features i added to my version, got to keep some stuff for my self. Discription: Use a summoning item to summon the matching NPC: monsters, quest givers, mercenaries, ANYTHING. they are also treated as consumables, they disapear after use. (this is now optional to remove) you CAN take pets from map to map with you. (edited back in) **Prerequired Tutorial**http://www.touchofdeathforums.com/smf/index.php/topic,69521.0.html * Credit to Lightning for the base I used **Translated In German by EisKeks, Under "Abschnitt 2"** http://www.touchofdeathforums.com/smf/index.php/topic,71065.new.html * GERMAN VERSION IS NOT COMPATIBLE WITH THE NEW PET SYSTEM VERSION * * * MY TUTORIAL **BOTH SERVER AND CLIENT** In modConstants Find: ' Item constants Add Public Const ITEM_TYPE_SUMMON As Byte = # (the next number on the list) example ``` ' Item constants Public Const ITEM_TYPE_NONE As Byte = 0 Public Const ITEM_TYPE_WEAPON As Byte = 1 Public Const ITEM_TYPE_ARMOR As Byte = 2 Public Const ITEM_TYPE_HELMET As Byte = 3 Public Const ITEM_TYPE_SHIELD As Byte = 4 Public Const ITEM_TYPE_CONSUME As Byte = 5 Public Const ITEM_TYPE_KEY As Byte = 6 Public Const ITEM_TYPE_CURRENCY As Byte = 7 Public Const ITEM_TYPE_SPELL As Byte = 8 Public Const ITEM_TYPE_SUMMON As Byte = 9 ``` This declairs the new item type * * * **SERVER SIDE** Befor we start we need to delete a some thing that will conflict with my new way of doing things Because these wont fit the new spawn pet parameters sadly they must go, if it calls spawn pet, we have to kill it in modHandleData and look for "Public Sub InitMessages()". Delete: ``` HandleDataSub(CSpawnPet) = GetAddress(AddressOf HandleSpawnPet) ``` and in the same mod find Public Sub HandleSpawnPet and delete ``` Public Sub HandleSpawnPet(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) SpawnPet Index, GetPlayerMap(Index) End Sub ``` In modPlayer Find: 'switch maps Find: ``` SpawnPet index, MapNum ```Replace with: ``` SpawnPet index, MapNum, Trim$(Player(index).Pet.SpriteNum) ``` WOOT!!! I got the pet to follow you to diffrent maps! In modGameLogic Find the Sub SpawnPet and replace with: ``` Sub SpawnPet(ByVal index As Long, ByVal mapNum As Long, npcNum As Long) Dim PlayerMap As Long Dim i As Integer Dim PetSlot As Byte 'Prevent multiple pets for the same owner If TempPlayer(index).TempPetSlot > 0 Then Exit Sub PlayerMap = GetPlayerMap(index) PetSlot = 0 For i = 1 To MAX_MAP_NPCS 'If Map(PlayerMap).Npc(i) = 0 Then If MapNpc(PlayerMap).NPC(i).SpawnWait = 0 And MapNpc(PlayerMap).NPC(i).Num = 0 Then PetSlot = i Exit For End If Next If PetSlot = 0 Then Call GiveInvItem(index, npcNum, 0) Call PlayerMsg(index, "The map is too crowded for you to call on your pet!", Red) Exit Sub End If 'create the pet for the map Map(PlayerMap).NPC(PetSlot) = npcNum MapNpc(PlayerMap).NPC(PetSlot).Num = npcNum 'set its Pet Data MapNpc(PlayerMap).NPC(PetSlot).IsPet = YES MapNpc(PlayerMap).NPC(PetSlot).PetData.Name = GetPlayerName(index) & "'s " & NPC(npcNum).Name MapNpc(PlayerMap).NPC(PetSlot).PetData.Owner = index 'If Pet doesn't exist with player, link it to the player If Player(index).Pet.SpriteNum npcNum Then Player(index).Pet.SpriteNum = npcNum Player(index).Pet.Name = GetPlayerName(index) & "'s " & NPC(npcNum).Name End If TempPlayer(index).TempPetSlot = PetSlot 'cache the map for sending Call MapCache_Create(PlayerMap) 'Cache the Pets for players logging on [Add new Number to array] PetMapCache(PlayerMap).UpperBound = PetMapCache(PlayerMap).UpperBound + 1 PetMapCache(PlayerMap).Pet(PetMapCache(PlayerMap).UpperBound) = PetSlot If PetMapCache(Player(index).Map).UpperBound > 0 Then For i = 1 To PetMapCache(Player(index).Map).UpperBound Call NPCCache_Create(index, Player(index).Map, PetMapCache(Player(index).Map).Pet(i)) Next End If Select Case GetPlayerDir(index) Case DIR_UP Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) - 1) Case DIR_DOWN Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) + 1) Case DIR_LEFT Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index) + 1, GetPlayerY(index)) Case DIR_RIGHT Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) - 1) End Select 're-warp the players on the map For i = 1 To Player_HighIndex If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(index) Then Call PlayerWarp(i, PlayerMap, GetPlayerX(i), GetPlayerY(i)) End If End If Next End Sub ``` this declares npcNUM as a new parameter and let us summon diffrent pets, how ever the "Call Pet button will no longer work now, DONT NEED IT, we will use items. In modPlayer find Public Sub UseItem (should be the last one) In the bottum of the sub, befor End Select, add ``` Case ITEM_TYPE_SUMMON ' stat requirements For i = 1 To Stats.Stat_Count - 1 If GetPlayerRawStat(index, i) < Item(itemnum).Stat_Req(i) Then PlayerMsg index, "You do not meet the stat requirements to use this item.", BrightRed Exit Sub End If Next ' level requirement If GetPlayerLevel(index) < Item(itemnum).LevelReq Then PlayerMsg index, "You do not meet the level requirement to use this item.", BrightRed Exit Sub End If ' class requirement If Item(itemnum).ClassReq > 0 Then If Not GetPlayerClass(index) = Item(itemnum).ClassReq Then PlayerMsg index, "You do not meet the class requirement to use this item.", BrightRed Exit Sub End If End If ' access requirement If Not GetPlayerAccess(index) >= Item(itemnum).AccessReq Then PlayerMsg index, "You do not meet the access requirement to use this item.", BrightRed Exit Sub End If Call SpawnPet(index, GetPlayerMap(index), itemnum) Call TakeInvItem(index, itemnum, 0) ``` this adds the ability to summon using items Item number = Summoned NPC number SIMPLE AND UNLIMITED!!! (close to it) * * * **CLIENT SIDE** NO SCRIPTING!? O.o BUT! we have to do the Visual things Open the frmEditor_Item click on cmbType only once ![](http://www.touchofdeathforums.com/smf/index.php?action=dlattach;topic=69925.0;attach=17268) over on the properties find the list ![](http://www.touchofdeathforums.com/smf/index.php?action=dlattach;topic=69925.0;attach=17360) Add Summon at the bottom ![](http://www.touchofdeathforums.com/smf/index.php?action=dlattach;topic=69925.0;attach=17272) This enables the new type of item to be created, want the edit parameters? they ARE the NPC editor Next Open up frmMain Find your pet menu find your "call pet" button, double click it ![](http://www.touchofdeathforums.com/smf/index.php?action=dlattach;topic=69925.0;attach=17274) ERASE ``` Private Sub Label3_Click() Call SpawnPet(MyIndex) End Sub ``` This prevents an error for what we are about to do… NOW DELETE YOUR CALL PET BUTTON!!!! you use items for that now, no cheating, go BUY a summon. AND TADA!!!! =D you now have Pet summoning with items!!!! Complete with ability to set requirements for the summons How to use: Make a summon item, set your requirements, and SAVE! Now remember what number that item is. Next, make a NPC *ON THE SAME NUMBER* as the summon item Now summon, and the rest of the controls are the same. you now have an advanced summoning system, and ability to make an entire Tamer Class. [hr/] **Optional** To make the item stay after summoning, for those who want to do so. In game logic change sub SpawnPet to (YES, you do this AGAIN, someone didnt and it messed up) ``` Sub SpawnPet(ByVal index As Long, ByVal mapNum As Long, npcNum As Long) Dim PlayerMap As Long Dim i As Integer Dim PetSlot As Byte 'Prevent multiple pets for the same owner If TempPlayer(index).TempPetSlot > 0 Then Exit Sub PlayerMap = GetPlayerMap(index) PetSlot = 0 For i = 1 To MAX_MAP_NPCS 'If Map(PlayerMap).Npc(i) = 0 Then If MapNpc(PlayerMap).NPC(i).SpawnWait = 0 And MapNpc(PlayerMap).NPC(i).Num = 0 Then PetSlot = i Exit For End If Next If PetSlot = 0 Then Call PlayerMsg(index, "The map is too crowded for you to call on your pet!", Red) Exit Sub End If 'create the pet for the map Map(PlayerMap).NPC(PetSlot) = npcNum MapNpc(PlayerMap).NPC(PetSlot).Num = npcNum 'set its Pet Data MapNpc(PlayerMap).NPC(PetSlot).IsPet = YES MapNpc(PlayerMap).NPC(PetSlot).PetData.Name = GetPlayerName(index) & "'s " & NPC(npcNum).Name MapNpc(PlayerMap).NPC(PetSlot).PetData.Owner = index 'If Pet doesn't exist with player, link it to the player If Player(index).Pet.SpriteNum npcNum Then Player(index).Pet.SpriteNum = npcNum Player(index).Pet.Name = GetPlayerName(index) & "'s " & NPC(npcNum).Name End If TempPlayer(index).TempPetSlot = PetSlot 'cache the map for sending Call MapCache_Create(PlayerMap) 'Cache the Pets for players logging on [Add new Number to array] PetMapCache(PlayerMap).UpperBound = PetMapCache(PlayerMap).UpperBound + 1 PetMapCache(PlayerMap).Pet(PetMapCache(PlayerMap).UpperBound) = PetSlot If PetMapCache(Player(index).Map).UpperBound > 0 Then For i = 1 To PetMapCache(Player(index).Map).UpperBound Call NPCCache_Create(index, Player(index).Map, PetMapCache(Player(index).Map).Pet(i)) Next End If Select Case GetPlayerDir(index) Case DIR_UP Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) - 1) Case DIR_DOWN Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) + 1) Case DIR_LEFT Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index) + 1, GetPlayerY(index)) Case DIR_RIGHT Call SpawnNpc(PetSlot, PlayerMap, GetPlayerX(index), GetPlayerY(index) - 1) End Select 're-warp the players on the map For i = 1 To Player_HighIndex If IsPlaying(i) Then If GetPlayerMap(i) = GetPlayerMap(index) Then Call PlayerWarp(i, PlayerMap, GetPlayerX(i), GetPlayerY(i)) End If End If Next End Sub ``` and in modPlayer find Case ITEM_TYPE_SUMMON and erase ``` Call TakeInvItem(index, itemnum, 0) ```at the bottom