This is an XY question, but I'm pretty sure if I can figure this out, the rest will follow.
Is it possible to "steal" something from the inventory of another player? For example, I would like to walk up to another player, interact with them somehow (either by pressing USE or by using a custom fist weapon) and by doing so take an inventory item out of their inventory and put it in my own.
+USESPECIAL tests on CustomInventory objects allows me to drop into an ACS_Execute on Use, but I don't know how to know who both the mark and the thief are. Using an ACS_Execute with a custom weapon has a similar problem.
Steal something from another player
Steal something from another player
The only limit to my freedom is the inevitable closure of the
universe, as inevitable as your own last breath. And yet,
there remains time to create, to create, and escape.
Escape will make me God.
universe, as inevitable as your own last breath. And yet,
there remains time to create, to create, and escape.
Escape will make me God.
- ZZYZX
- Posts a lot
- Posts: 742
- Joined: Thu Jun 07, 2012 5:56 pm
- Location: Ukraine
- Clan: A3
- Clan Tag: [A3]
Re: Steal something from another player
The thief is activator. The target player is either AAPTR_TARGET of the activator or can be calculated manually like here if later you also want to steal from containers and such.
The best/easiest way to activate stealing is somehow making the thief execute the steal script on pressed button.
This is done by either while(true)/Delay(1) enter script that constantly checks for a button being pressed (along with some other checks, for example "is player's weapon MyQuickHandsWeapon"), or by making a special item/weapon that runs the script when using it.
Now that isn't the main problem you have. The main problem you have is enumerating the list of items the target player has to steal one of them :)
The best/easiest way to activate stealing is somehow making the thief execute the steal script on pressed button.
This is done by either while(true)/Delay(1) enter script that constantly checks for a button being pressed (along with some other checks, for example "is player's weapon MyQuickHandsWeapon"), or by making a special item/weapon that runs the script when using it.
Now that isn't the main problem you have. The main problem you have is enumerating the list of items the target player has to steal one of them :)
quality DoomExplorer hackeringFilystyn wrote:Do you know what windows.h is? It's D, DWORD.
overcomplicated ZDoom grenade
random Doom things
GZDoomBuilder-Bugfix
Re: Steal something from another player
Finally found something that worked - in Zandronum 2.0 no less:
http://zdoom.org/wiki/SetActivatorToTarget
Thanks for at least pointing me in the right direction.
http://zdoom.org/wiki/SetActivatorToTarget
Thanks for at least pointing me in the right direction.
The only limit to my freedom is the inevitable closure of the
universe, as inevitable as your own last breath. And yet,
there remains time to create, to create, and escape.
Escape will make me God.
universe, as inevitable as your own last breath. And yet,
there remains time to create, to create, and escape.
Escape will make me God.
-
- Retired Staff / Community Team Member
- Posts: 2569
- Joined: Sat Jun 02, 2012 2:44 am
Re: Steal something from another player
In my mod I managed to make a way for players to steal weapons from each other via punching. The idea goes like this.
- In the first weapon, whenever it attacks, execute an acs script
- In the acs script use setactivatortotarget to find who the player is currently looking at
- If no target is there just stop the script
- Otherwise make sure the enemy player is in range
- Then get what weapon he is holding and take it from them and force their current weapon to be the fist via setweapon
- Then give a new copy of the stolen weapon you recorded to the original executor of the script.