how can I define a characters view while over a certain region/walkable area?

Started by my2k, Wed 31/08/2016 07:58:39

Previous topic - Next topic

my2k

hi everyone, I've posted here before and got some great help, so after ages of searching for a solution and trying as many as I could find, none of them were really quite what I needed, and the solution must be simpler than I think.

I have a character who is to climb some vines. They walk normally until they're on the region(1) which is the vines, and I'd like to switch their view (1) to the view I have for "climbing" animation for that character, (8). I've used this code:

Code: ags
function region1_Standing()
{
   cMadia.LockView(8); ~~or~~ cMadia.ChangeVew(8);
}


that's supplied in the properties of that region but the second the character DOES switch to that view, but there's no animating while they move, and they move extremely slowly. Once I let up, if I move again, the view switches back to the normal walking view but again, no animation. How can get the view to animate, as it should, and how can I change how fast they move, if it doesn't simply reassign the normal walking view and keep all the rest of the settings? Here's a gif of what's occurring.


obviously, as they touch the ladder and vines, they should be in that view.

I've tried defining that "ladder and vines" area as a walkable area, however if I define the AreaSpecificView as that climbing view, it never sticks; it'll work when I first enter that walkable area but then never again once I stop for a second or if I change direction. I need it to stay on that view! The view has all the same frames as the normal walking view, so that shouldn't be a problem. Here's a gif of what's occurring:


I wouldn't mind reassigning the character's X and Y coordinate for this region/area, as well as how quickly they move, but I can tackle that later.

thanks everyone, your help would be amazing. If I need to clarify or add more info please let me know. :)

Andail

"While standing" would execute repeatedly, meaning there wouldn't be any time to actually animate. Why not use "walk onto" and then "walk off" to change the views accordingly?

my2k

Good idea. I gave that a try:

Code: ags

function region1_WalksOff()
{
  cMadia.ChangeView(1);
}

function region1_WalksOnto()
{
  cMadia.ChangeView(8);
}


but the views don't change. The first time entering that region the character is really slow, but changing direction or moving will get it going normally again... but, again, with the normal walking view. Which is the proper code I'm supposed to use? I've tried this with ChangeView, LockView, and just View and nothing works.

Slasher

The codes are correct.

Check your views.

'Stand on' does not get passed the first frame.

There are a number of ways to carry out this operation...

Like: stop moving, change view, auto walk y, change view..

my2k

I checked the view, yes, it is the right number and yes all the frames are there. There are a few weird hiccups that I don't think are explained just by the views being wrong.

If there are other ways to carry it out, can you think of an alternative I can use since this doesn't seem to work? Thank you :)

Slasher

As per last post...

or even Lockview, Animate and auto Move to y is yet another option.

Either way the view should be as it was changed to!

If it still fails you should post here all the room code.

my2k

yes, it should, but it doesn't seem to be.

As for those others, since LockView doesn't work either, can you tell me how to implement Animate? I've got that working elsewhere for one-time animations and I have no idea how to implement it here. I'm not much of a coder so I need help directly, that way.

edit: saw your edit, here is the whole room's code. Nothing more than what I originally pasted. It's a pretty simple room so far.


Code: ags

// room script file

function region1_WalksOff()
{
  cMadia.ChangeView(1);
}

function region1_WalksOnto()
{
  cMadia.ChangeView(8);
}



Slasher

Example of alternative method when walking onto and off the region (long way and it automatic)

Code: ags

if(player. View==1 && player.Loop==3){ // if player going up.. change loop to 0 if player going down.
player.StopMoving(); // As soon as player steps on region
player.LockView(8); // Changes player view to climbing when stepping on region
player.Animate(3, 4, eRepeat, eNoBlock)// animation loop 3 (up) will run until UnLockView(); 
player.Move(player.x,player.y-100,eBlock, eWalkableAreas); // player moves to y (change to y you require) before changing view back to walking view
player.UnLockView(); // player changes back to walk view 1
}

my2k

edit: oops it was a typo that caused the first problem

also, if I'm reading this code right, it means that the player will have no control when they're on the vines or ladders, it'll all be automated. That takes away a large part of the game, is there any other way? Does anyone have any idea why the view changing isn't working to begin with?

Slasher

As I said, it was an alternative way. What you have should work... when the player steps on the region it changes view to climbing, then when player steps off region the view changes back to walking. Have all climbing view loops been done?

There is usually something somewhere that is mucking this up, double check everything.

Also, if the regions walkable area is much wider than a vine it's going to look strange if you climb left or right (laugh)

my2k

hi there. I realized that I'm using a script module from here on the AGS forums, to provide a character with 8-directional movement. They mention the glitch in there and I have to set it to a separate view or the animation will freeze as I've experienced. I figured that out and it worked but, it works poorly with keyboard controls and still doesn't work very well. The original thread is YEARS old so I doubt there's little help I can ask for, there.

I guess I'm at an impasse and I don't know how to proceed. I'll have to find another way or just completely cut out vines and ladders completely.

Thanks for the help, sorry it didn't work out.

Snarky

AGS has built-in support for 8-directional movement, so if that's all you need the module for... you don't.

Slasher

As Snarky said.

You should have mentioned this in your first post...

my2k

That's interesting, I never saw any options for that kind of movement before the module existed. I didn't mention it because I didn't think it was relevant(and I hadn't remembered). Sorry for assuming.

Since I've never seen the eight directional movement mentioned once in the manuals or documentation, how do you implement it by itself?

Khris

Just add the diagonal loops to the character's main view. Then activate the setting in the character's properties.

http://www.adventuregamestudio.co.uk/manual/ags10.htm#topic10

SMF spam blocked by CleanTalk