Several times when creating my game, I have come to a
situation where I want to ask "Which Person's
SCRIPT_ON_ACTIVATE_TALK script would be called if
the player pressed the action key now?" or "Which
Person's script would be called if the player pressed the
action key when his sprite was at (x,y,layer,direction)?"
If there is only 1 sprite in front of the sprite attached to
the input, this is a pretty trivial question to answer. But if
there are two, one slightly off to the side, for example,
which one would the action key trigger?
I would like to see a function to return the name of the
Person whose script would be triggered. I could script
this myself, if someone could tell me the algorithm used
to determine which Person is targetted.
Thankyou
Logged In: NO
Calculate where the input person would be if he moved
forward the talk activation distance, and call
GetObstructingPerson().
Logged In: YES
user_id=1206940
GetCurrentPerson() will return the name of the person to
which the event script is associated. Call it during one of
these for best results:
SCRIPT_ON_CREATE
SCRIPT_ON_DESTROY
SCRIPT_ON_ACTIVATE_TOUCH
SCRIPT_ON_ACTIVATE_TALK
SCRIPT_COMMAND_GENERATOR
Refer to the Spheriki for more details:
http://www.spheredev.org/