pushing an object

Started by HandsFree, Sat 17/01/2015 16:12:12

Previous topic - Next topic

HandsFree

I'm trying to let the player character push an object. That is, the character walks from one point to another and the object is supposed to move along with the character.

I try to avoid making new walking views for the character where the object is part of the view.
Also I don't want to change the object to a character (and use the followcharacter command) because the game is setup to have the speech-icon available for characters and not for objects, so she suddenly would be able to talk to it.

I tried to set the object's coordinates relative to the character's in RepeatedlyExecute but that causes the screen to go flashing.

Any ideas how to do this?
thanks

Martyn

#1
I don't know if it exactly what you want, but I did a similar thing some time ago!

I made an object, a box. When you click the box, the character walk to it, the character change view to a push view.
My box was in perspektiv so the character feat was behind the box, so i only ned one view off the over body "push view".
Then i simply move both box "object" and the character with a script.
I think it was made that you should need to click on it 3 times to get it to the right spot.

I don't have the script left.

HandsFree

You moved the character? But then you don't see the walking animation...
I tried to let the character walk and then move the object, but the problem is that for that to work the character has to walk NoBlock. And that means the player can let the character move somewhere else half way and the object continues to move on its own.

MiteWiseacreLives!

I had some trouble with this too

Sliding topic

My solution was pretty complicated but in short I think you want a function that begins with the pushing walk command unblocked then start a loop that moves the object (blocking) a couple of pixels at a time the desired distance
Hope that helps

HandsFree

The walk can't be NoBlock because it would allow the player to let her walk somewhere else halfway.
What should happen is that when the interact-icon is used on the object the character walks to the object and then walks blocking to the destination point and the object moves along with her.

Is that possible at all?

Adeel

#5
Quote from: HandsFree on Sat 17/01/2015 17:16:07
I tried to let the character walk and then move the object, but the problem is that for that to work the character has to walk NoBlock. And that means the player can let the character move somewhere else half way and the object continues to move on its own.

If that's your problem, one solution might be to add a player.Moving check in your mouse button script. Ignore all the clicks when the player character is moving.

E: I forgot to mention that this method will work best only if used with the combination of ClaimEvent(). It will block all interactions during the duration of the movement of player character, otherwise.

Slasher

#6
A quick way to do it easily and it's a start. Maybe not the best but could work if set properly and will stop mouse clicks until move has been made. You could also Lockview with an animation (pushing) until move had been completed.

Example:
Code: ags

function obox_Interact()
{
 cEgo.Walk(obox. X-10,  obox.Y, eBlock, eWalkableAreas); // cEgo speed 4  delay 5
 cEgo.Walk(680, cEgo.y, eNoBlock, eWalkableAreas); 
 obox.Move(690, obox. Y, 1, eBlock, eWalkableAreas); // Box speed 1
}


This code has the player walk no block and the box move block.


MiteWiseacreLives!

Quote from: HandsFree on Sat 17/01/2015 19:47:16
The walk can't be NoBlock because it would allow the player to let her walk somewhere else halfway.
What should happen is that when the interact-icon is used on the object the character walks to the object and then walks blocking to the destination point and the object moves along with her.

Is that possible at all?
Slasher's solution is along the same lines as what I was going for
If you create the object.move(object.X+2, object.Y, eBlock) loop it will run until the object reaches it's destination and the char will walk behind it as it slides along(make the object solid )
And the player will not be able to walk away until the function is complete

Adeel

Please note that my suggestion would work best with ClaimEvent() function unless you want to block all the interactions when the player character is moving :-D! Sorry, should have clarified that earlier. I'll edit that post too. :-[

If there's only one object or few objects are needed to be moved, slasher's and MiteWiseacreLives! solutions are the best imho.


SMF spam blocked by CleanTalk