MODULE: Downhill v1.03 - Walk behind hills

Started by SSH, Tue 28/11/2006 17:24:50

Previous topic - Next topic

SSH

Following on from the issues in this thread, here is SSH's downhill module...

Lets you set some walkable areas as downhills, and assign Z values to walkable areas and walkbehinds, to let characters walk away from camera while actually increasing their Y.

Requires AGS 2.72

Download the Downhill module
Documentation for Downhill module
Module wiki page
12

fovmester

Very neat, SSH! I've done some downhills, but it is a pain to make up a new script every time. This module will surely be used by many people!

Da_Elf

one last bug. once you leave the room containing that you have left the walkbehinds deactivated. basically when i went into other rooms after my hill room none of the walkbehinds worked anymore.

SSH

Ah, OK. My test game didn't have this problem, as you could only leave the room from the frontmost walkable area which didn't mess with baselines anyway. I've fixed this in v1.02 which is up now.
12

Da_Elf

well. from what i can see its perfect now. lets hope we dont needs to see a version 1.03

Da_Elf

id hate to have to bring something else up. but if you have some characters who have only one loop and you dont have up and down loops to be swapped then you get a crash. Is there any way for it to swap the loops if the loops are available.

SSH

I might do that, but why not just create a dummy up loop the same as the single loop?
12

Da_Elf

thats what i had to do. for all the characters i had to make sure they all had an up loop.( even if it was just a blue cup)

SSH

I've fixed this problem an uploaded v1.03
12

Da_Elf

ooo. thats cool. will i have to change any script in my rooms or is it just the odule i should replace?

SSH

12

Da_Elf

BTW forgot to say thanks a hell of alot for this module

Ali

#12
I just tried to get this working in AGS 3.1.2, and perhaps because AGS has had some of it's limitations removed a few tiny changes needed to be made:

In the first 25 lines of script, the following need to be replaced:

AGS_MAX_CHARACTERS

AGS_MAX_FRAMES_PER_LOOP

I guess they need to be replaced with a number bigger then the number of characters in your game, and a number bigger than the maximum number of frames used in a loop. Just typing 1000 in their place got the demo working perfectly for me.

monkey0506

The values can be the same as the number of characters/loops present in the game, but if the value is any smaller then it won't work with all characters/loops. Depending on SSH's implementation it shouldn't produce any run-time errors or crashes (though it might) but would just be unavailable for those items.

Note to SSH:

Back when the limits on characters and other items was removed I found a workaround that might be useful to you:

Code: ags
// AGS 2.72 and earlier
int SomeArray[AGS_MAX_CHARACTERS];


Becomes:

Code: ags
// all versions of AGS
#ifdef AGS_SUPPORTS_IFVER
  #ifver 3.0
    #ifdef AGS_MAX_CHARACTERS // this shouldn't be defined, but just in case
      #undef AGS_MAX_CHARACTERS
    #endif
    #define AGS_MAX_CHARACTERS // don't supply any actual value
    #define IS_AGS_3
  #endif
#endif
int SomeArray[AGS_MAX_CHARACTERS];

function game_start() {
  #ifdef IS_AGS_3
  SomeArray = new int[Game.CharacterCount];
    #undef AGS_MAX_CHARACTERS
    #define AGS_MAX_CHARACTERS Game.CharacterCount // for use in conditionals, loops, etc.
  #endif
}

// end of script

#ifdef IS_AGS_3
  #undef IS_AGS_3
  #undef AGS_MAX_CHARACTERS
#endif


Noting of course that this method does not work with arrays inside of a custom struct since they cannot currently contain dynamic arrays. For that you would have to remove the array from the struct (possibly using multidimensional array indexing if needed).

It's a lot more work to do this than it was in older versions of AGS, but this method makes it backward compatible without having to rewrite large portions of your script.


Ali

I may be the only person interested in this but... I'm having trouble adapting the module to flip diagonal frames as well as up and down.

Wherever there is an up I've added an upleft and an upright, and the same for down, but I'm getting an error I don't understand:

I'm told there is an invalid loop specified in the function flip_me(Character *who, bool normal):

Code: ags

    ViewFrame *up=Game.GetViewFrame(who.View, 3, pass);
    ViewFrame *upleft=Game.GetViewFrame(who.View, 7, pass);  /// Invalid loop HERE
    ViewFrame *upright=Game.GetViewFrame(who.View, 5, pass);
    ViewFrame *down=Game.GetViewFrame(who.View, 0, pass);
    ViewFrame *downleft=Game.GetViewFrame(who.View, 6, pass);
    ViewFrame *downright=Game.GetViewFrame(who.View, 4, pass);


I don't understand that, because loop 7 is the upleft view. Any suggestions? I'll post the whole module if that's helpful.

Thanks,

Ali

Monsieur OUXX

#16
Sorry to dig out the thread.

MIRROR TO VERSION 1.03 ! http://duals.agser.me/Modules/Downhill_v1.03.rar [thanks to Dualnames]
(all older links are broken)

My personal version 1.04 https://www.dropbox.com/s/5uc9lnqgg7ardcd/Downhill%20v1.04.zip?dl=0
Version 1.04 notes :
- I upgraded from 2.x to 3.2.1, then from 3.2.1 to 3.3.0 RC1. It works like a charm.
- I re-defined macros that were missing since they disappeared from AGS
- I objectified the module ( DownHill.Functions(...) )
Overall, I almost didn't change anything, it was working out-of-the-box!


 

SMF spam blocked by CleanTalk