Menu ▾ ▴

#228 Which Person's ACTIVATE_TALK script?

open
nobody
engine (98)
5
2005-07-21
2005-07-21
Anonymous
No

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

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Calculate where the input person would be if he moved
    forward the talk activation distance, and call
    GetObstructingPerson().

     
  • Tung Nguyen

    Tung Nguyen - 2006-09-13

    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/

     

Log in to post a comment.