[pol100] how to hide equipped items on dead corpes

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
DebugZHI
New User
Posts: 8
Joined: Thu Nov 24, 2016 7:31 am

[pol100] how to hide equipped items on dead corpes

Post by DebugZHI » Sun Oct 07, 2018 12:19 pm

Hi all,

we have updated our pol installation from 099(rev 631) to last commit of pol100.
there's possibility to disable drawing equip on dead corpes (npc humanoid or players) through cfg or scripts?

in our old version this not happen

Thank you for assistance

Best Regards

Scripter Debug

ZHI Staff
Scripter Debug - Zulu Hotel Italia 7^ Age
Image

Mail: debugzhi@gmail.com

ThisIsMe
Distro Developer
Posts: 64
Joined: Sun Jul 17, 2016 1:29 am
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by ThisIsMe » Sun Oct 07, 2018 5:01 pm

If you are referring to the equipment on say a human corpse, in other words if a human mobile (player or NPC) dies and is wearing full plate mail at the time of death, his corpse will be 'wearing' the plate mail as well. If this is what you are referring to you have two options and the easier of the two and the one I know would work for you is at time of death you will want to unequip everything.

Something like the following should allow you to get the effect you want, while I do not know your shard setup I would not have the slightest idea where to put this so hopefully this is first what you are looking for and second, something easily implemented on your end to get the effect you want.

You can if you so choose in the for loop add additional checks to see if the item is something you want to delete in the event you do not wish to have your players get their hands on a "Black Staff of Item Wiping and Character Deletion" or the "Paladin Sword of Random Shard Crashing". Of course you know I am having a bit of fun but for instance, if you have city guards and color their cloaks something interesting you could destroy the cloak layer of the color if the item matches your guard's cloaks or whatever.

Code: Select all

var layer_id := 1,
	// The following layers will be ignored as they do not pertain to either equipment visible on a player's corpse or should not be unequipped in this fashion.
	keep_equipped := Array{ 11, 15, 16, 21, 25, 26, 27, 28, 29, 30 },
	layer;
for( layer_id := 1; layer_id <= 30; layer_id += 1 )
	Sleepms( 3 );
	if( !( layer_id in keep_equipped ) )
		layer := GetEquipmentByLayer( mobile, layer_id );
		if( layer )
			MoveItemToContainer( layer, mobile.backpack );
		endif
	endif
endfor
The other method of potentially, assuming I understand your question correctly, getting the results you are looking for is writing a packet hook, if I understand how this packet works, it is very likely I do not, you might be able to hook into this packet and might be able to do something similar to my snippet above.

However, I will say this about that, your best bet, the one I would go with above all else is to avoid the packet hook and just handle the unequipping of items at time of death rather than mucking around in the packets as there is a chance that there will be unintended consequences.

Hopefully this helps and it is, again, A.) what you were looking for and B.) easily implemented on your shard.

guialtran
Grandmaster Poster
Posts: 108
Joined: Wed Jul 30, 2008 12:42 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by guialtran » Sun Oct 07, 2018 6:02 pm

I did not understand this, you want to hide it?
or do you want to erase?


when an npc dies it runs a script called misc / death.src

you have the direct reference to the container with all npc items, you can easily delete everything.
if you want to hide I think you can too, using invisible object property.

if you do not want it to be played in the body.
soon after dressing the equipment npc you can list all the objects and change the property of the item to "newbie 1"
the item is not thrown into the corpse, it is probably deleted.

EquipFromTemplate(npc,"npctemplate_equipname");
foreach equip in (ListEquippedItems( npc ))
equip.newbie:=1;
endforeach
:deadhorse:
@CronosKing
Image ZuluHotel Forgotten Realms
www.zuluhotel.com.br

DebugZHI
New User
Posts: 8
Joined: Thu Nov 24, 2016 7:31 am

Re: [pol100] how to hide equipped items on dead corpes

Post by DebugZHI » Sun Oct 07, 2018 11:17 pm

Hi all,

thanks for your answers.
The specific problem is:
On death of any mobiles that create a humanoid corpes, if they have any kind of item that can be equiped, it will be equipped. (like screens in attach)

