Jibble

Author Topic: how can I define a characters view while over a certain region/walkable area?  (Read 1264 times)

my2k

  • Posts: 16
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: Adventure Game Studio
  1. function region1_Standing()
  2. {
  3.    cMadia.LockView(8); ~~or~~ cMadia.ChangeVew(8);
  4. }

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

  • Global Moderator
  • Posts: 6,292
  • Cultured man of mystery
    • I can help with backgrounds
    • Andail worked on a game that was nominated for an AGS Award!
"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

  • Posts: 16
Good idea. I gave that a try:

Code: Adventure Game Studio
  1. function region1_WalksOff()
  2. {
  3.   cMadia.ChangeView(1);
  4. }
  5.  
  6. function region1_WalksOnto()
  7. {
  8.   cMadia.ChangeView(8);
  9. }
  10.  

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

  • Posts: 2,756
  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
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..
« Last Edit: 31 Aug 2016, 09:04 by slasher »

my2k

  • Posts: 16
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

  • Posts: 2,756
  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
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.
« Last Edit: 31 Aug 2016, 09:09 by slasher »

my2k

  • Posts: 16
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: Adventure Game Studio
  1. // room script file
  2.  
  3. function region1_WalksOff()
  4. {
  5.   cMadia.ChangeView(1);
  6. }
  7.  
  8. function region1_WalksOnto()
  9. {
  10.   cMadia.ChangeView(8);
  11. }
  12.  
  13.  
  14.  
« Last Edit: 31 Aug 2016, 09:17 by my2k »

Slasher

  • Posts: 2,756
  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
Example of alternative method when walking onto and off the region (long way and it automatic)

Code: Adventure Game Studio
  1. if(player. View==1 && player.Loop==3){ // if player going up.. change loop to 0 if player going down.
  2. player.StopMoving(); // As soon as player steps on region
  3. player.LockView(8); // Changes player view to climbing when stepping on region
  4. player.Animate(3, 4, eRepeat, eNoBlock)// animation loop 3 (up) will run until UnLockView();
  5. 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
  6. player.UnLockView(); // player changes back to walk view 1
  7. }
  8.  
« Last Edit: 31 Aug 2016, 09:44 by slasher »

my2k

  • Posts: 16
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?
« Last Edit: 31 Aug 2016, 09:34 by my2k »

Slasher

  • Posts: 2,756
  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
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)
« Last Edit: 31 Aug 2016, 10:02 by slasher »

my2k

  • Posts: 16
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

  • Global Moderator
  • Posts: 6,750
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
AGS has built-in support for 8-directional movement, so if that's all you need the module for... you don't.

Slasher

  • Posts: 2,756
  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on a game that was nominated for an AGS Award!
As Snarky said.

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

my2k

  • Posts: 16
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

  • Posts: 10,676
  • having to deal with what games are going through
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on a game that was nominated for an AGS Award!
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
« Last Edit: 01 Sep 2016, 11:39 by Khris »