Page 5 of 8
Re: Implementing Pets (0.7.2)
Posted: Sat Oct 20, 2012 9:40 am
by John Adams
Jabantiz wrote:however the warden file has the player casting ultravision, wich I believe you were looking for.
How did you find it? It says clearly "I am now casting Ultravision"? lol
Recall, I still have about 10 years to go before I can understand packets fully. I get about 2 hours a week to work on emu, on a good week. So a hint would be appreciated

Re: Implementing Pets (0.7.2)
Posted: Sat Oct 20, 2012 1:57 pm
by Jabantiz
I stumbled across it while searching those logs for pets, you could open the log in a text editor and ctrl + f ultravision. I just looked it up again and it looks like the cast is at line 186145
Re: Implementing Pets (0.7.2)
Posted: Sat Oct 20, 2012 1:59 pm
by John Adams
haha oh okay, i thought you had some magic snooper thingy i wasn't familiar with. I forgot the NAME of the spell is in the cast packet? I'll take a look. Thanks!
I'm trying to determine if Ultravision is a visual_state, action_state, etc... or an appearance (doubtful) or a spell effect... could be so many things.
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 2:16 am
by John Adams
I have added code to randomize your pet's name from a pool in the spawn_pet_names table. The data we provide is from packet collects of 1700+ pet names, many of which are custom

Some are pretty funny heh.
Also added is the Pet's sub-title, which is your player name + the pet's pre-configured sub-title from it's spawn record.
I am adding Pet data in the range between 3000-3999, and the pet spawn name is the model name+model ID
- example: Drake238, Bat239
The pet records sub_title field is the type
- example: minion, so when the pet spawns, it is "John's minion"
Jabantiz: Please check my code in the LUA function where I am rand() the pet name. Something is not very Random about it haha. When I start my world, it's always the same pet names that I see in a row.
02:35:40 D Pets: Randomize Pet Name: 'Applepudding' (rand: 41)
02:35:40 D Pets: Pet Subtitle: 'Guardian's familiar'
02:35:51 D Pets: Randomize Pet Name: 'Tubby' (rand: 1397)
02:35:51 D Pets: Pet Subtitle: 'Guardian's familiar'
02:35:57 D Pets: Randomize Pet Name: 'Scales' (rand: 1213)
02:35:57 D Pets: Pet Subtitle: 'Guardian's familiar'
It is ALWAYS those 3, in that order, and doesn't feel random at all. I'm sure I missed something:
Code: Select all
string random_pet_name;
int16 rand_index = rand()%world.pet_names.size();
random_pet_name = world.pet_names.at(rand_index);
I almost fell over when this actually returned a name at all. woot.
Note to self for tomorrow: Sort out how pet "class" is determined, and how it will affect spells and abilities.
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 3:08 am
by Jabantiz
I got the exact 3 names as you did in the same order, to fix this just change
Code: Select all
int16 rand_index = rand()%world.pet_names.size();
to
Code: Select all
int16 rand_index = MakeRandomInt(0, world.pet_names.size() - 1);
and it should be nice and random. (MakeRandomInt() is defined in our miscfunctions.cpp file)
As for pet class it is determined by the spell cast, necro's have 3 diffrent pet spells 1 is a tank 1 is a melee dps 1 is a caster. They also all have a set of spells, the higher level the pet spell the more spells they have, also the pet spell tier determines the tier of spells they have, so if your summon spell is expert all the spells the pet gets are experts.
btw good job with the code John.
PS - I know I said I logged for the night but couldn't sleep so here I am working on the emu some more...
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 3:15 am
by John Adams
Jabantiz wrote:PS - I know I said I logged for the night but couldn't sleep so here I am working on the emu some more...
I am so tired I could puke, but can't seem to let it go either

