View Single Post
  #4  
Old 09-20-2010, 08:48 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Haha, to be honest, I didn't do any of the work on Destructible items yet. I just asked Derision about the work he had done, as I was planning to see if I could help to get them working. I don't think there is too much left to do after seeing the work Derision has done. We just need to add in a few new DB fields and make some stuff to handle them properly.

I don't know much about destructible objects, but here are some points on what I have learned so far from messing with them:

1. Destructible objects have 5 states of appearances which can be seen by doing #appearance 44 0 to 4. Appearance 0 is the non-damaged version, and 4 is fully destroyed. Do not use appearance 5 or higher, as that will crash the client!

2. The new opcode named OP_DestructibleRelated changes the object from being targetable to being untargetable. This can be made into a Perl command, but we will also need some way for new players who zone in to see the object as untargetable as well. I think we will need to play with the struct a bit to see how to set the spawn to be untargetable from the start so we can set that field for new players zoning in after the object has been set this way. One cool thing about this new opcode is that it also works on normal NPCs. If it is used on a normal NPC, it removes them from your target and makes them untargetable. It is almost like they are toggled to bodytype 11 in real-time. If there is a way to change them back to being targetable again, I think this opcode could have some other potentially nice uses (maybe anti-hack stuff and possibly other uses).

3. The destruction animations can be done in any order, and also can be done in reverse.

4. These objects all have collision, which I think makes them more useful than some other types of zone objects.

5. Since the objects are essentially NPCs, they can be moved with a #summon. This is pretty cool. It makes me wonder what would happen if you set one on a pathing grid lol!

6. Each destructable object has 4 variable length string fields. I assume we can use the name and lastname field of normal NPCs for 2 of those strings, but we will probably need at least 1 or 2 new fields to be able to handle these properly. There are still at least a few fields we don't undertand yet, so there will probably need to be some other fields as well. I noticed a couple of fields that were set to 100, and I assume one of them may be object size.

At this point, I think the plan is to add destructible objects to the npc_types table. This makes sense, because they are essentially NPCs and even use the same opcode as NPCs do for spawning them. It is also the easiest way to manage them, since they need to be loaded like an NPC anyway.

Here are some notes on what I think we still need:

1. We need a way to set the damage states automatically based on HP percentages like maybe having them changes appearances every 25% (100% = 0, 75% = 1, 50% = 2, 25% = 3, 0% = 4). I believe that the appearance fields I added to NPCs a while back should be able to work for destructible objects as well, but will need to review that later to be sure. This should allow them to show the correct appearance state when new players zone in.

2. We need a way to set them non-targetable for new players zoning in after the OP_DestructibleRelated opcode is sent.

3. Optional would be to add a perl command to send the new OP_DestructibleRelated opcode (I can add this in like 2 seconds).

4. It may not be required, but we should try to identify some more of the unknown fields if possible.

I don't have a ton of time to work on this atm, but if no one else commits some stuff for destructible objects like what was submitted here, I will try to get to it when I have more time. I really appreciate Derision sharing the work he has done on them to this point. With his work, I think destructible objects should be functional and on the SVN pretty soon one way or another

EDIT: Wanted to note that the patch Secrets posted will probably break any existing corpses. So, for any servers that leave corpses with items on them, be warned that patching this will basically poof any existing corpses on your server (or make them inaccessible anyway).
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 09-20-2010 at 12:00 PM..
Reply With Quote