In addiction if you will put another item that can be equiped you will see it like equipped.

thanks for assistance

Best Regards,

Scripter Debug
Attachments
brigand_killed.JPG
brigand_killed_loot.JPG
brigand_killed_added_chainmailbreast.JPG
Scripter Debug - Zulu Hotel Italia 7^ Age
Image

Mail: debugzhi@gmail.com

RusseL
Forum Regular
Posts: 349
Joined: Fri Feb 20, 2009 8:30 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by RusseL » Mon Oct 08, 2018 12:41 am

Yup, agree.
I described this issue already May 2017, but looks like noone want to fix it :D
https://github.com/polserver/polserver/issues/29

And no, you cant fix it with a script. It is a core issue.


Looks like this Bug was introduced with this commit
https://github.com/polserver/polserver/ ... da8da0b208

guialtran
Grandmaster Poster
Posts: 108
Joined: Wed Jul 30, 2008 12:42 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by guialtran » Mon Oct 08, 2018 8:42 am

If you do not want this behavior, I have the solution for you.

Do not you want the body to equip the items that are in its container? this is what you want?

every time your server starts, in a start script you do the verification, if there is a FindStorageArea ("cemetery") if it does not exist, you create one.

in the body configuration, create a script ([ControlScript (string scriptname)] script.)

the body control script will be started, and will create a Storage container (CreateRootItemInStorageArea ("cemetery", corpse.serial, corpse_objtype)) equal to a corpse container.

name of the Storage must be the same as the serial of the body itself, so you do not have to have properties in the corpse, saved the name of the container in StorageArea.

every time a person clicks on the [Script (string scriptname)], you start opening StorageArea by looking for the container by its name (FindRootItemInStorageArea ("cemetery", corpse.serial)) after finding the reference for the item, you start the opening for the player who clicked on the container (SendOpenSpecialContainer (character, refitem))

this way you will not have problems hiding the items.


important, whenever a body is destroyed, you must have a script that takes the serial from the body searches for the StorageArea and destroys it, before the body is destroyed.
DestroyRootItemInStorageArea ("cemetery", corpse.serial).

this way you recycle your memory.

Sorry, my english is not good, I do not speak English. :deadhorse:
@CronosKing
Image ZuluHotel Forgotten Realms
www.zuluhotel.com.br

RusseL
Forum Regular
Posts: 349
Joined: Fri Feb 20, 2009 8:30 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by RusseL » Mon Oct 08, 2018 10:12 am

@guialtran
corpse is a special item, and as far as i remember you can not set a usescript for it. So your solution wouldnt work.

Actually, pol-core just must be fixed, i dont think it will be so hard for core developers, when they know since which commit it is broken.

ThisIsMe
Distro Developer
Posts: 64
Joined: Sun Jul 17, 2016 1:29 am
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by ThisIsMe » Mon Oct 08, 2018 10:42 am

You can assign a use script to the corpse, it's definitely a special item, but there's nothing stopping you from assigning it a use script because you have to if you want to utilize the party system can or cannot loot me.

Or if you want to prevent a player from looting mobs that weren't killed or damaged by them.
Screenshot_20181008-134400.png
The only broken thing I believe is the corpse equipping item's to it not equipped to it on death such as the screenshot in the op's second post.

RusseL
Forum Regular
Posts: 349
Joined: Fri Feb 20, 2009 8:30 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by RusseL » Mon Oct 08, 2018 11:02 am

Hmm, okay, never tried it :cheesy:

guialtran
Grandmaster Poster
Posts: 108
Joined: Wed Jul 30, 2008 12:42 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by guialtran » Mon Oct 08, 2018 11:18 am

I think it would be the best option for you right now.
@CronosKing
Image ZuluHotel Forgotten Realms
www.zuluhotel.com.br

ThisIsMe
Distro Developer
Posts: 64
Joined: Sun Jul 17, 2016 1:29 am
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by ThisIsMe » Tue Oct 09, 2018 11:41 am

I'll if you are interested, sit down and see if I can come up with a non storage area solution, I have an idea how to but it will require a number of changes to your equip and unequip scripts as well as changes to your death and corpse on remove and on insert scripts and potentially others unless I hook into the pickup item packet which I've been meaning to do anyway for game boards and the ilk.

