Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Gregjazz on Sun 11/04/2004 02:58:18

Title: Suggestions for AGS
Post by: Gregjazz on Sun 11/04/2004 02:58:18
I've been doing some scripting and here are a few little things I ran into. It would be nice to have...

1. A few more sound channels. (not really THAT necessary, but all the same cool)
2. Non-looping ambient sounds (not sure if there's a practical way of scripting this)
3. RawDrawImageTransparent (like the normal RawDrawImage function, except you can specify the transparency level -- now this would be useful)

Anyways, I hope this is not too much to ask for, but I would be extremely grateful if these were implemented in AGS.

Thanks,

Geoffkhan
Title: Re:Suggestions for AGS
Post by: strazer on Sun 11/04/2004 04:15:25
1. I'd rather like to see more ambient sound channels. I know they're planned, so I hope we'll see them in the not too distant future.

Regarding 2, what would a non-looping ambient sound do that PlaySound doesn't?
Title: Re:Suggestions for AGS
Post by: Gregjazz on Sun 11/04/2004 05:07:14
Basically that way you'd be able to assign sounds to a location on the screen, and if the character is closer to those coordinates, the sound is louder and appropriately panned. I've needed that ability in several of my projects.
Title: Re:Suggestions for AGS
Post by: Scorpiorus on Sun 11/04/2004 10:54:40
Quote2. Non-looping ambient sounds (not sure if there's a practical way of scripting this)
You could use SetChannelVolume() to set a channel volume depending on the distance between the player and the sound origin then PlaySoundEx().

Quote3. RawDrawImageTransparent (like the normal RawDrawImage function, except you can specify the transparency level -- now this would be useful)
Already implemented in the current beta :)
Title: Re:Suggestions for AGS
Post by: Pumaman on Sun 11/04/2004 22:23:27
1. It's on my list - I'll try and get round to it at some point.

2. I think for this, Scorpiorus' workaround of doing it manually is the best solution. Ambient sounds are designed to repeat.
Remember that with the new repeatedly_execute_always you can adjust the volume even within blocking cutscenes.

3. As Scorp says, it's already in 2.61 beta 4
Title: Re:Suggestions for AGS
Post by: Gregjazz on Mon 12/04/2004 01:06:33
It's implemented in the latest beta! Rejoice! I thought it might have been... silly me!

I find that the SetChannelVolume doesn't always work. It's weird, I found that only channel 3's volume would change.
Title: Re:Suggestions for AGS
Post by: Gregjazz on Mon 12/04/2004 23:42:40
It always happens. I just download the current beta version of AGS and the next day a new version is released. Whatever. :)

I have one more suggestion:

I think it's been requested before, but I really need diagonal walkbehind baselines. I figured out a way to kinda script it, but it didn't support more than one character. For example, imagine a diagonal fence (from an isometric viewpoint). I need it so you can walk behind the fence and in front of it -- in fact I need it so that I could have one character behind it and another in front of it similtaneously.

Do you think you could make it so walkbehind baselines could be rotated? Or even better, they could be free-hand drawn?

It would be so helpful, thank you!
Title: Re:Suggestions for AGS
Post by: Pumaman on Tue 13/04/2004 18:16:20
This has been requested occasionally, but hasn't yet been implemented because it makes the baseline calculations significantly more complicated - at the moment, it'sjust a simple Y-coordinate check.
Title: Re:Suggestions for AGS
Post by: Gregjazz on Tue 13/04/2004 19:37:00
Hmmm. Sounds like a difficult programming problem.

Maybe what you could do is just forget about the whole "angle" of a baseline thing and just have a line or freehand? Really all I care about now is a custom baseline for walkbehinds.

I don't know. I've thought up a way around that which might work, I'll just have to experiment.
Title: Re:Suggestions for AGS
Post by: .. on Tue 13/04/2004 19:46:41
My suggestion would be that when you choose things like character start positions and walk to points you could do this visually like have a temporary version fo the character that you move around the room to where you want it and then press enter or whatevera nd it calculate the co-ordinates, cos im confused doing it manually. This is similar to the way you choose where objects are by moving them.

Only if you can though ;) Don't want to be a nuisance.
Title: Re:Suggestions for AGS
Post by: Gregjazz on Tue 13/04/2004 22:27:29
Well here's a handy trick for you:

