Walking Then Using

Started by , Thu 03/07/2003 20:50:52

Previous topic - Next topic

Ben_G7

how can i make my chracter walk up to a object before interacting with it?

Squinky

if you script:

MoveCharacterBlocking (EGO,x,y)
Wait (5);
other commands here

basically...

Ben_G7

What does the wait(5) mean?
And where do I script it.

Wolfgang Abenteuer

The Wait(5); means that it will pause the code for 1/8 of a second after the character gets to the hotspot (giving the effect of stopping before actually picking an object up, etc.).  The whole block of code that Squinky posted should be placed in the interact with object/hotspot function.

~Wolfgang

Ben_G7

I put this and it aint working it wont allow MoveCharacterBlocking.

// room script file

function object0_a() {
 // script for object0: Interact object
MoveCharacterBlocking (CIRCUM,287,165)
Wait (5);  
}

Wolfgang Abenteuer

#5
You did remember the semicolon after the MoveCharacterBlocking (CIRCUM,287,165) line, right?

Edit:  Also, looking at it again, you're missing a parameter.  There needs to be either a ,0 or a ,1 after the 165 where 0 will move him normally and 1 will move him directly to those coordinates (ignoring walkable areas).

~Wolfgang

Ben_G7

Hey this is my second time scripting.
By the way im Plog I just cant decide which name to use.

Ben_G7

It still wont work it wont accept the word Charchter Blocking part.

Wolfgang Abenteuer

Your script looks like this:

MoveCharacterBlocking(CIRCUM,287,165, 0);
Wait(5);

right?  What error message does it give you, exactly?

~Wolfgang

Ben

Quote from: Ben_G7 on Thu 03/07/2003 22:02:16
function object0_a() {
 // script for object0: Interact object
MoveCharacterBlocking (CIRCUM,287,165)
Wait (5);  
}

EDIT: You also forgot a semicolon. It should be MoveCharacterBlocking (CIRCUM,287,165,0);



Ben_G7

It does all the things that are supposed to be after it before it so he does the animation then walks over there??

MY SCRIPT:

MoveCharacterBlocking(CIRCUM,287,165,0);
Wait(5);

Scorpiorus

How do you animate him? Do you use interaction editor's action or a script function (AnimateCharacter)?

-Cheers

Bem_G7

I just used a quick animation no scripting needed. But can someone work out why mine is not working.

bspeers

#13
EDIT: Bah!  The two above posts were finished while I was writing this one. :P
--------------------------------------------------------------------------

There is no animation in your posted script.

If the animation is run *before* the walking script, animation will run before.

If the animation is run *after* the walking script, the animation will run after.

You must have created an animation first to play, which is handled through views.

I suggest you check out the script of the demo game to see how scripting is done and read through bits of the manual.  This is not an insult.  The manual is a really useful resource, and we can't possibly help you as much as it can (especially since at this point, there are a lot of fundamentals to cover).

Also, please read the "Read First" post at the top of this page as it has helpful hints as what to do when you need help.

Welcome aboard matey!
I also really liked my old signature.

Ben_G7

I manged to make it work almost he just dosnt do the animation I know ive go this script wrong but I dont know how can someone correct it for me.

 // script for object0: Interact object
MoveCharacterBlocking(CIRCUM,287,165,0);
Wait(5);
SetCharacterView(CIRCUM, 10);
AnimateCharacter(0, 1, 0);
ReleaseCharacterView(CIRCUM);
DisplayMessage(15);

Timosity

AnimateCharacter(CIRCUM,0, 1, 0);
while (character[CIRCUM].animating) Wait(1);

Scorpiorus

There was a reason why I asked about your having set an interaction editor option instead of AnimateCharacter() command. I suppose you build up an action list this way:

interaction.... (interact with object)
_____ Run script
_____ Character - run animation

The problem is that although run script is executed first the script itself is called last (because of AGS's handling one script at a time) so in reality you had: animation and then move.

So placing all commands inside a function instead will work therefore you use the right approach processing all actions through the script. With a bit change, as Timosity pointed out, it should look like:

// script for object0: Interact object
MoveCharacterBlocking(CIRCUM,287,165,0);
Wait(5);
SetCharacterView(CIRCUM, 10);
AnimateCharacter(CIRCUM,0, 1, 0);
while (character[CIRCUM].animating) Wait(1);
ReleaseCharacterView(CIRCUM);
DisplayMessage(15);

And welcome to the community! ;)

-Cheers

SMF spam blocked by CleanTalk