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

Messages - Giacomo

#41
                                             
                                                                                                                (lighting strike in town festival)

PLOT

Falco is a popular police commissioner of the homicides department who works in the capital city of a certain old country.
After 20 years spent investigating murders, he chose to take a long break to return home, a small hill town in the north of the country where people loves drinking.
He just set foot in town when the mayor promptly contacted him to ask him for a favour, knowing his affection for drinks and parties, and gave him the task to free up the town party that is supposed to go on all night long.



Indeed, a lot of noisy drunkards gather there for town festivals to have party until late in the night, and no police officer was able to stop them, especially during the festival of Baucco.
Falco is happy to accomplish the task as to join the old men to drink with them, but the meeting with an old acquaintance of school times will make the story more interesting.



MAKING OF THE GAME

Falco is my first game ever made. I didn't know anything about scripting and graphic, so it took me a lot to make it, especially to draw animations and backgrounds.
I also composed the music and wrote the dialogues, for the last with a little but essential help from my friend.
The game is quite short and it's supposed to be a kind of demo or introduction for the character, which I'd like to develop to make some noir stories, without forgetting of the humour element proper of adventure games.
The character is inspired by a famous detective of an old TV series, despite his personality quite differs from his. Guess who!

Current Progress:
UPDATE 2024/09/29
Completed!
There could be minor glitches.
Completed game thread

Release Date:
September 2024

Languages:
Italian
English
#43
Good morning everybody,
I'd like to post a question about buttons enlightement in the module of Khris.

First of all, thank you Khris because the module works perfectly;
what I'd like to ask you is a little customization to enlight arrows' buttons.

I don't use a background color in dialogs GUI and I noticed that when arrows are not enlighted,
they are partially coloured of magenta, which should be the colour for transparency in AGS.

What I'd like to do is substitute the sprites of arrows with a character, or eventually with two sprites for each arrow(an enlighted one an a normal one), to avoid seeing the magenta colour.

Using other Khris' function, like PrepareMenu and PrepareButton, I set some buttons in my inventory GUI with special charcaters instead of loading a sprite.
This is useful to enlight the buttons in a easy way(always thanks to khris as well!), and, in my case, I set some symbols like arrows and music off/on button with some special characters in order to easy enlight them.

I wonder if it is possible to do something similar in Scrolling Dialogs mod: to set arrows button like characters and enlight them the same way you enlight texts.

I studied a bit the module, but I'm afraid to put my hands on it and I wonder if it can be stable after a modify like this.
Either way, loading two sprites for each arrow button would be ok to me, and maybe it is even easier.

Any help is appreciated,
thank you,
Giacomo
#44
Thank you very much! It works perfectly. Now it's clearer how to export, import variables and I'll practice this more on separeted scripts, where I couldn't understand how to use import/export for functions...Thanks again.
#45
Hello everybody,I wrote a function that switch music when called and it just works fine when I define it in room script. But, as I have to use it, together with another one, inside a dialog, I put them both in global.

In global.ash 
Spoiler
Code: ags
enum actions
{  
  eGoUp,  
  eGoDown  
};  

import void SetBackgroundMusic(actions action);
import void stopMusic();

AudioChannel* channel[5];
AudioClip * clip[5];
int position[5]; //position of the clip once it's paused
int choice = 1;  //clip ID for channel 1 only
int number = 0; //clip and audio channel ID
[close]

