| 
 
 |  Re: RELEASE: Pet system [tutorial] 
15 years, 37 weeks agothat would be an awesome add on. please do release that. i wish i was good at programming.. i have awesome ideas but no skills to set them up.  (sorry for going off topic) | 
 
		| 
batmaso 
Joined: 30th Jan 2010Posts: 21
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 35 weeks agoI made my own topic about a problem I was having but after playing with it for a bit more i've found a couple of more things i'm not sure if it's because of how I put it or I miss things or if that's just how limited this script actually is but 
     * Pets mess up on relog* Pets mess up when warping
 * Pets are affected by NPC walls
 
 The NPC walls problem isn't that big of a deal and the warping isn't also. It's not that hard to just double click the egg again to re-spawn it. The only one that really seems to be a problem is the relog problem.
 |  
		| 
Ananas
 Moderator 
Joined: 22nd Apr 2009Posts: 2190
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 35 weeks ago
batmaso posted: (16th Mar 2010 07:16 pm)
 
 I made my own topic about a problem I was having but after playing with it for a bit more i've found a couple of more things i'm not sure if it's because of how I put it or I miss things or if that's just how limited this script actually is but 
     * Pets mess up on relog* Pets mess up when warping
 * Pets are affected by NPC walls
 
 The NPC walls problem isn't that big of a deal and the warping isn't also. It's not that hard to just double click the egg again to re-spawn it. The only one that really seems to be a problem is the relog problem.
 
 
 * Pets mess up on relog
 
 Go to character.cpp and add the followed code on the Character::Logout()
 
 Paste above the (this->online = false;)
 
 UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character)
 {
 if (this->InRange(*character))
 {
 this->pet->RemoveFromView(*character);
 }
 }
 erase_first(this->map->npcs, this->pet);
 this->pet->Release();
 this->has_pet = false;
 
 
 
 
 * Pets mess up when warping
 
 If you would go through the code a bit you would notice the (PetTransfer) at character.cpp that warps a pet on walking through a warp.
 
 As you can see it transfers before entering and after entering;
 
 this->player->character->PetTransfer();
 this->player->character->Warp(Map, X, Y, WARP_ANIMATION_NONE);
 this->player->character->PetTransfer();
 
 Use those warps also in lets say scrolls;
 
 At item.cpp Case scrolls
 
 this->player->character->PetTransfer();
 this->player->character->Warp(item->scrollmap, item->scrollx, item->scrolly, WARP_ANIMATION_SCROLL);
 this->player->character->PetTransfer();
 
 Warps a player pet with him on a use of a scroll.
 
 
 
 * Pets are affected by NPC walls
 
 At map.hpp check out this part;
 
 bool Walkable(bool npc = false)
 {
 if (this->warp && npc)
 {
 return false;
 }
   switch (this->tilespec){
 case Wall:
 case ChairDown:
 case ChairLeft:
 case ChairRight:
 case ChairUp:
 case ChairDownRight:
 case ChairUpLeft:
 case ChairAll:
 case Chest:
 case BankVault:
 case MapEdge:
 case Board1:
 case Board2:
 case Board3:
 case Board4:
 case Board5:
 case Board6:
 case Board7:
 case Board8:
 case Jukebox:
 return false;
 case NPCBoundary: // Hmmm...
 return !npc; // Hmmm....
 default:
 return true;
 }
 }
 
 ---
"Pineapples and shit." |  
		| 
