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? ???
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[
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?
* 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.
only with my characters scripting name rite?
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.
It works but in wrong order, he says whatever i want him to say, gets the item then moves
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