activate script when player hits +USE key

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
blender81
Posts: 49
Joined: Fri Feb 20, 2004 6:13 pm
Contact:

activate script when player hits +USE key

Post by blender81 »

I posted this topic about a year ago, and in light of all the new zdoom/acs features, I figured asking again was worth a shot.

Is there a way for a script to determine when the player hits the +USE key? I'm implementing a conversation system, and I think it'd be great if the player could simply face someone, press +USE, and a conversation dialog tree popped up.

One alternative is to keyconf a new puke bind, but I'd really prefer to have one general +USE key the player uses to talk/opendoors/bark/etc.

Currently, I am placing a "player use" SectorThing in every sector that contains a talking person. It works, but is far from ideal.

Any ideas?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49223
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Your approach is probably the best solution without overkilling the engine. You won't have that many people to talk to anyway, don't you?
blender81
Posts: 49
Joined: Fri Feb 20, 2004 6:13 pm
Contact:

Post by blender81 »

The problem with the SectorThing solution is: I'd like for the player to be able to hit +USE to initiate and exit conversations.

Initiating the conversation is not a problem; it's just a simple check to see if the target character is in range & is currently visible. The player is frozen with APROP_FROZEN.

However, if the player had momentum while hitting the +USE key, they could easily "slide" into the neighboring sector (since aprop_frozen doesn't immediately lock the player in place), thus making the +USE key null again. The solution to this is to either make ridiculously large sectors, or, place the SectorThing into every neighboring sector, both fairly ugly solutions.
Linguica
Posts: 50
Joined: Thu Nov 13, 2003 6:00 pm

Post by Linguica »

You could spawn a camera at the player's location and move the player to a sector somewhere off the map with a sectorthing in it that will teleport him back. Since the player is frozen it doesn't matter that the camera can't turn. The weapon would vanish but since the player is talking to someone he would put away his gun anyway.
Locked

Return to “Editing (Archive)”