Object Interactions - Any click on object

Started by Oz, Mon 02/08/2004 21:41:18

Previous topic - Next topic

Oz

Whenever the player clicks on an object/hotspot (regardless of what cursor mode is active) I would like the character to move up to the object/hotspot and face its direction. I know this can be done fairly easy in the Interactions Editor for each object/hotspot, but is there anyway I could put these two functions (move to and face location) somewhere in the script so that I don't have to add them to each and every interaction in the interactions editor (look at, use, pick up, etc)?

I have noticed the "Any click on object" will execute a command regardless of what cursor mode is active, but it tends to be run AFTER any other command assigned to any of the other cursor modes (in the Interactions Editor). For example, if I pick an object up, the commands under "Pick up object" in the Interactions Editor will be run BEFORE the commands under "Any click on object". Can I make it so that the commands under "Any click on object" is always executed BEFORE the other interaction modes?

If I could make these two commands (walk to and face) run as default for each cursor mode (before any other command) it would save me a lot of time.

Hmmm. This got a bit messy. I hope someone understands what I am getting at. ;)
Diversity is divine!

Skio

I have an idea. In the on_mouse_click function put:

if (GetCursorMode()==MODE_WALK) ProcessClick(mouse.x, mouse.y, MODE_WALK);
else {
  MoveCharacterBlocking(...
  FaceLocation(...
  ProcessClick(mouse.x, mouse.y, MODE_WALK);
}

Notice however that I have left the two first commands open. Because the x&y and the direction facing will be different in each case, you have to figure out a way to calculate them, perhaps by assigning x,y variable to the hotspots and possibly comparing them to the character's x,y.
Î'νδρων Επιφανων Πασα Î"η ΤαφοÏ,

Oz

Quote from: Skio on Mon 02/08/2004 22:11:16
I have an idea. In the on_mouse_click function put:

if (GetCursorMode()==MODE_WALK) ProcessClick(mouse.x, mouse.y, MODE_WALK);
else {
Ã,  MoveCharacterBlocking(...
Ã,  FaceLocation(...
Ã,  ProcessClick(mouse.x, mouse.y, MODE_WALK);
}

Notice however that I have left the two first commands open. Because the x&y and the direction facing will be different in each case, you have to figure out a way to calculate them, perhaps by assigning x,y variable to the hotspots and possibly comparing them to the character's x,y.

Hmmm. Could work... somehow. ;)

I'll try it out. :)
Diversity is divine!

Radiant

FaceLocation (EGO, mouse.x, mouse.y) usually works.
And there's WalkToHotspot() which moves to a hotspot's location.
For objects, there's WalkToObject(), which unfortunately moves to an object's lower left corner.

SMF spam blocked by CleanTalk