Hello, I have a little question for Zimond...
Do you plan to add «on collision»› event to the scripts? I think it will be very useful for mini-games creating, also for adding action-elements to adventure games.
____________________________________
Also, i have some problems with creating sequence of actions without special game commands. for example:
«
on (click)
{
walkto ( zb; 35;28; )
setobj ( en; 0 )
}
»
There's character must go to object, and next command must be executed AFTER his ariving (after «walkto» command). But they all executes at the same time, object changes it’s state before character comes closer to it. So, now i use «minicut()» command on the first part of script, but it's not what i want, because player loses control during cutscene...
P.S. excuse me my english, if it's terrible
Suggestion and question
Solutions that I regard as possible:
Solution A:
You said that you don't want the player to lose control about the character, but if you use the code you posted, the script won't wait for the walkto() to end.
Solution B:
First, count the seconds of how long the walkto() takes. Let's call it <W> for instance.
I'm not sure if the timer() works without a cutscene though.
Solution C (probably the best one):
Doubleclick on the walkmap field (35;28 ) in the room window and enter the followig code:
Solution A:
Code: Select all
on (click)
{
minicut(donthide)
walkto ( zb; 35;28; )
setobj ( en; 0 )
}
Solution B:
First, count the seconds of how long the walkto() takes. Let's call it <W> for instance.
Code: Select all
on (click)
{
walkto ( zb; 35;28; )
timer(<W>)
setobj ( en; 0 )
}
Solution C (probably the best one):
Code: Select all
on (click)
{
walkto ( zb; 35;28; )
setbool (walking; true)
}
Code: Select all
if_bool (walking; true)
{
setobj ( en; 0 )
setbool(walking;false)
}
Thanks for your reply.
So, «solution B» is not suitable, because a time for which a character comes to the object may be different.
«Solution C» has two disadvantages: 1. If player don’t reach walkmap field (35, 28) (clicks to another place) bool remain «true». 2. Have to create bool variables for each object in the game.
So, I will still use «solution A». Control loss, I think, is not such important =\
So, «solution B» is not suitable, because a time for which a character comes to the object may be different.
«Solution C» has two disadvantages: 1. If player don’t reach walkmap field (35, 28) (clicks to another place) bool remain «true». 2. Have to create bool variables for each object in the game.
So, I will still use «solution A». Control loss, I think, is not such important =\
Sometimes it's annoying. In Jimmy the Squatter it's implemented in the doors. If you use a door you loose the control of your character and you can't abort the event by clicking somewhere else.trq wrote:Control loss, I think, is not such important =\
It's not that bad, but sometimes it's just annoying.
I have an idea of another solution...
It's quite circumstantial... but it would work.
In your object-Script you should write:
The function "checkifarrived" should contain:
I don't know what Z is in your game, this depends on your game-resolution. But you have to figure that out and it would work .
Have fun ^^
It's quite circumstantial... but it would work.
In your object-Script you should write:
Code: Select all
on(click)
{
setnum(x;something)
setnum(y;something)
setstring(object;objectname)
walkto(self;[x];[y])
function(checkifarrived;infinit)
}
Code: Select all
setnum (WalkmapX ; [charx:yourchar]/Z)
setnum (WalkmapY ; [chary:yourchar]/Z)
setnum (WalkmapX ; +1)
setnum (WalkmapY ; +1)
if_num(WalkmapX;[x])
if_num(WalkmapY;[y])
{
setobj([objectname];0)
stopfunction(checkifarrived)
}
wait(0,01) (* optional, if you want to keep performance when a lot of different functions are running *)
Have fun ^^