Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - tor.brandt

#1
So, the Random command returns a random number between 0 and MAX.
But how would I make it return a random number between some specified minimum value higher than 0 and MAX?
#2
Presenting
A Place In The Sun










Details:
320x200 resolution
32-bit colours
Original music score
Chatter-free (no speech)
30-45 minutes gameplay
Game entry page

A big thank you to my great testers, slasher, Creamy, Grok, xBRANEx & arj0n who helped make this game so much better!

DOWNLOAD NOW
DOWNLOAD MIRROR
#3
I want to make a firefly object that flies around randomly within a restricted area.
I'd like the movement to be 'soft' and 'rounded', such that it doesn't just fly from one random x,y coordinate to the next in a straight line, but makes more of a half-circle kind of motion between the points, to imitate the way insects move.

In principle I COULD find the needed commands in the manual myself, but I'm really not very good at understanding mathematical expressions (and I take it I will need some of those), which is why I'd like to hear if someone has an idea for how I could write such a function?

Thanks :-D
#4
I have assigned different volumes for each sound in my game, to make a balanced sound experience.

I have a GUI slider that allows the player to control the SFX volume of the game, and now I just noticed that (of course) when I use this slider, all the sounds are assigned the same volume, and then keeps this volume for the rest of the game (unless I slide the slider some more, of course, in which case they're all assigned this new value).

Is there a way to keep my different volumes for each sound, while still allowing the slider to control the master SFX volume?

Another solution would of course be to edit all the sound files, and make them the correct volumes relative to each other before importing them anew - but before I resort to that, I'm interested in knowing if I can fix it in some other way (although of course this might very well end up being more complicated than simply adjusting the sound files)...
#5
AGS Games in Production / A Place In The Sun
Thu 01/12/2016 13:15:41

GAME IS RELEASED!!
(click link above to visit the game's release thread)


I'd like to present a game that I've been working on for the past couple of months:
A Place In The Sun


About the game:
A Place In The Sun is a short game (can be completed in 30-45 minutes, probably less for some) with a classical SCUMM-like interface.
You play the protagonist in his "quest" for just making some damn coffee to survive yet another night of overworking, while trying to handle his complaining ex-wife as well as bear the burden of bad conscience about a neglected daughter.


Some screenshots:










Development progress:
Story: 100%
Scripting: 99%
Graphics: 100%
SoundFX: 100%
Music: 100%

Expected completion: Sometime during December 2016


Development diary:

December 1st 2016:
I've had a handful of great testers trying out the game, and have made some improvements based on their feedback.
Right now I'm conversing with my music composer about the soundtrack, which is almost the only thing still missing.

December 4th 2016:
Almost done with the SFX design; only need a couple more sounds, and a little bit of editing.
Also did a little bit of additional scripting.
Now pretty much all still missing is the music track (and probably a little fine tuning here and there while I wait for the music).

December 15th 2016:
I've had one last tester try out the game, and made some great tweaks and finetunings based on the feedback.
Also, I've finished the SFX design, and I decided to throw together some music myself; I'm very satisfied with the overall result.
Now all that's left for me to do is play through the game some more times in the hopes of tracking down the (hopefully non-existing) remaining bugs.
I expect to release the game before the end of this week!

December 16th 2016:
After playing through the game a couple of times, I decided it was finally time to release.
The game is now available from the game entry page!
#6
So, in room 1 script I have:
Code: ags
function room_Load()
{
  NightAmbience = aOutside_ambience.Play(eAudioPriorityNormal, eRepeat);
  NightAmbience.Volume = 35;
}


NightAmbience is an AudioChannel* global variable.

First time room 1 is loaded, a cutscene starts (Cutscene1).
Cutscene1 ends with changing to room 2.

First time room 2 is loaded, another cutscene starts (Cutscene 2).
Cutscene2 ends in room 2.

In room 2 script I have:
Code: ags
function room_Load()
{
  NightAmbience.Volume = 10;
}


Now, if I let Cutscene2 run through on its own, NightAmbience keeps playing on a loop as it should, but if I SKIP Cutscene 2, the sound stops and is not resumed at any point.
If I skip Cutscene1, the sound keeps playing as it should - so there must be something going on with Cutscene2 specifically.
Both Cutscene1 and 2 are eSkipESCOnly, if that could weirdly have anything to do with it.

There is nothing in Cutscene 2 that should affect neither sounds nor the global variable NightAmbience.

Does anyone have an idea what could cause this problem?

EDIT: I've narrowed the problem somewhat down to something a bit weird...
The only other sounds in use in my game at the moment are two sounds that I associated with certain frames in my character's walk view.
I found that if I removed all the sounds from these frames, NightAmbience does NOT stop if I skip the cutscene.

I then tried adding the sounds to the walk frames one by one, and it seems that if the walk sounds are added to more than three frames, NightAmbience is stopped when skipping the cutscene.
I have four walk loops (up, down, left right), and if I e.g. add sound to two of the frames in the down loop and one of the frames in the left loop, there is no problem, but if I add sound to one more frame in the left loop, NightAmbience is stopped when skipping the cutscene.

Could this be some kind of audio channel problem? And why would it depend on how many of the walk frames have sound??

2nd EDIT: Actually, now I've narrowed it even more down.
It seems it's only if I add sound to more than one frame in my character's walk view's left loop.
This seems so weird! What could be the problem?
#7
I have this code:
Code: ags
function hHotspot_Interact()
{
  player.Say("Play sound.");
  aSound.Play(eAudioPriorityHigh, eOnce);
}


The sound file is imported to the Audio -> Sounds folder, and its script name is aSound.
This is the first sound file I use, so it can't be interferring with other sounds.
The Sounds folder is set to default volume 100, and aSound is set to volume -1.

The sound file plays fine in the editor, but when I run the game and perform the interaction with the hotspot, no sound is played.
The player.Say command runs fine, so the function IS called.

I have tried running game setup, and select both Default DirectSound Device and Default WaveOut Device, and then running the game.
If I select WaveOut, my speakers make a little click/pop when I start the game, but neither DirectSound nor WaveOut yield any sound.

What could be wrong?

EDIT: Okay, now I've learned the problem is related to the format of the audio file.
aSound is a WAV file. I tried importing an MP3 file, and that one works fine.
Still, I'd like to be able to use WAV files...
I tried importing the WAV file into Reaper (a sound editing application) and make a new export of it (in case there was something with the original format that made AGS unable to work with it), but it still won't play.
Any ideas?
#8
Recruitment / Looking for testers
Wed 23/11/2016 13:12:23
I an nearing completion of the visual and scripting parts of a short game called "A place in the Sun" I've been working on for a couple of months.
Now I'd like to have some players test it, such as to spot eventual bugs, glitches, story Logic errors, etc., as well as give a bit of critique, before moving on to the sound design.

The genre is kind of comedy drama-ish, I guess.
I estimate the game can be played through in 15-30 minutes.
If you'd like to test the game, please reply to this thread or drop me a PM, then I'll send you a compiled copy of the game in its present state.

Thanks!
#9
I have an inventory window with height 46 and width 196.
Each item is set to have height 23 and width 28, such that there is room for two rows of 7 items at a time.
The sprites I use for the inventory items have height 22 and width 27, because I want there to be one pixel between each item.

I have scroll arrows to scroll the inventory window up and down.
The inventory window shows the first three rows of items without problems, but if the player has more than 21 items (I have 23 items total in my game at the moment), it doesn't make a fourth row.

I tried setting the item height (of the inventory window) much lower, and then it could show all the items (of course then they became overlapping).
I just thought that if the height was the problem, it should be a problem with three rows as well.
I don't understand why it becomes a problem at fourth row - and I don't understand why it's a problem at all, since the dimensions should fit ???

Any ideas what could cause this problem?
Let me know if you need to look at the code for the scroll buttons or something (don't know if that could be the cause of the problem?)...
Thanks!
#10
For all handled hotspot/object event functions I specify a FaceDirection command as part of the function.

What I'd like is to make FaceDirection commands for all unhandled hotspot/object events.
I thought of making an int property for hotspots and objects, storing either 0, 1, 2, or 3 (i.e. I would have to specify a value 0-3 for each hotspot and object), and then put into the on_mouse_click function for hotspot interactions:
Code: ags
Hotspot* h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
player.FaceDirection(h.GetProperty("propDirection"));

and likewise for object interactions.

But then I realised that if I put the FaceDirection line before the ProcessClick line, then obviously the player faces the direction before he even walks to the hotspot WalkTo coordinates, whereas if I put the line after the ProcessClick line, he won't face the direction until after the unhandled event function has been carried out, which is too late. :~(

Is there some way to put the FaceDirection line "into" the ProcessClick line, such that the player first walks to the hotspot WalkTo coordinates, THEN faces the direction, and THEN carries out the rest of the unhandled event function?

Or is there another way to achieve the same result?

All suggestions appreciated!
#11
I have this code in my room script:
Code: ags
function room_FirstLoad()
{
  SetTimer(2, 100);
}

function room_RepExec()
{
  if (IsTimerExpired(2))
  {
    cSoundEffects.SayBackground("RIIING RIIING");
  }
}


If I change "2" to "1" (i.e. if I use timer ID 1 instead of ID 2, it doesn't work.
What could be the cause of this?

PS. I'm using a couple of modules I didn't write myself, but I've searched through them and they have no instances of "timer", so I take it they are not occupying timer 1 for some other purpose...
#12
I want to make a background that has a sky with randomly blinking stars.
The randomness should behave in such a way that the stars are white most of the time, but then shortly shifts to some gray nuance now and then.

I'm thinking of either making objects with groups of stars (it would probably be grossly overkill to make separate objects for each star), and set those objects to shift frames with a Random int, or perhaps use the DrawingSurface.DrawPixel, and set the drawn pixels to shift color with a Random int.

Would you prefer either of those two options, or do you have a better idea for how I could obtain the same result?

Any suggestions appreciated!
#13
I'm trying to build a custom dialog options GUI.
For a start I have copy/pasted the script from the wiki (http://www.adventuregamestudio.co.uk/wiki/Custom_dialog_options_rendering) into my script, and it's rendering fine - but the dialog options don't respond to clicks.

I have a pretty long on_mouse_click funtion, so at first I thought it might be something in that that interferred with the clickability of the dialog options.
But I tried pasting the script into the default game template too, and the dialog options aren't clickable here either.

Would this be something I need to change/add in the dialog options script, or is it something I need to set somewhere in the AGS editor?
#14
I am working on implementing a save game dialog in my game, but it turned out to be too difficult for my current scripting skill level.
Therefore I ripped the save game dialog script from the 9 VERB template, and pasted it into my own global script.
I am trying to get it to work with my own graphics, so the dimensions are a bit different than in the template, but I think I've got it corrected to fit my graphics.
Also, I changed the number of max save games from 99 to 19. I'm not presently able to decipher all of the code, so I'm not sure if I have caused some trouble anywhere in the script.
However, I have (at least) one problem still:
When I run the game, and select a slot in the save dialog that is already filled by a previous save game, the listbox text is not updated to match the text of the save textbox - this means that if I delete the save name in the textbox, the name is still visible "beneath" in the listbox, and whatever I type into the textbox is typed on top of the listbox text.
I've read through the script again and again, and I'm just not able to find where the problem is - but then again, I haven't been able to find where the listbox text should actually get its update from.

This is the relevant section from my global script:

Code: ags
int GStopsaveitem = 0;
int listBoxGap = 2;

function GetLucasSavegameListBox(ListBox* lb) {
  // stores savegames in slots
  String buffer, sgdesc;
  int maxsavegames, counter=0;
  maxsavegames=19;
  lb.Clear();
  while (counter<maxsavegames) {
    buffer=String.Format("%d.", counter + 1);
    sgdesc=Game.GetSaveSlotDescription(counter);
    if (sgdesc==null) sgdesc="";
    buffer=buffer.Append(sgdesc);
    lb.AddItem(buffer);
    counter++;
  }
  lb.TopItem=GStopsaveitem;
  lb.SelectedIndex=-1;
}

function btnSave_OnClick(GUIControl *control, MouseButton button)
{
  gOptions.Visible = false;
  GetLucasSavegameListBox(SaveListBox);
  gSave.Visible = true;
}

function Save_Click(GUIControl *control, MouseButton button) {
	int index = SaveListBox.SelectedIndex;
	String buffer;
	if (control==SaveCancel) {
		gSave.Visible=false;
		gSavetextbox.Visible=false;
    gOptions.Visible = true;
	}
	if (control==SaveOK && index >= 0) {
		buffer=SaveTextBox.Text;
		gSave.Visible=false;
		gSavetextbox.Visible=false;
		SaveGameSlot (index, buffer);
    gMainGUI.Visible = true;
    gActionText.Visible = true;
    mouse.Mode = eModeWalk;
    UnPauseGame();
	}
	if (control==SaveScrollUp) {
		gSavetextbox.Visible=false;
		SaveListBox.SelectedIndex=-1;
		if (GStopsaveitem < 5) GStopsaveitem = 0;
		else GStopsaveitem -= 5;
		SaveListBox.TopItem=GStopsaveitem;
	}
	if (control==SaveScrollDown && GStopsaveitem < 9) {
		gSavetextbox.Visible=false;
		SaveListBox.SelectedIndex=-1;
		GStopsaveitem += 5;
		SaveListBox.TopItem=GStopsaveitem;
	}
}

function SaveListBox_Click(GUIControl *control) {
  int saveBox_ypos;
  int saveBox_xpos;
 	int index = SaveListBox.SelectedIndex;

	String buffer = String.Format("%d.", index+1);
	SaveLabel.Text = buffer;
	buffer = Game.GetSaveSlotDescription(index);
	if (buffer==null) buffer="";
	SaveTextBox.Text = buffer;
	
  saveBox_ypos = gSave.Y + SaveListBox.Y + ((index - GStopsaveitem) * (GetTextHeight(SaveLabel.Text, SaveLabel.Font, SaveLabel.Width)+listBoxGap));
  saveBox_xpos = GetTextWidth(SaveLabel.Text, SaveLabel.Font);
  SaveTextBox.SetPosition(saveBox_xpos, 0);
  
  gSavetextbox.SetPosition(gSave.X + SaveListBox.X, saveBox_ypos);
	gSavetextbox.Visible=true;
}

function SaveTextBox_Click(GUI *theGui, MouseButton button) {
  if (mouse.IsButtonDown(eMouseRight)) gSavetextbox.Visible=false;  
}


Any help very much appreciated!
#15
Does anyone know if the code modules for the built-in save and load dialogs are available anywhere?
I'd like to use the standard ones only with my own background and button graphics.
And besides, I'd like to read the scripts, so as to learn how they work.
#16
Today I was working on the UI for my game, specifically on the pause game function, and then it occured to me that it's actually not possible to make an on_key_press PauseGame() function that overrides a currently running blocking script.
This means that it's not possible to pause the game e.g. while a character is speaking.

I'm still very much a newbie regarding scripting and how blocking scripts work, so I have no idea how much work and rework would need to be done to implement such a function in AGS, and perhaps the function is not worth the amount of work, BUT;

I for one think it would be awesome if it'd be made possible in some future version of AGS to make an on_key_press PauseGame() function that overrides a currently running blocking script, and somehow stores the running script and the current "position" within that script, such that it can be resumed after UnPauseGame().
#17
I'd like to make a PauseGame() function similar to the classical LucasArts games, such that I can pause anywhere in the game, including while characters are speaking, animations are run, cutscenes are running, etc. etc.

I have made an on_key_press PauseGame() function, and it's working fine, but I just accidentally discovered that (of course) it doesn't go through if a blocking script is running (e.g. if a character is speaking non-background-ingly).
I tried putting an IsKeyPressed() function in repeatedly_execute_always, but for that to work, of course, you would have to press and release the key pretty damn fast :smiley:

Is there a feasible way to make an OnKeyPress() function that somehow overrides the currently running blocking script (inherently, no more than one blocking script can run at any one time, right?)?
It would of course also have to somehow store that currently running blocking script, including the current "position" within that script, such that it could resume it at UnPauseGame().
#18
For some reason AGS keeps adding the line
Code: ags
function dialog_request(int param) { }

at the bottom of my global script.

I take it that I add it accidentally myself, but I cannot figure out what I keep doing to add the line to the script.
Does anyone have suggestions for what could (semi-)automatically add the line?
#19
I know there are some types of code that (at least per default) need to be in the global script, such as inventory item functions and GUI functions.

I get confused very easily, and therefore it would be of great help for me, if it was possible to put all types of code in other scripts (e.g. to make a script solely for inventory item functions, one solely for GUI functions, etc. etc.).

Therefore I'd like to hear if it should after all be possible in some way to work around the limitations of AGS, and put all types of code in scripts that are not the global script?

Thanks!
#20
I'd like to make it so that the mouse cursor mode and my action label text are reset after carrying out a function.

By "after carrying out a function" I mean e.g. if I have selected a "look at" mode and then clicked on e.g. a hotspot, e.g. making the player say something (that's the function), then the resetting should occur after the player has finished talking (i.e. after the entire function has been carried out).

And by "reset" I mean that the cursor mode should switch back to "walk to", which is my default mode, and the action label text should be set to "".
I know how to use mouse.Mode == eMode..., and .Text = "", but what I don't know is what these commands should be functions of.

I tried making them functions of on_mouse_click(), but that seemed to make a mess somehow - and besides I'm not sure if the resetting would actually occur before or after the additional functions of the given click.

I use five modes beside "walk to", namely "look at", "use", "pick up", "talk to", and "use inv", and the resetting should occur after carrying out functions of them all. Also, if any mode beside "walk to" is selected, and I click on eLocationNothing (except for inv items!), then the resetting should occur as well.
SMF spam blocked by CleanTalk