In global.asc
Spoiler
Code: ags
void SetBackgroundMusic(actions action)
{ 
  switch(choice)  
  {
    case 1: clip[1] = aSong11;
    break;
    case 2: clip[1] = aSong12;
    break;
    case 3: clip[1] = aSong13;
    break;
    case 4: clip[1] = aSong14;
    break;
  }
  clip[2] = aSong2;
  clip[3] = aSong3;
  clip[4] = aSong4;
  if(channel[number].IsPlaying) //volume down
  {    
    while(channel[number].Volume > 0)
    {      
      channel[number].Volume -= 3;
      Wait(2);
    }
    channel[number].Pause();
    position[number] = channel[number].Position;
  }
  if(action == eGoDown && number > 0) number--;
  else if(action == eGoUp && number < 4) number++;
  if(channel[number] == null || !channel[number].IsPaused channel[number] = clip[number].Play(); //assign new audio clip to channel
  else clip[number].PlayFrom(position[number]); //else play it from where it was paused
  channel[number].Volume = 0;
  if(channel[number].IsPlaying) //volume up  
  { 
    while(channel[number].Volume < 99)    
    {
      channel[number].Volume += 3;
      Wait(2);  
    } 
  }
}

void stopMusic() //used for channel 1 only, for which, inside a dialog, player can choose which song to play 
{  
  if(channel[number] == null) Display("null");
  while(channel[1].Volume > 0)    
  {
    channel[1].Volume -= 3;
    Wait(2);
  }
  channel[1].Stop();
}
[close]

In room.asc
Spoiler
Code: ags
function room_AfterFadeIn()
{
  channel = aSong0.Play();
  channel.Volume = 99;
}
[close]

I didn't always check the null condition, I used Display function just to see when the audio channel stop being non null, in one case it was inside a dialog, but I don't really understand how to work on this. Please consider that this is just a raw try, as I'm moving my first steps into music functions. SetBackgroundMusic worked only when it was defined inside room. I still don't understand how to point to channels and clips globally, if and where to use imports, exports etc... Any help is appreciated.

Thank you,
Giacomo
#46
Thank you Khris... I am an idiot!
#47
I've tried again and it works fine if I insert integers in params: myDynSprite.Crop(80, 75, 80, 50); //this works
If I write player.x and .y,likewise as cRoger or character as array it ends up returning a messed up draw.

I wonder if this is fixable, either I'll have to find another somethig else.

[EDIT] Maybe this method cannot read character position because the coordinates it takes has nothing to do with player's coordinates.
I ensured to get the right x and y before cropping.
I had already tried storing player coordinates in two integers before calling Crop but neither it worked.

#48
Thanks Khris, I have tried it but the result of the sprite was weird;

If you say it works I will try it again, maybe I made some errors!




#49
I would like to ask one more thing...

I'd like to fill the slot buttons image with a custom frame.

I have tried a lot with dynamic sprites and drawing surfaces functions,
but I'm not able to create an image containing a little part of the background(around player position),
including player and characters.


I've found an interesting function made by Khris but can't find the topic anymore.
Anyway, it wasn't perfectly suitable with my case and I've modified it do some tries.

I'm not able to merge background frame and player current frame and put them in slot graphic.
I was able to create them separetely and I wonder if it's possible to merge two dynamic sprites somehow.

Also, when I load game and open slots menu, no image appears.

Can you please help me?

Thanks,
Giacomo



#50
Hi people.

I created some custom functions that can be used to open and edit the selected slot in a multiple slots GUI.
Slots are stored as buttons.
Functions are working fine so far and I hope they could be helpful.

First of all I declared two global variables:
Spoiler
Code: ags
Button* selectedButton;
int selectedSlot;
[close]

In menu GUI a button open the slot menu.
Spoiler
Code: ags
function btnEditGame_OnClick(GUIControl *control, MouseButton button)
{
  _isSlotAvailable(); //check if there is any saved slot
  if(firstMenu && !slotAvailable) player.SayAt(160, 100, 60, "You can't do anything now!");  
  
  else 
  {
    gOpenSlot.Visible = true; //my way to open slot GUI
    gMenu.Clickable = false;
  }
}
[close]

Selecting any slot triggers the same function _openSlots(int mySelectedSlot, Button* mySelectedButton):
for example:
Spoiler
Code: ags
function btnEditSlot1_OnClick(GUIControl *control, MouseButton button)
{
  if(firstMenu && Game.GetSaveSlotDescription(1) == null) player.SayAt(160, 100, 60, "Empty slot!");
//if game has not started yet and slot is empty you can't open it 
  else _openSlots(1, btnEditSlot1);
}
[close]

Function to open selected slot:
Spoiler
Code: ags

function _openSlots(int mySelectedSlot, Button* mySelectedButton)
{
  selectedButton = mySelectedButton;
  selectedSlot = mySelectedSlot;

  gEditGame.X = mySelectedButton.X; //whatever you want
  gEditGame.Y = mySelectedButton.Y+102; //whatever you want

  if(Game.GetSaveSlotDescription(selectedSlot) != null) 
  {
    btnEditGameLoad.Visible = true;
    btnEditGameDelete.Visible = true;
  }
  
  if(!firstMenu) btnEditGameSave.Visible = true;
    
  gEditGame.Visible = true;
  gEditGame.Clickable = true;
  gOpenSlot.Clickable = false;
}
[close]

Function to edit selected slot. On header I declared an enum:
Spoiler
Code: ags
enum MyEventType {
  eLoad,
  eSave,
  eDelete, 
};

function _editSelectedSlot(  MyEventType myEvent)
{
  if(myEvent == eLoad)  RestoreGameSlot(selectedSlot);
  else if(myEvent == eSave)
  {
    SaveGameSlot(selectedSlot, dateTimeFormat);
    _slotBackground(); //function to get image for saved game, for which I'll soon ask a question!
  }
  else if(myEvent == eDelete) DeleteSaveSlot(selectedSlot);
  
  selectedSlot = 0;
  gMenu.Clickable = true;
  gOpenSlot.Clickable = true;
  btnEditGameDelete.Visible = false;
  btnEditGameLoad.Visible = false;
  btnEditGameSave.Visible = false;
} 
[close]

Function to check if any slot is available:
Spoiler
Code: ags
function _isSlotAvailable()
{
  slotAvailable = false;
  for (int k = 1;  k<4;  k++) //I use slots from 1 to 3
    if (Game.GetSaveSlotDescription(k) != null) slotAvailable = true;
}
[close]
#51
Thanks Khris!
Ok, maybe it takes less...haha

Thanks for the tip, I have tried something similar, but I'm still missing a lot of info! I will try it soon!

#52
Thank you, Khris.

I wanted 3 slot only because the game is a kind of prologue and it's quite short.
There's no multiple end but player's game is evaluated in the end, so I thought he might wish to try some quests again and so doesn't have to start the game from beginning.

Anyway, I have no clear idea about save/load functions yet and I would be happy to semplify the script; this is the only point for which I don't see a clear solution.

Eventually, using a single slot is a good idea. Indeed, playing the game following a walktrough would take less than an hour to complete it so maybe multiple slots are useless. Autosave is also a good idea, but if the player wants to obtain a better evalutation when game ends he will have to restart it from the beginning...

I will rephrase my idea and make it simpler.
Should post be deleted? It ended up being quite useless...

Cheers,
Giacomo
#53
Hi, people of community.
I'd like to ask you help to create a custom edit game function.

I created a button on gui menu called "edit game".

To save/load/delete a slot push the button "edit game".

If there's no saved slot and game has not began yet, display the message: "You can't edit any game now!"

Else 3 rectangles appear(available slots).

Each rectangle, when clicked, let show max 3 buttons: save, load, delete

These 3 buttons appear only when needed, under the selected slot rectangle;
if game has not began and there are saved slot, you can only load or delete them for example,
as you can't load or delete an empty slot. If you started playing you can only save on empty rectangles.

I thought to build a function for which the position of 3 buttons depends from selected slot position,as it should appear right down the rectangle once it's clicked.

Each action depends from selected rectangle, for this I thought to insert some booleans to determine which rectangle was selected before any action is triggered; once button is pressed, action is triggered and let you save/load/delete game on selected slot.
When done, reset booleans.

Thank you,
Giacomo
#54
Sure, I wanted to write "you" as you all.

This to say that the editor is cool because it's "easy" to use for
newbies like me, but things get more interesting when you dive deeper
into script...and you all help me see better into it..

PS:I'm a fan of adventure games since I was 5 yo and MI left me the most visible mark ever in my life.
I'm having a lot of fun making a stupid game and you can't tell how much this community made my life funnier!
#55
That's great, Khris. I am gonna work on it soon.
I hope to issue my first game in he early summer!

Anyway, the many times I ask or look for answers I find out
you give solutions that seem to be simpler and more efficient
than many function in AGS editor...It's getting more interesting
and I'm enjoying scripting the game always more, thanks again!
#57
Thank you, Khris, point 1 is accomplished!

I just had to empty button text because it seems to be in front of the drawn sprite, but it's fine so!
I guess there's no problem for transaltion till I'm creating new strings..

I'm still having a hard time in achieving point 2 but it's because my skills are still too low(and maybe my IQ too).

I have followed eriOo's instructions and made a new script in which i pasted all the lines he wrote. I'm trying to put the
function inside there and do some useful imports in global but nothing good is happening. Anyway, I'm not sure about how
key press function works, but since I am using mouse only maybe I should modify on mouse click func and insert the iteration here
Code: ags
function dialog_options_mouse_click(DialogOptionsRenderingInfo *info, MouseButton button)
{
  int d_x = info.X;
  int d_y = info.Y;
  if(button == eMouseLeft) {
    if(IsMouveOverScrollUp(d_x, d_y)) 
    {
      ScrollUp();
      info.Update();
    }
    
    if(IsMouseOverScrollDown(d_x, d_y)) 
    {
      ScrollDown(info.DialogToRender.OptionCount);
      info.Update();
    }
    
    if (info.ActiveOptionID > 0) {
      info.RunActiveOption();
    }
  }
}

Thanks eriOo, this module is very helpful for my learning!
#58
Khris, let me ask you just one more thing.

I have an issue about character walk function.

I'd like him to walk automatically to hotspots, chars and objcets, but I don't want
to set eBlock in params, despite I'd like to block following functions and let them run
only once he reached the target.

I saw some options about this but my game is not working as I'd like, and I don't like to always use eBlock
to prevent next functions to run. About this matter and eBlock param I'd have a couple of more questions to ask...
I would open a post to make all these specific questions about it, but if you tell me that there are older posts that
can help me, I will take a deeper look in the forum!

Sorry if I'm fullfilling you with these stupid questions, but my first game is almost done and I spent several days
looking for an answer to these problems!
#59
Thank you Khris!

I'm using BASS template.

About the baloon animation, I still have to try to assign it an idle animation and set the shortest timer possible
between one animation and the other; I wonder if doing so reduce the waiting to zero, letting the animation run
continually... If this works, I could delete the baloon object and merge its sprite to the character sprite, setting idle
to -1 everytime he starts walking and resetting it to right view once he stops.

I'm gonna try your code later in the day!

Thank you again,
Giacomo
#60
Hello everybody.

I'd like to ask you a couple of questions about labels and arrows buttons.

I searched a lot in the forum and in the manual to find out a solution but I'm still
having my first experience in scripting and I need your help before I compromise my code.

I saw two interesting posts in which eri0o and Khris talked about the matter.

https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/changing-number-dialog-options-in-general-settings-doesn-t-make-any-change/msg636653127/#msg636653127

https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/about-dialog-options-and-templates/msg636637797/#msg636637797

Thanks for these answer, they helped me a lot despite I'm not able to resolve these problems yet!

What'd I like to do is the following:

1)once you open Menu GUI, passing cursor over buttons should highlight their text

To accomplish this I thought to create an empty sprite, assign this sprite to every MouseOverImage button functions in the GUI, then create a Dynamic Sprite and Surface from the button graphic and text.
I wonder if I can use button text and background together to create a Dynamic Sprite.

2)I need an upload function to display correctly the dialogs GUI, as everytime I switch off an option state, a blank space
remains in the dialog windows, as if the option was still active; same goes for arrows, as they should appear and disappear
only when needed. This works fine for inventory window, but I'm not able to export the function over dialogs.


I also have a question about characters animation on standing frame, which is not in the title. I read about similar problems
but I'm not able to create a fine function. Please let me know if I can expand the post and put the question here, or should I
put the issue in a new post?

A character walks randomly in a certain area. He stops and after a little time he starts walking again.
I created a function with two timer calling each other everytime one of them is expired.
Character is carrying a ballon, so when he's standing the baloon should float.
I tried to split the animation, making of the baloon an object following character, but I don't find this is a good solution.
The function works fine except when the character stop moving, as he changes view but no animation starts.

Please let me know if I can put some code regarding this matter in this post!

Thank you all in advance,
Giacomo
SMF spam blocked by CleanTalk