Yukiko
Distro Developer
Posts: 2508
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by Yukiko » Thu Oct 11, 2018 11:11 pm

I was informed by Nando that is not a bug. He added this to the Core because he thought it was strange when a character died that it's corpse was displayed naked. It was added during POL the 098 development cycle after POL098.2 but before POL 099 development was started.
From the core-changes.txt:

Code: Select all

09-21-2014 Nando:
  Fixed:    Corpses will now equip items that are placed on them, even if they don't have an OnInsert script.
  Fixed:    Possible crash when items having layers larger than 25 were placed/removed from corpses.
The issue with changing the behaviour of having items dropped on a corpse not equipping on the corpse might be a hard issue to solve. I think this example will illustrate the point:
You kill a brigand. You open her corpse. Inside you find loot but her shirt and pants are laying on top of some of the loot. You have to move the clothes to get access to the loot. The act of moving her shirt, on the server side, removes her shirt from the corpse. Of course when you drop the shirt back into the corpse at a different location it places her shirt back in the corpse. From a role playing perspective you did not remove her shirt. You just needed to see the loot under her shirt in the corpse. So re-equipping the shirt makes sense.

Maybe something can be done to only equip items that were previously equipped on the corpse upon death but that is something the Core developers will have to look into.

Frankly I like the idea of having corpses appear dressed upon death. Also, I think this is a minor issue. I don't usually drop clothes, or anything else for that matter, in a corpse gump. If I have stuff in my backpack I wish to throw away I just drop it on the ground. In real life, if I ever encountered a dead body and I had an old shirt in my hand I can't "open the corpse" of the dead body and dispose of the old shirt in the "open corpse". Well, I could cut the corpse open and drop it in the flayed body but you should see my point. That having been said, as I come from a role play point of view, I will admit that dropping a shirt I had in my backpack, that was not on the corpse upon death, into the corpse gump should not equip on the corpse, from a role playing point of view.

What I would tell my players is you can't dump trash in a dead body in real life so dropping "trash" in a corpse is not proper RP so expect a non-RP response from the game. In other words, live with it the way it is.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

RusseL
Forum Regular
Posts: 349
Joined: Fri Feb 20, 2009 8:30 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by RusseL » Fri Oct 12, 2018 7:22 am

Showing all items on corpse is not a good solution, as well as not showing at all.
My NPCs, for example, can loot player characters, and when they die it looks horrible.
Only equipped items must be shown as it was earlier, don't know why pol-devs broke it :)

Yukiko
Distro Developer
Posts: 2508
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by Yukiko » Fri Oct 12, 2018 9:02 am

POL devs did not break it. They fixed it. Originally, according to Nando, corpses did not show any items on the corpse that were equipped on the NPC before it died.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

DevGIB
Grandmaster Poster
Posts: 204
Joined: Mon Feb 06, 2006 6:12 am

Re: [pol100] how to hide equipped items on dead corpes

Post by DevGIB » Fri Oct 12, 2018 4:30 pm

Should it be a ssopt for drawing items on corpse, or
An item property that enables corpse item drawing, so that when you move all the items from the characters equip to the corpse they are drawn then but not redrawn afterwards?

If you come up with a design of how you think it should work, keeping in mind all ways that people might want to utilize the corpse item drawing, then a change could be looked at.

Yukiko
Distro Developer
Posts: 2508
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by Yukiko » Fri Oct 12, 2018 7:10 pm

The problem is that when you rummage around in a corpse and move the clothes, from the server perspective, you are "removing" the item whilst it is on your finger but if you drop it back in the corpse it should re-equip it on the corpse. Off the top of my head I can see two possible solutions.
.
1. A setting in servspecopt.cfg
EquipCorpse 0/1 default setting is 1
This would equip the corpse with the garments it was wearing at time of death.

2. The Core would equip the corpse with items worn at time of death. Then it would set an array on the corpse (in a CProp) with the serial numbers of items that were equipped. The Core would check any item's serial number dropped in the corpse against that list. If the numbers match the item gets equipped, if not it does not.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

DevGIB
Grandmaster Poster
Posts: 204
Joined: Mon Feb 06, 2006 6:12 am