Did you know you can right-click on the background and then click "copy coordinates into clipboard"? You can then hit shift+insert and paste it into whereever. Handy, no?

EDIT: By the way, the reason I needed that walkbehind baseline thing is because I have a diagonal fence (from Isometric view). There are more than one characters, so they must be able to go on both sides of the fence at a time. Any suggestions?
Title: Re:Suggestions for AGS
Post by: Rui 'Trovatore' Pires on Wed 14/04/2004 09:15:53
Geoffkhan  - About the fence, you could do a trick with regions. Have a region in front of the fence, another on the other side. Then, on rpeatedly_execute_always, check for character[X] being on the region behind the fence, and if it is store the character's number in, say, int charbehind. Then run something like

if (charbehind>=0) SetCharacterBaseline(charbehind,(and enter here the baseline for walking behind the fence).

Repeat the process for walking in front of it, making the baseline 0, of course.

Fiddle with this awhile, let me know if it works.

EDIT - I just figured out that the first check,
Quotecheck for character[X] being on the region behind the fence,
may not be easy to accomplish... I'll think about that.

EDIT 2 - I just decided that I have a tendency to complicate everything. I'll let someone else answer this. I doubt mu sugestion would have worked properly, anyway. Sorry about that, Geof.
Title: Re:Suggestions for AGS
Post by: strazer on Wed 14/04/2004 10:22:56
Works for me, redruM.
Here's what I did:

(http://www.strazer.net/ags/diagwb.gif)

Player walks onto region:
SetWalkBehindBase(1, 240); // Player always behind walkbehind

Player walks off region:
SetWalkBehindBase(1, 0); // Player always in front of walkbehind

EDIT: Oh, for two characters?

Well, then. How about the setup above and


// room script

#define WALKBEHINDBASE 170 // Y-coordinate of diagonal walkbehind baseline

function repeatedly_execute_always () {

  int charid = 0; // start with character 0
  while (charid <= GetGameParameter(GP_NUMCHARACTERS, 0, 0, 0)) { // loop for each character
    if (character[charid].room == character[GetPlayerCharacter()].room) { // if character is in the current room
      if (GetRegionAt(character[charid].x, character[charid].y) == 1) // if character stands on region 1
        SetCharacterBaseline(charid, 0); // reset character's baseline, i.e. behind walkbehind
      else // if character does NOT stand on region 1
        SetCharacterBaseline(charid, WALKBEHINDBASE + character[charid].y);
          // set character's baseline in front of walkbehind, but behind other characters
      charid++; // loop to next character
    }
  }

}


instead?
It's a bit clumsy, but I don't know how else to do it.

The manual states the maximum value of SetCharacterBaseline as the room height. Seems to work ok though.

Edit 2:

Updated code, still haven't tested it.
Title: Re:Suggestions for AGS
Post by: Kweepa on Wed 14/04/2004 15:46:01
I did something like this in IIISpy in the jail cell.
Dog character on one side, bars object in middle, player on the other side.
Worked fine.
Title: Re:Suggestions for AGS
Post by: Gregjazz on Thu 15/04/2004 21:27:49
Oh, never mind, I got the diagonal fences working!
Title: Re:Suggestions for AGS
Post by: strazer on Thu 15/04/2004 21:29:43
So what's your solution to the problem?
Title: Re:Suggestions for AGS
Post by: Rui 'Trovatore' Pires on Thu 15/04/2004 21:34:40
(not that the fact that Geof has found a way around it, and so can we all, means that it wouldn't be REAL useful to have diagonal walkbehind baselines... ::) ::) ::)
Title: Re:Suggestions for AGS
Post by: Gregjazz on Thu 15/04/2004 22:45:34
By manipulating the character baselines when they are in a certain area. What you do is put the baseline for the walkbehind to like 2, and then when a character is not behind the walkbehind, it sets the character baseline to 0 (0 sets the baseline to the default). When a character goes behind the baseline, it sets his baseline to 1, therefore putting him behind the walkbehind.
Title: Re:Suggestions for AGS
Post by: strazer on Thu 15/04/2004 23:03:10
Ah, ok. Mine is just reversed with characters overlapping correctly when they're both in front (or behind in your case).