Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
ArsonBurger

Decoration Giving Player Keycard

Question

So, I'm trying to create a switching decoration modeled after a scientist with a keycard, and I can't seem to figure out one thing. When the player interacts with the scientist, I'd like the keycard to disappear from the sprite and for the player to get the keycard in their inventory. So far, everything works except for the part where the player gets the keycard. How would I fix this? Here is my code so far:

ACTOR KeycardScientist: SwitchingDecoration 20028
{
	Radius 16
	Height 100
	+SOLID
	+USESPECIAL
	Activation THINGSPEC_Activate

	States
	{
	Spawn:
		SCIK A 1 A_checkproximity("Spook",DoomPlayer,150,1,CPXF_NOZ)
		loop
		
	Spook:
		SCIK B 20
		goto shaken
	
	Shaken:
		SCIK CD 3 
		loop
		
	Active:
		SCIK EF 3 A_giveinventory(RedCard)
		goto takenkey
		
	Takenkey:
		SCIK EF 3 
		loop
	
	Inactive:
		SCIK CD 3 
		loop
		
	}
}

Any help is appreciated!

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 0
Quote

Adds amount items of type type to the calling actor's inventory.

 

The calling actor is your scientist NPC.

 

Try A_GiveInventory("RedCard", 1, AAPTR_PLAYER1) to force it to give to PLAYER1.

 

Alternatively, you can try changing Activation THINGSPEC_Activate to Activation THINGSPEC_Activate|THINGSPEC_TriggerTargets to get the scientist to target the player who "use" it and then A_GiveInventory("RedCard", 1, AAPTR_TARGET) to give to the scientist's target. This would work more naturally in multiplayer (so if it's player 3 who goes to the scientist, it's player 3 who gets the key, not player 1).

Share this post


Link to post
  • 0

Hmmm. The wiki shows it like this: TNT1 A 0 A_GiveInventory ("RedCard") ……….using the blank TNT thing instead of a sprite. I honestly don't think it should matter, but try it, who knows:)

 

like this:

SCIK EF 3

TNT1 A 0 A_GiveInventory ("RedCard")

Share this post


Link to post
  • 0
17 minutes ago, Payload4367 said:

Hmmm. The wiki shows it like this: TNT1 A 0 A_GiveInventory ("RedCard") ……….using the blank TNT thing instead of a sprite. I honestly don't think it should matter, but try it, who knows:)

 

like this:

SCIK EF 3

TNT1 A 0 A_GiveInventory ("RedCard")

that didn’t work either. good idea though, zdoom does tend to work like that

Share this post


Link to post
  • 0
43 minutes ago, Gez said:

 

The calling actor is your scientist NPC.

 

Try A_GiveInventory("RedCard", 1, AAPTR_PLAYER1) to force it to give to PLAYER1.

 

Alternatively, you can try changing Activation THINGSPEC_Activate to Activation THINGSPEC_Activate|THINGSPEC_TriggerTargets to get the scientist to target the player who "use" it and then A_GiveInventory("RedCard", 1, AAPTR_TARGET) to give to the scientist's target. This would work more naturally in multiplayer (so if it's player 3 who goes to the scientist, it's player 3 who gets the key, not player 1).

ah, that did it. thank you very much!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×