Hi,
It's not clear to me how you can cancel an action in the tumbleweed template.
If I do this:
if(Verbs.UsedAction(eGA_LookAt)) player.Say("I've looked at it.");
The player walks blocking to the hotspot and it is not possible to do anything until the walking is finished and the line said.
If I do:
if(Verbs.UsedAction(eGA_LookAt)){
if(Verbs.MovePlayer(290,123)) player.Say("I've looked at it.")
}
Then it is possible only to click somewhere else and walk there, but not to choose an action on another hotspot. The 9 verbs are still not available while the walking is happening.
So how do I make it possible for the player to choose a different action?
thanks
I have no idea what in the first snippet is blocking the game (except the Say command, obviously).
The second snippet is basically fine, however I do this:
function oBlueCup_AnyClick()
{
if (Verbs.MovePlayer(170, 134)) {
// LOOK AT
if(Verbs.UsedAction(eGA_LookAt)) {
player.Say("It's a blue cup.");
}
// don't forget this
else Verbs.Unhandled();
}
}
This works as expected, and the walking can be canceled by clicking elsewhere.
I've also posted a more extensive example just a few days ago: https://www.adventuregamestudio.co.uk/forums/index.php?topic=59221.msg636637353#msg636637353
Edit: I realized the requirement is to cancel the walk by clicking an action button.
I've looked into this and it's possible to add something like:
else if (mouse.IsButtonDown(eMouseLeft) && GUI.GetAtScreenXY(xm, ym) == gMain) {
player.StopMoving();
movement_canceled = true;
}
to VerbGui.asc, line 1609, however this will only cancel the walk, not actually activate the clicked verb.
I tried to add a gMain.ProcessClick() line however it didn't have any effect. I suppose it needs to be slightly delayed so AGS can quit the MovePlayer function first.
Ok, thanks.
This works mostly. The problem was the setting automatically move player in walk mode was true.
What is still not how I expected, if I do this:
function Tree_AnyClick()
{
if (Verbs.MovePlayer(160, 135)){
if (Verbs.UsedAction(eGA_LookAt)) {
player.FaceLocation(160, 125, eBlock);
player.Say("It's a large elm tree.");
}
}
Then the player walks to the tree while the action labels shows 'look at tree'.
If I then move the cursor to the mountain the label keeps showing 'look at tree', but if I (right)click , the mountain function fires. So the label isn't updated.
Also during walking the 9 verbs are unclickable.
Is there any way to fix that?
thanks
All of this can be solved by implementing the interruptible walk differently, like I did in my GotThere module (store click, send player off using Walk/eNoBlock, check for the player reaching the location in rep_ex, execute click).
The Tumbleweed template still uses the while loop approach, which means that AGS is stuck inside a function while the player approaches the location, effectively disabling all GUI stuff.
My suggestion would be to post in the official template thread (https://www.adventuregamestudio.co.uk/forums/index.php?topic=54762.0), so Abstauber can consider implementing this change.