Re: [pol100] how to hide equipped items on dead corpes

Post by DevGIB » Sat Oct 13, 2018 3:26 am

My thoughts were similar to the second method, but a combination of the 2.
A flag so draw could be turned off all together (if thats what people wanted).

Then the other would be a flag that could be set on items if you wanted them to draw.
Then people could use the onremove script of a corpse to remove that flag, or maybe oninsert in a backpack or something. That way scripters if needed could also do some funky things with the scripts on items to make either appear or disappear from a corpse. i guess a change to that prop would also have to force a redraw though.

User avatar
Core Essence
Neophyte Poster
Posts: 38
Joined: Tue Feb 07, 2006 10:40 am
Location: Palermo, Italy

Re: [pol100] how to hide equipped items on dead corpes

Post by Core Essence » Sat Oct 13, 2018 4:21 am

Shouldn't the corpse only let you see items that were equipped by it? As far as I can remember they did show anything that was equipped, but not that was not. What I never got to work was the option of seeing items for NPC that died with "newbie" equip, it would cause them to disappear, and there was a fix that items flagged as unmovable / invisible would be shown in the corpse, the problem with the "unmovable" was that the items would appear in the corpse, possibly covering other items, and with "invisible" was that once you would open the corpse they would disappear from the corpse drawing.

Yukiko
Distro Developer
Posts: 2508
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by Yukiko » Sat Oct 13, 2018 9:23 am

Core Essence, I do not know if items that are newbied are ever placed on a NPC . I guess they might be and if they are they should work like newbie items do on a player and not show in the corpse gump.

Dev, the great thing about my option 2 is that if the Core were to handle that there is no additional scripting needed. Adding an additional setting to completely disable corpse equipping along with option 2 is not a bad idea.

To be honest though I think, with all the other things that POL needs, this is such a minor issue. This issue isn't causing server crashes, excessive server load, scripts to hang, and most importantly it is not a bug. It was added to fix what was apparently a bug originally, naked human corpses.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

User avatar
Core Essence
Neophyte Poster
Posts: 38
Joined: Tue Feb 07, 2006 10:40 am
Location: Palermo, Italy

Re: [pol100] how to hide equipped items on dead corpes

Post by Core Essence » Sat Oct 13, 2018 10:30 am

Just checked on corechanges, there are a lot of fixes going around corpses like:
10-06-2012 Tomi:
Changed: setting an equipped item on NPC to movable 0 will make it visible on the corpse but invisible in the corpse, same as hair and beard have worked until now.

02-27-2009 MuadDib:
Fixed: Clothing on corpses. COMPLETELY! This age old bug is now 100% fixed. If it was
equipped at time of death, it will be on the corpse until the on remove script
check for the corpse is triggered for taking the item out (on remove, not can)

12-27 Racalac
Fixed invisible corpse clothing



I do understand that it's a minor issue, but as yukiko says we should be able to "do as we want", I for istance would like to have my NPCs with their equip on the corpse, but not showing on the container, but only for the items that I decided would be equipped, not every scrap items that might be in their loot for whatever reason

Hope to see something like that in the future, but can live without :)

guialtran
Grandmaster Poster
Posts: 108
Joined: Wed Jul 30, 2008 12:42 pm

Re: [pol100] how to hide equipped items on dead corpes

Post by guialtran » Mon Oct 15, 2018 2:38 pm

is just to create a fake container like I explained before.
npc would be dressed with whatever you want, and he does not have access to the items.
only access to the prize.
@CronosKing
Image ZuluHotel Forgotten Realms
www.zuluhotel.com.br

ThisIsMe
Distro Developer
Posts: 64
Joined: Sun Jul 17, 2016 1:29 am
Contact:

Re: [pol100] how to hide equipped items on dead corpes

Post by ThisIsMe » Wed Oct 17, 2018 5:43 pm

I will say this about the storage area work around, the thing to remember is that if this method is used, your corpses will auto close when they are open if the player moves at all. As a player I would find this exceptionally annoying and more annoying than the corpse dressing itself.

I intend to look into this issue under ServUO and see how their behavior is set but have not had the time.

Post Reply