Thanks on for the help earlier. I'm still taking baby steps, but getting there.
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 3:23 am
by John Adams
Jabantiz wrote:As for pet class it is determined by the spell cast, necro's have 3 diffrent pet spells 1 is a tank 1 is a melee dps 1 is a caster. They also all have a set of spells, the higher level the pet spell the more spells they have, also the pet spell tier determines the tier of spells they have, so if your summon spell is expert all the spells the pet gets are experts.
This is good news then. I can use the `class_` field parsed with the pet to help determine which one it is, and build it's spawn_npc_spells lists, too. Pet data I think I'll put on the PatchServer, since it won't be that much spawn data.
We can eve /randomize our humanoid pets
Btw Jab, Xinux and I found a couple bugs to work through.
- Summoning more than 1 pet, you can't "get lost" more than the last one
- Pets can attack each other even if PVP is disabled
- You can attack your own pet, kill it, and get XP!
- You can open Pet Options of someone elses pet (could be fun?)
- "Pet Options" is not the default command for pets (Xinux), but we can fix that in data
- ??
Xinux, was there anything else? Jab, I can probably help fix some of this if you have other things to do. Just writing them down.
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 4:35 pm
by Jabantiz
John Adams wrote:Btw Jab, Xinux and I found a couple bugs to work through.
- Summoning more than 1 pet, you can't "get lost" more than the last one
- Pets can attack each other even if PVP is disabled
- You can attack your own pet, kill it, and get XP!
- You can open Pet Options of someone elses pet (could be fun?)
Fixed.
As for the default command I had hardcoded that to test, it was temporary and will be removed as the entity commands should be set by the DB.
All code on Dev SVN as well as the random fix posted above.
Re: Implementing Pets (0.7.2)
Posted: Sun Oct 21, 2012 10:40 pm
by Jabantiz
I tried to implement renaming of pets and ran into a problem, the emu doesn't support that (use "/spawn set name" and it will tell you to repop the zone) and I have not been able to figure out how to add it, spawn packet code is confusing as hell. So for now I will have to skip this feature.
Re: Implementing Pets (0.7.2)
Posted: Mon Oct 22, 2012 10:52 am
by John Adams
I would think /spawn set name would not apply in this case, because a Pet's `spawn` record is not owned by 1 player, but shared thus making the spawned pet like a Virtual Spawn. Why can't the name just be set in the packet, stored in the char sheet(?) then read and sent with the pet on zone entry? Avoiding existing spawn renaming entirely.
I am fine with NOT renaming them right now. Pet's are much further along than I expected (

) so I am fine with taking time to think it through. But, every time you say "I ain't gonna do this now", 30 mins later, you commit the code... so I am confident

Re: Implementing Pets (0.7.2)
Posted: Mon Oct 22, 2012 2:32 pm
by Jabantiz
I am talking about an already summoned pet our spawn update packets do not seem to be capable of sending an updated name, for spawning a pet it is easy to change the name before the create packet is ever sent. Trying to decypher the code to figure out how we create the update packets is going to be time consuming and I would rather not put that much effort into a rather minor feature right now. I still got 3 more types of pets to implement.
Re: Implementing Pets (0.7.2)
Posted: Mon Oct 22, 2012 2:59 pm
by Jabantiz
I commited my code for the rest of the pet window all the options should work except the rename and range/melee options.
Re: Implementing Pets (0.7.2)
Posted: Sat Nov 10, 2012 5:15 pm
by Jabantiz
Thanks to Xinux's post on a player name change I figured out how to change names of spawns so you can now rename your pet, also updated /spawn set name so you should no longer require a /repop to see the change. Let me know if there is any issues with either.
Re: Implementing Pets (0.7.2)
Posted: Sat Mar 02, 2013 6:44 pm
by Jabantiz
I looked into hiding pets and figured making the pet spawn private would be the simplest solution, sadly I discovered you can't just toggle a flag to make it private. It seems another spawn has to be added to the spawns allowed list before the spawn becomes private. From what I can tell this means all private spawns related to quests will be visible to every one until some one is on the correct step and gets added to the allowed list which will then make the spawn private to every one else.
Am I missing something or is that actually how it works now, and if that is how it works now should we change it so there is a simple bool we can toggle to make it private whenever we want?
Re: Implementing Pets (0.7.2)
Posted: Sun Mar 03, 2013 9:13 am
by John Adams
I thought private quest spawns already worked? Ie., I pop a dude I have to talk to, only I can see him. Is that not the case? If not, then yes... probably needs to be fixed/enhanced.
I believe Scatman wrote that original code. I'll ping him to come check this question out.