I have set up a situation where my character walks to the edge of a cliff and starts flailing. I want to be able to click the walk icon on a hotspot below the cliff to make the character fall, and above the cliff to prevent the fall. However, I don't know how to override the walking, since "any click on hotspot" doesn't apply to the walk cursor.
I guess you could try:
if ((Mouse.IsButtonDown == true) && (mouse.mode == eModeWalkTo) && (mouse.y > 160) && (mouse.x > 390)) {
//fall off cliff
}
where the co-ords past x and y are where you have to fall off. You could also put mouse.x < and mouse.y > in there as well.
Sorry if this doesn't make sense. I'm in a bit of a hurry.
You could set the mouse.Mode to eModeInteract but change the cursor graphic to the walk mode's.
In the interact hotspot scripts of the two hotspots, check a global variable char_is_flailing you've set when the character reached the edge and react accordingly.
You'll probably have to prevent a right click from changing the mouse mode during that time, too.
After the character fell or got back on safe ground, change the cursor graphic/mode back to the default ones and reset char_is_flailing.
Quote from: Creator on Thu 06/12/2007 03:55:29
I guess you could try:
if ((Mouse.IsButtonDown == true) && (mouse.mode == eModeWalkTo) && (mouse.y > 160) && (mouse.x > 390)) {
//fall off cliff
}
where the co-ords past x and y are where you have to fall off. You could also put mouse.x < and mouse.y > in there as well.
Sorry if this doesn't make sense. I'm in a bit of a hurry.
Made sense, and I manged to get it to work, thanks!
Quote from: KhrisMUC on Thu 06/12/2007 04:04:45
You could set the mouse.Mode to eModeInteract but change the cursor graphic to the walk mode's.
In the interact hotspot scripts of the two hotspots, check a global variable char_is_flailing you've set when the character reached the edge and react accordingly.
You'll probably have to prevent a right click from changing the mouse mode during that time, too.
After the character fell or got back on safe ground, change the cursor graphic/mode back to the default ones and reset char_is_flailing.
You're solution is much more elegant (in my opinion), but as it requires more work, I'll have to try it sometime when I'm not in a hurry. Thanks for your help!
Might be too late, but you could also set up an on_mouse_click function in the room to capture eModeWalkto clicks on those Hotspots, e.g.:
function on_mouse_click(MouseButton button) {
if (button == eMouseLeft && mouse.Mode == eModeWalkto) {
Hotspot *H = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (H == hTop) {
//prevent fall
}
else if (H = hBottom) {
// Fall
}
if (H == hTop || H = hBottom) ClamEvent(); // Stops normal walkto click running
}
}
As with KhrisMUC's suggestion, you'll also need to make a check that the player is actually falling first (in fact, I think you'd need to do that with Creator's code as well), as clicking the Hotspots too soon could have weird looking results.
Quote from: Ashen on Thu 06/12/2007 11:32:58
Might be too late, but you could also set up an on_mouse_click function in the room to capture eModeWalkto clicks on those Hotspots, e.g.:
function on_mouse_click(MouseButton button) {
if (button == eMouseLeft && mouse.Mode == eModeWalkto) {
Hotspot *H = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (H == hTop) {
//prevent fall
}
else if (H == hBottom) {
// Fall
}
ClaimEvent(); // Stops normal walkto click running
}
}
As with KhrisMUC's suggestion, you'll also need to make a check that the player is actually flailing first (in fact, I think you'd need to do that with Creator's code as well), as clicking the Hotspots too soon could have weird looking results.
Ah, that's
exactly what I was looking for! :D
(I changed it slightly since I wanted it to claim the walk event no matter where you clicked.)
Thanks for the help!