Earliest reference to player upon picking up Weapon

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
User avatar
Nash
 
 
Posts: 17465
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia

Earliest reference to player upon picking up Weapon

Post by Nash »

When a Weapon is picked up, at which point is the earliest that the reference to the owner can be retrieved; is there a virtual I can override to have access to this information?
User avatar
insightguy
Posts: 1730
Joined: Tue Mar 22, 2011 11:54 pm

Re: Earliest reference to player upon picking up Weapon

Post by insightguy »

Nash wrote:earliest that the reference to the owner can be retrieved
I assume touching it.

Code: Select all

override void touch(Actor toucher)
	{
		//toucher = player
	}
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Earliest reference to player upon picking up Weapon

Post by Matt »

My first thought would have been TryPickup or AttachToOwner, but yeah Touch should be earlier than either of those (and I don't know if TryPickup is called if you spawn with the weapon, use the give cheat or a giveinventory function is called - Touch shouldn't be called in any of those)

Return to “Scripting”