Hi
In my game interface, when the character USES or PICKS something, he walks to it, then perform the action
in the on_mouse_click( , I just did
cEgo.Walk (mouse.x, mouse.y);
ProcessClick(mouse.x, mouse.y, eModeInteract);
while (cEgo.Moving) Wait(1);
( I use Wait AFTER the processclick, because if I move the mouse during the walk, It wont processClick at the correct place ) , that's why I haven't used the eBlock argument ... Well
When I WAIT(1), all other script is halted, the problem is that in some rooms, objets are animated and their coordinates are calculated from the moving player coordinates ...
What happens is that the move occurs AFTER the walk&wait action mentionned before.
I would like to find some trick to let the script that relocate all the objects, CONTINUE during my walking delay.
This pecular script is run in the room_RepExec() of the room.
thank you
try storing the mouse coordinates before you run the walk.
int mousex = mouse.x;
int mousey = mouse.y;
cEgo.Walk (mousex, mousey, eBlock);
ProcessClick(mousex, mousey, eModeInteract);
untested but thats the jist of it.
There's the "No-block" module which might be exactly what you need here. Just look it up in the search. :D
It's a relly fun module and also has some cool things, and options to set. Trust me, it's worth it.
You can also try my GotThere module (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=36383.msg477380#msg477380).
for calin :
yup that would work thanks, I already tryied it.
but my problem ( and question ) is to go on running alternate scripts DURING the eBlock thing ...
eBlock, or Wait, halts everything until ended.
Dualnames
Okay I ll find and try it.
Quote from: Pierceval on Sun 21/03/2010 15:59:36
Dualnames
Okay I ll find and try it.
In case you don't find a working link, I have a version of it.
Hey, I will shut this thread as I managed to create the effect I wanted.
I tryied both : GotThere & NoBlock Module.
( Noblock 0.7 it out to date but you just have to change some definitions ... )
Anyway that worked , but as I already handled the mouse clicks, I had to recreate all this in the modules ( as I dont use a standard clicking and "nextmode" method )
This is how I did :
purpose : walk non bloking towards a destination point. Wait to arrive, then do the required action. ( without blocking = you can change direction or action at anytime, as the mouse cursor is still active )
1/ // in the mouse handling function
mousex= mouse.x; // registered to be used on arrival
mousey=mouse.y;
cEgo.Walk (mousex, mousey, eNoBlock); // non blocking walk
// the problem was that I ProcessClick on the line right after ... so the player did the action BEFORE moving at all ( as it was non blocking ), and if blocked, that worked, but you can"t do anything during the walk.
waitforprocessclick = true ; // bool to tell the game : I CLICKED FOR A WALK + ACTION !
2/ in the repeatly_execute function of the main script I added :
if ( waitingforaprocessclick ) { // the character is moving after receiving a right click
if (!cEgo.Moving) // arrived
{ // mousex & mousey were set at the right click
ProcessClick(mousex , mousey, eModeInteract); // I can now do the action.
waitingforaprocessclick = false;
}
}
3/ at the very beginning or on_mouse_click, I set waitingforaprocessclick = false; , for me, as any click cancels the previous intended action.
hoplĂ !