Page 2 of 2

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Fri May 26, 2023 3:58 am
by Buggie
I know about this "feature". Already investigate that. IIRC, it specific to your server and caused by fact spawn new copy of weapon on pickup or throw (not remember details) instead of direct usage it. For normal usage all goes ok.
But you spawn copy of weapon and destroy old.

It be long time ago, so I not remember details.   
Auto merged new post submitted 1 hour 2 minutes later
Ah. now I remember. It be part of code about death. On death you spawn copy of inventory, instead of drop exists weapons. Obviously this lead to destroy link to InventoryDestroyer. So weapon goes be permanent now.
Unfortunately there nothing what I can do with that.   
Auto merged new post submitted 6 minutes later
Look at bDropWeaponsOnDeath, DiscardInventory and DropWeapon. Last one spawn permanent copy.

I can suggest you few solutions.
1. Drop real weapon, not copy.
2. Drop copy only of real weapon, not for gifted.
3. Drop copy for all weapons, but for gifted search and replace link to it in InventoryDestroyer.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Thu Jun 01, 2023 4:40 pm
by Barbie
Ah, never touched that part of code. I suppose that function DropWeapon() was introduced because with the stock code only the current holding weapon is dropped. BTW that function can be found in some game controllers of MonsterHunt packages like in KHMBase.uc, MH2Base.uc, KHMBase.uc.

It's now fixed by dropping original weapon in my game controller.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Sat Jun 03, 2023 10:12 am
by Barbie
Is it possible to
1) Make the hard coded check time of currently 0.1 sec configurable?
2) Make counter voice and number configurable?
3) Set spawned item's LifeSpan? With that I can easily show remaining time in HUD.
<EDIT>
Not to forget: 4) possibility of dropping any Actor, not only inventory
</EDIT>
Ofc I also could do the changes and send you the result.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Sat Jun 03, 2023 4:10 pm
by Buggie
v0.5
- Add more config options (see ini file)
- Set LifeSpan time (reset on last second, for avoid race condition)
- Now can be spawned any Actor class, not Inventory only. However, items, which not able be owned (pick up), will be eat server resources if LifeSpan for them more then 0.

Update in first post: viewtopic.php?t=14014

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Sun Jun 04, 2023 12:14 am
by Dr.Flay
Why reinvent the wheel ?
Dropper by MrLoathsome viewtopic.php?t=2885

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Sun Jun 04, 2023 2:41 am
by Buggie
First time hear about it. Also look like it not able do, what this mutator do.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Thu Oct 26, 2023 6:03 pm
by Barbie
Barbie wrote: Sat Jun 03, 2023 10:12 am Is it possible to
3) Set spawned item's LifeSpan? With that I can easily show remaining time in HUD.
Sadly LifeSpan is not replicated to clients and so always 0 for them. Does anyone have any idea how to determinate if an item is a life time limited?

One idea is to iterate over all InventoryDestroyers, but they are not visible for clients and furthermore it would be an expensive polling.

Another idea is to raise a configurable event when item is given to a player:

Code: Select all

InventoryDestroyer extends Triggers config(GiftFromDecoration);
...
state Wait {
Begin:
	Sleep(0.1);
	If (Target != None) {
		if (TournamentPlayer(Target.Owner) != None)
		{
			Foreach AllActors(class'Actor', A, OwnerChangedEvent)
				A.Trigger(Target, Target.Owner);
			...
In my HUD class I can spawn a custom Actor that receives these events and adds or removes Target to/from a list.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Fri Oct 27, 2023 3:10 pm
by Buggie
You need spawn own actor and replicate it to client. There you can replicate LifeSpan, or do other stuff.
This need make your package client-sided.
This mutator purely server-sided and can't do such stuff.

Re: Mutator "Gift From Decoration" for MonsterHunt

Posted: Sat Oct 28, 2023 1:01 am
by Eternity
There is one odd way some mods use to replicate data through unused variables or through partially used variables...
A corresponding client-side script has to be aware of this, of course.

Though, being a kind of "hack" solution, such approach in general might be unacceptable in some cases...
The only proper way to do this - is through a dedicated actor for custom data replication.