breaking the walk to the walkto-point

Started by Pau, Thu 30/09/2004 01:34:42

Previous topic - Next topic

Pau

When I click on something I want the character to move there and then perform an interaction, but if the player clicks anywere while the character is walking, both (the movement and the interaction) should be cancelled.

It's any simple form of doing this? O have I to control that by hand checking the last clicked element (to know that it's the current transacton), the .walking status (to know if the destiny has been reached) and the position of the character (to know if has arrived to the point), for every object/hotspot/character in the game?
paused -- get the startup menu creator (version 1.1) for AGS games. (Use save target as..)

Goot

#1
I'm not sure if you're up to scripting yet but here's a way to do it. Make a walk to point for the hotspot and in the hotspot interaction script, do

SetGlobalInt(//unused globalint #,0);

In repeatedly execute, write this script:

if((character[GetPlayerCharacter()].walking)==0)&&(GetGlobalInt(//same int #)==0)){
code for interaction
}

in the global script under on_mouse_click

function on_mouse_click(){
SetGlobalInt(int #,1);
//then there's a bunch of other stuff already there, leave it.
}

I would actually recommend blocking the game and making it so the player can't do anything while the character it moving.

In the hotspot code:

MoveCharacterBlocking(GetPlayerCharacter(),coordinates of move x,y,0);
hotspot interaction code here

prowler

i'm also interested in this.

Goot, i think you missed the point (or at least one of us did :) )
here's how your script would work (i think):
-player clicks on a hotspot
-on_mouse_click is called -> int becomes 1 , process click is called
-the click is processed -> hotspot interaction script -> int becomes 0

from then on, the game behaves just like before, and i don't see of what use the repeadedly execute bit is.

QuoteI would actually recommend blocking the game and making it so the player can't do anything while the character it moving.
this proves that you got it wrong, the player is supposed to be able to stop the character while it's moving

i also think that Pau meant clicking on ANY hotspot (or character or anything else)  should behave like in monkey island & co, ie it shouldn't block the game until the interaction (or the unhandled_event message) has taken place.

Pau

I think goot misunderstood the problem, maybe I didn' explained it wery well.
The idea is to allow the character to cancel the movement to the hotspot and the assigned interaction isn't performed.
So the movement should be non-blocking(in order to be interrupted) but the interaction should only be performed if the movement has been completed.

I hope now things would be more clear.
paused -- get the startup menu creator (version 1.1) for AGS games. (Use save target as..)

Scorpiorus

#4
Yeah, generally you have to store the action in a variable to perform it after the character reached his destination.

Another solution may be to block the further execution of script but constantly check if the canceling button is pressed, here is the thread:

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=6587.0

EDIT:

BTW, since there is repeatedly_execute_always that was added we can put an "if (IsButtonDown && player.walking)" checks within it.

Pau

Scorpiorus, thanks for the reference.
paused -- get the startup menu creator (version 1.1) for AGS games. (Use save target as..)

Ishmael

I'm working on this exact same thing (quite more complicated though), and it worked pretty well, untill upgrading AGS messed something, and I'm in a state of some serious debugging. When I get my game done I can maybe clean the code and post here for reference...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scummbuddy

dont forget you can always download proskritos templates and check how he did it.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Rui 'Trovatore' Pires

If anyone cares, here's how I did it -

I used custom properties to give each object and hotspot a number that serves as the X coordinate and another that serves as the Y coordinate of a fictional walk-to point. Whenever needed, the game checks these two numbers and moves the player towards them. Now, prior to that movement, the game had stored the action the player intended, and with repeatedly_execute_always, the action will take place once the player gets there. Or, if on_mouse_click is activated somewhere alng the way, it'll get aborted.

Heck, it works for me. And I always DID go for the most needlessly complicated route... :P
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk