Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Sat 17/01/2004 19:56:08

Title: Regarding moving of characters to objects
Post by: on Sat 17/01/2004 19:56:08
for example: there is something on the floor, I interact (pick it up) with it. How do i make it in the script so that the player moves towards it? ???
Title: Re:Regarding moving of characters to objects
Post by: Darth Mandarb on Sat 17/01/2004 20:15:01
I think this'll get moved :)

MoveCharacter commands will work for this.

MoveCharacterBlocking is what I use ... it takes playable control away until the character reaches where you're going.

Example:
MoveCharacterBlocking(EGO,100,100,0);
// This'll move EGO to x100,y100 using available walkable areas.
MoveCharacterBlocking(EGO,100,100,1);
// This'll move EGO to x100,y100 directly (Like MoveCharacterDirect command) ignoring walkable areas.

The reason you'd want to use blocking is 'cause he'll move over to the object, then pick it up.  Other wise he'd pick it up before getting there!

])]V[
Title: Re:Regarding moving of characters to objects
Post by: on Sat 17/01/2004 20:48:10
Quote from: Darth Mandarb on Sat 17/01/2004 20:15:01
I think this'll get moved :)

MoveCharacter commands will work for this.

MoveCharacterBlocking is what I use ... it takes playable control away until the character reaches where you're going.

Example:
MoveCharacterBlocking(EGO,100,100,0);
// This'll move EGO to x100,y100 using available walkable areas.
MoveCharacterBlocking(EGO,100,100,1);
// This'll move EGO to x100,y100 directly (Like MoveCharacterDirect command) ignoring walkable areas.

The reason you'd want to use blocking is 'cause he'll move over to the object, then pick it up.  Other wise he'd pick it up before getting there!

])]V[

where abouts do i put it?
Title: Re:Regarding moving of characters to objects
Post by: Darth Mandarb on Sat 17/01/2004 21:11:37
* Click on Interactions for the object you want to use.
* Select the interaction you want (ie Interact with Object, Look Object, Talk Object)

Now at this point you can do it a couple of ways.
1) select all the interactions you want from the list -or-
2) Select 'Run Script' and manually script the actions.

I prefer manually scripting.  So if you select Run Script you would put the code I put above in there.
Title: Re:Regarding moving of characters to objects
Post by: on Sat 17/01/2004 21:13:37
only with my characters scripting name rite?
Title: Re:Regarding moving of characters to objects
Post by: Pumaman on Sat 17/01/2004 23:03:52
Yes, if your character script name is not EGO, replace it with whatever it is.

To begin with, you might find it easier to use the "Character - Move Character" interaction command rather than a script to do this.
Title: Re:Regarding moving of characters to objects
Post by: on Sun 18/01/2004 10:54:42
It works but in wrong order, he says whatever i want him to say, gets the item then moves
Title: Re:Regarding moving of characters to objects
Post by: Scorpiorus on Sun 18/01/2004 13:51:46
You probably combine interaction comands and run-script, right? In that case (due to the technical side of how AGS script works) the run-script action is always executed last, no matter of its actual order in list. Also, check for Wait for move to finish to be true.

Try to do it as Pumaman suggested:

object interaction - pick up:

...Pick up object (or Interact)
.............Character - Move character (EGO,...,true)
.............Game - Display a message ()
.............Player - Give the player an inventory item ()


~Cheers