batmaso 
Joined: 30th Jan 2010Posts: 21
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 35 weeks agoAwesome everything is all fixed up. Thank you very much Ananas (: I really don't wanna bug you but my pet seems to just stand there if the character is idle and I see where it says: 
 
// Random walking
 
        int act;
        if (this->walk_idle_for == 0)
 
            etc etc etc 
but I don't think it's really doing anything.
 |  
		| 
		|  Re: RELEASE: Pet system [tutorial] 
15 years, 31 weeks agoYes after compiling and i click rebuild and i get this ||=== eoserv, SQLITE ===|
 ld.exe||cannot find -lpthreadGC2|
 ||=== Build finished: 1 errors, 7 warnings ===|
 EDIT2: are pets suppose to attack people? becouse mine doesent or are they there for looks?
 EDIT: nevermind im dumb, i was missing some linker settings in the compiler and debugger works perfect, very nice
 
 |  
		| 
designz 
Joined: 3rd May 2010Posts: 197
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 28 weeks agoHow do you get the pets to attack monsters |  
		| 
 
 |  Re: RELEASE: Pet system [tutorial] 
15 years, 24 weeks agoHello everyone, I was wondering if someone could tell me what this means. 
 C:\Documents and Settings\EOserv\Desktop\trunk\src\npc.hpp|169|error: no matching function for call to 'NPC::NPC(Map*&, short int&, unsigned char&, unsigned char&, unsigned char&, short int&, unsigned char&, bool&)'|C:\Documents and Settings\EOserv\Desktop\trunk\src\npc.hpp|116|note: candidates are: NPC::NPC()|
 C:\Documents and Settings\EOserv\Desktop\trunk\src\npc.hpp|116|note:                 NPC::NPC(const NPC&)|
 C:\Documents and Settings\EOserv\Desktop\trunk\src\player.hpp||In member function 'void Character::PetTransfer()':|
 C:\Documents and Settings\EOserv\Desktop\trunk\src\player.hpp|1192|error: no matching function for call to 'NPC::NPC(Map*&, short int&, unsigned char&, unsigned char&, int, int, unsigned char&, bool, bool)'||
 ||=== Build finished: 2 errors, 0 warnings ===|
 
 
 |   
		| 
		|  Re: RELEASE: Pet system [tutorial] 
15 years, 24 weeks agoI downloaded the compiled version, just doesn't work the commands... #attack,#follow 
 and I dont know how to spawn a pet
 |  
		| 
Festa 
Joined: 26th Nov 2009Posts: 334
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 24 weeks agoWith that compiled source there's a typo on the first line of the player command code,it will say this;
 if (this->player->character->admin && message[0] == '#') Just change the word "admin" to "player" and it should work fine.Also as Digitx said in the previous pages, the commands are; $sp (name) (npcid) - Spawning pet $dp (name) - Dismissing a Pet |  
		| 
kenobi13  
Joined: 3rd Jun 2009Posts: 881
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 24 weeks ago
Festa posted: (2nd Jun 2010 09:59 am)
 
 With that compiled source there's a typo on the first line of the player command code,it will say this;
 if (this->player->character->admin && message[0] == '#') Just change the word "admin" to "player" and it should work fine.Also as Digitx said in the previous pages, the commands are; $sp (name) (npcid) - Spawning pet $dp (name) - Dismissing a Pet 
Nope, remove "this->player->character->admin &&" |  
		| 
		|  Re: RELEASE: Pet system [tutorial] 
15 years, 24 weeks agoye, ty festa, it worked, but now the problem are : How to make a pet attack npcs / player and this command above, which was posted before on this topic : 
 if(id == ItemID){
 if(!this->player->character->has_pet)
 {
 this->player->character->has_pet = true;
 unsigned char index = this->player->character->map->GenerateNPCIndex();
 if (index > 250)
 {
 break;
 }
 if (this->player->character->PetCounter > 1)
 {
 break;
 }
 this->player->character->pet = new NPC(this->player->character->map, NpcID, this->player->character->x
+1,this->player->character->y, 1, 1, index, true, true);
 this->player->character->pet->SetOwner(this->player->character);
 this->player->character->map->npcs.push_back(this->player->character->pet);
 this->player->character->pet->Spawn();
 this->player->character->PetCounter = 1;
 }
 }
 I got these errors :
 
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp||In member function 'bool EOClient::Handle_Item(PacketFamily, PacketAction, PacketReader&, int)':|C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|32|error: 'ItemID' was not declared in this scope|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|42|error: 'class Character' has no member named 'PetCounter'|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|46|error: 'NpcID' was not declared in this scope|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|46|error: invalid use of incomplete type 'struct NPC'|
 ..\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|47|error: invalid use of incomplete type 'struct NPC'|
 ..\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|49|error: invalid use of incomplete type 'struct NPC'|
 ..\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|50|error: 'class Character' has no member named 'PetCounter'|
 ..\src\container\ptr_vector.hpp||In member function 'void PtrVector<T>::push_back(T*) [with T = NPC]':|
 C:\Documents and Settings\felipe engine\Desktop\Malz\src\handlers\Item.cpp|48|instantiated from here|
 ..\src\container\ptr_vector.hpp|360|error: no matching function for call to 'PtrVector<NPC>::push_back(NPC*&)'|
 ..\src\container\ptr_vector.hpp|237|note: candidates are: virtual void GenericPtrVector::push_back(Shared*)|
 ||=== Build finished: 11 errors, 0 warnings ====||
 
 
 
 |  
		| 
lance317 
Joined: 16th Jun 2010Posts: 48
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 22 weeks agowait a minute does this tut only spawn pets, does it help pets attack, or heal u or just spawning and despawing cuz i have a compiled server tht does this  |  
		| 
 
 |  Re: RELEASE: Pet system [tutorial] 
15 years, 22 weeks ago
lance317 posted: (18th Jun 2010 12:51 am)
 
 wait a minute does this tut only spawn pets, does it help pets attack, or heal u or just spawning and despawing cuz i have a compiled server tht does this  
This tutorial only has Two Admin commands and two player commands. It does not have healing/attacking monsters |   
		| 
Koomike  
Joined: 17th Jun 2010Posts: 165
 
  Re: RELEASE: Pet system [tutorial] 
15 years, 21 weeks agoI'm confused... i'm in npc but where do I paste that first thing?
 |  
		| 
		|  Re: RELEASE: Pet system [tutorial] 
15 years, 20 weeks ago
Klutz posted: (27th Feb 2010 11:13 pm)
 
ReemDead posted: (26th Feb 2010 03:14 am)
 
 
Jimbo posted: (24th Feb 2010 02:29 am)This does not work, at all. Even after I put
 
 If anyone wants to let characters spawn a pet by using an item place this in item.cpp 
 Under this..                
                 EIF_Data *item = this->server->world->eif->Get(id);reply.SetID(PACKET_ITEM, PACKET_REPLY);
 reply.AddChar(item->type);
 reply.AddShort(id);
 
 Code: 
 if(id == ItemID){
 if(!this->player->character->has_pet)
 {
 this->player->character->has_pet = true;
 unsigned char index = this->player->character->map->GenerateNPCIndex();
 if (index > 250)
 {
 break;
 }
 if (this->player->character->PetCounter > 1)
 {
 break;
 }
 this->player->character->pet=newNPC(this->player->character->map,NpcID,this->player->character->x+1,this->player->character->y,1,
1, index, true, true);
 this->player->character->pet->SetOwner(this->player->character);
 this->player->character->map->npcs.push_back(this->player->character->pet);
 this->player->character->pet->Spawn();
 this->player->character->PetCounter = 1;
 }
 }
 
 Just replace NpcID / ItemID with the item / npc you wish to use. 
 Edit: Remove PetCounter if you don't want it.
 
 
 
 
 #include npc.hpp 
 I tried modding this code in several different ways, but it just doesn't want to work. It compiles fine however, I can't seem to get my eggs to do anything.
 
 
 
 Edit: tinkered with it, fixed it. put it where Jimbo said to put it. also make sure you  
 Edit: Figured out how to get the item to stay after use(choppy but works) 
 #include npc.hpp 
 
 
if(id == ItemID)                 { 
 
                      this->player->character->Save(); //this may be unnessasary                      this->player->character->AddItem(id, 1);//adds back the item after it's use                      this->player->character->Save(); 
 
                     if(!this->player->character->has_pet)                     { 
                         unsigned char index = this->player->character->map->GenerateNPCIndex();                         if (index > 250) 
                         { 
                         break; 
                         } 
                         this->player->character->pet = new NPC(this->player->character->map, NpcID, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);                         this->player->character->pet->Spawn();                         this->player->character->pet->SetOwner(this->player->character);                         this->player->character->has_pet = true;                         //this->player->character->AddItem(682, 1);                         this->player->character->map->npcs.push_back(this->player->character->pet); 
 
                         this->player->character->Save(); 
                     }                 } I set the item type as reward in the pub, with exp bonus of 0. 
 
 I edited your code to dismiss the pet if the item is used again, the pet can be summoned and dismissed as many times as needed by clicking the reward item. Now there's no need to type either command to summon or dismiss. 
 
 in "npc.cpp" ; 
 #include "npc.hpp" 
 under: 
 if (this->player->character->HasItem(id))
 {
 EIF_Data *item = this->server->world->eif->Get(id);
 reply.SetID(PACKET_ITEM, PACKET_REPLY);
 reply.AddChar(item->type);
 reply.AddShort(id);
 
 Add:if(id == ItemID)
 {
 
 
 this->player->character->Save(); //this may be unnessasary
 this->player->character->AddItem(id, 1);//adds back the item after it's use
 this->player->character->Save();
 
 
 if(!this->player->character->has_pet)
 {
 
 unsigned char index = this->player->character->map->GenerateNPCIndex();
 if (index > 250)
 
 {
 
 break;
 
 }
 
 this->player->character->pet = new NPC(this->player->character->map, NpcID, this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);
 this->player->character->pet->Spawn();
 this->player->character->pet->SetOwner(this->player->character);
 this->player->character->has_pet = true;
 //this->player->character->AddItem(682, 1);
 this->player->character->map->npcs.push_back(this->player->character->pet);
 
 
 this->player->character->Save();
 
 
 } else if(this->player->character->has_pet = true)
 {
 UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
 {
 if (this->player->character->InRange(*character))
 {
 this->player->character->pet->RemoveFromView(*character);
 }
 }
 erase_first(this->player->character->map->npcs, this->player->character->pet);
 this->player->character->pet->Release();
 this->player->character->has_pet = false;
 }
 }
 
 
     wat sud i put in New NPC?
 |  |  |  |  |  |  |  |  |  |  |  |  |