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 - actaria

#1
Hello,
It's already me again 😀
I am trying to improve a few things and now i on the sounds, musics parts.
Until now i was doing little tricks here and there to prevent music to start over again when reentering a room before the end of the music.
I found a thread on the forum here:
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/changing-rooms-without-the-music-starting-over/

I am trying to use the 2nd method with audio channels

In GlobalScipt.asc i have:

Code: ags
function game_start()
{
 bool IsAudioClipPlaying(AudioClip* clip)
{
    for (int i = 0; i < System.AudioChannelCount; i++)
    {
        if (System.AudioChannels[i].PlayingClip == clip)
        {
            return true; // found it
        }
    }
    return false; // nowhere
 }
}

In GlobalScript.ash i have:
Code: ags
import bool IsAudioClipPlaying(AudioClip* clip);


And finally in my room i have:
Code: ags
function room_AfterFadeIn()
{
    if (!IsAudioClipPlaying(aMusic1))
    {
        aMusic1.Play();
    }
}


Unfortunately it gives an error in the GlobalScript.asc

"GlobalScript.asc(13): Error (line 13): Nested functions not supported (you may have forgotten a closing brace)"
this is this line:
Code: ags
 bool IsAudioClipPlaying(AudioClip* clip)


Can you please help me if you can see the mistake i made.
Thank you very much.
#2
Hello,
It's been a while i was not stuck but this time i need your help
In order to create a map i use a room with a GUI on it
There's a button on the GUI to exit the map (a basic cross)
to go back to the previous position when the player exit the map i use:

Code: ags
player.ChangeRoom(player.PreviousRoom);


The problem is that the player comes back to the previous position but in the middle of the room
I need to find a way to go back to the previous room with the same coordinates (x,y)  the player was before he opened the map

I tried different things without success
I believe there must be a way to do that can you please help me 😀

I wish you all a great day, thank you very much
#3
Hello,

I am still working on my piano bar room and unfortunately i am stuck again.

I want the character to be able to sit on a chair and just listening to the pianist with a idle view
view 167= the character sitting on the chair
Code: ags
function ochair_Interact()
{
cChar1.Walk(1420, 820, eBlock);
cChar1.FaceDirection(eDirectionUp);
cChar1.LockView(167);
}
I had this code but i think the lockwiew was preventing the idle view to animate so i made a timer that triggers the idle view.

Code: ags
function ochair_Interact()
{
cChar1.Walk(1420, 820, eBlock);
cChar1.FaceDirection(eDirectionUp);
SetTimer(7,80 + Random(500));
cChar1.LockView(167);
}

Code: ags
function room_RepExec()
{
if (IsTimerExpired(7)) 
{
cChar1.Animate(0, 5, 0, eBlock, eForwards);
SetTimer(7,80 + Random(500));
}
}
It works well maybe there was an esier way to do this ?

Now i want that when the player click somewhere it makes the character stand up and go back to the normal view

I don't know how to do that i had a look at: "on mouse click" but i am not doing anything good i tried that:
Code: ags
on_mouse_click
{
cChar1.UnlockView();
cChar1.LockView(1)
}
It gives me an error and i don't really know where to put it

Thanks again for your precious help.
#4
Hello,

I hope everyone is doing well.

I need your help because i am stuck on that one.

I have a bar with a pianist and a dancer:



I use this code to make the dancer move everywhere on stage

 
Code: ags
function room_AfterFadeIn()
{
SetTimer(15,250);
}


 
Code: ags
function room_RepExec()
{
if (IsTimerExpired(15)) {
cdanseuse.Walk(Random(999), Random(999), eNoBlock, eWalkableAreas);
SetTimer(15,80 + Random(80));
}

It works well the problem i'd like to solve is that the character needs to talk to a NPC and when the dancer reach the end of timer she stops once the NPC is talking or opening a dialog.

How can i make the dancer to keep dancing even when the player is talking to someone ?

Thanks a lot for your precious help.
#5
Hello,

I have some problems with a script part in Global Script
It's a usual code i really don't know what i am doing wrong.

The Character needs to get 10 rocks with a pickaxe then give them to a NPC
I also have a GUI that counts the number of rocks top right of the screen

Code: ags
function NPC_UseInv()
{
if (rock10==true)
{
  if (cChar1.ActiveInventory == irock)
  {
    grock10.Visible=false;
    player.LoseInventory(irock); 
    cChar1.Walk(1274, 665, eBlock);
    cChar1.FaceDirection(eDirectionUp);
    cbianca.Say("congrats you made it");   
  }
}

The end of the code i use to show the number of rock GUI
Code: ags
function room_RepExec()
{
if (rocks == 10)
 {
 grock9.Visible=false;
 grock10.Visible=true;
 SetTimer(1,0);
 rock10=true;
 player.LoseInventory(ipickaxe); 
 }
}
I have 3 problems yes that a lot :)
-the GUI stay on screen
-Player is not losing rocks from his inventory
-NPC is not using speech view anymore (it's working in the room script) means no animation and the speech color is white when supposed to be green.

I also use a simple code to randomize if the player get a rock or not but i don't think it's related to the problem.

What am i doing wrong ?
Thanks a lot for your precious help

EDIT:
I removed all the part from the function room_RepExec() and now it's in each hotspot area where the player use the pickaxe it was a big mistake i think.
Now the GUI is being removed as intended, other problems remain the same

EDIT 2:
Ok my code was a toal mess

I was adding a new rock each time in my inventory so i had to click 10 times on ths NPC to see the rock disapear from the inventory.
GUI is also removing well now that it is not on RepExec anymore

I'll see now for the speech color
#6
Hello,

It's me again. :-D
Today i am learning Camera function.

I have a 1980x5500 room and i wanted to make a Camera scrolling from the top to the bottom of the room to show the player what he will have to climb.

I managed to do the scrolling i wanted with this code and it works really well

Code: ags

// Create and setup a temporary camera
Camera* myCam = Camera.Create();

myCam.SetAt(0, 0);


// Save the old camera in a temp variable
Camera* oldCam = Screen.Viewport.Camera;
// Assign the new camera to the primary viewport
Screen.Viewport.Camera = myCam;

// Scroll the new camera across the room
while (myCam.Y < (Room.Height - myCam.Height))
{
    myCam.SetAt(myCam.X + 1, myCam.Y + 10);
    Wait(1);
}

// Delete the camera and reset the old camera back
myCam.Delete();
Screen.Viewport.Camera = oldCam;


The only little problem i have is that when you enter the room the camera shows the player for like 1 second before going to the top of the room to begin the scrolling down.

I thought that myCam.SetAt(0, 0); was what the camera shows at start but even if i changes the values it still shows the player at start.

Any help to explain would be appreciated.

Thank you.
#7
Hello,

I have a little problem there.

In a room the player dies by a spider..
I have a death animation  which works well.
And of course I don't want the player to be able to move anymore (the corpse is lying on the ground) and  there is a little animation and music that plays once the player is dead on the ground.

So i t ried these 2 commands:

Code: ags
cChar1.StopMoving();

cChar1.Clickable = 0;

But  i am still able to move the character
what am i doing wrong ?

Thanks a lot for your help.
#8
Hello,

I am stil working on my keyboard GUI it works very well with good and wrong password.

So  i wanted to enhance it a little more with some animations on it.

I created a new room with some animated objects and i put the keyboard GUI over it and it looks pretty good.

The problem i have is that once correct or incorrect password has been typed he Player has to go back to the previous room in front of the door with the PNJ

The PNJ is talking to say "this is the good password" or "this is not the good password' then he close a little window on the door

but with the cChar1.ChangeRoom(18,3275, 1022); the text is displaying before the keyboard GUI is off as you can see in the video:


And i also get some object and frame error when i got back to the previous room.

I think i found the reason why in the manual:

IMPORTANT: For player character this command does not change the room immediately; instead, it will schedule the room change, and perform it only once your script function has finished
(This is to avoid problems with unloading the script while it is still running). This means that you should not use any other commands which rely on the new room (object positionings, and so on)after this command within the same function.


Is there another command than ChangeRoom without this limitation ?
Am i going the wrong way ?

Thanks a lot in advance for you help.
#9
Hello,

I made a GUI that looks like a keyboard  where you have to enter a code.

Each letter of the keyboard is a button

And there is also a TextBox

So the player can enter the code using the GUI keyboard

I found the Key code table here:

https://adventuregamestudio.github.io/ags-manual/Keycodes.html?highlight=press%20key&case_sensitive=0

But i can"t find the correct syntax i have to put for each button

For letter A i tried

Code: ags
function letter_A_OnClick(GUIControl *control, MouseButton button)
{
(keycode == eKeyA);
}

and a few other but this is not the correct syntax

Anyone can help ?  ;-D

Thanks a lot


#10
Hello,

I just did customs GUI for
gSaveGame
and
gRestoreGame

It was not that easy to make evrything work well but now it does except the fact that when i open gResoreGame i can only choose the last game saved and not the older one see the video below

Here is the code i have in:

lstRestoreGamesList_OnSelectionChanged

Code: ags
function lstRestoreGamesList_OnSelectionChanged(GUIControl *control)
{
show_restore_game_dialog();
}

I tried a few things but didn't managed to fix it.
Any help would be appreciated, thank you.

#11
Hello,

I hopoe everyone is doing well.

I am have problem trying to use a dialog counter

I'd like to have aother sentence said when i asked 2 times the same question to a PNJ.

Unfortunately it gives me an error and i don't manage to fix it so i need a little help here please.

I use a global variable
dialogCounter  int  0

At the beginning of the dialog i have set the dialog couter to 0

Code: ags
// Dialog script file
@S  // Dialog startup entry point
  dialogCounter = 0;
return

then in the dialog i have this code

Code: ags
@5
  if (dialogCounter <=2) {
     cChar1.Say("I said no");
     dialogCounter++;
           }
  else {
     cChar1.Say("well ok if you insist");
	      }
  return


That returns me the following error:

Dialog 2(79): Error (line 79): PE04: parse error at 'else'

Line 79 is:
 else {

What i've i done wrong here ?

Thanks a lot in advance for your precious help.






#12
Hello,

There is one new thing i don't manage to do the way i want it to be.

The player has a mouse trap that has to be put on the floor at a specific area.

The area (floor) is an object, it is working well (use inventory on object) then the mouse trap appear on the floor.



The problem i have is that the object (floor) is set on "clickable" and when i click on the object area it display the generic message "i can"t do nothin with that" (it's just an exemple of course).

I don't want any message to be displayed so i set the object on clikacble=false and of course "use inventory on object isn't working anymore because of that.

I also tried with hotspot but it also display a message when you click on the area and i didn"t find a way to make a hotspot not clicbable and i think i should stick with the object solution.

Can you tell me what is the best way to do that and get no message when you click on the object so ou can freely walk around  but still be able to interact with it (use inventory on object).

Thanks a lot once again for your precious help.
#13
Hello,

I am still working on a kitchen with a fridge.
With the help of Morganw i solved my fridge pick up items problem.

The player open the fridge and pick a chicken.
Then the player pick the chicken from inventory and click on the character to eat it

i went on my player character clicked on events that leads me to global script.

Global Script code:

Code: ags

function cChar1_UseInv()
{
if(cChar1.ActiveInventory == ichicken)
cChar1.Say("This chicken is delicious");
cChar1.LoseInventory(ichicken);
}


It works well but the problem is that since the chicken isnt in my inventory anymore it reappear in the fridge because of the condtion of my
fridge code and of course i want it to be gone forever in my stomach  :)



I tried to put:
chicken.Visible = false; in the global script but it looks that i can not call an object from there.

Here is the kitchen room code:

Code: ags

function fridge_close_Interact()
{
  fridge_close.Visible = false;
  fridge_open.Visible = true;
  chicken.Visible = !player.HasInventory(ichicken);
   }



I tried to find solutions and what is the best way to do this but i didnt find anything working.
Since it's kind of specific i didn't find anything that matches the same question.

Any help would be appreciated thanks a lot in advance.
#14
Hello,

I am struggling again with the IF, i think i am doing better since i have no syntax errors but something
isn't working well.

I have a fridge (2 objects) open and close door.
Inside the fridge there is cheese and chicken
i can pick both they are going in inventory and dispapear from the fridge but only when i pick the cheese first.
When i pick the chicken first close the fridge door and reopen it the cheese and the chicken are still inside !

I can't see what i am doing wrong this is the first time i use multiple IF and it looks like i am doing something wrong

My code when you click on the closed fridge:

Code: ags

function fridge_close_Interact()
{
fridge_close.Visible = false;
fridge_open.Visible = true;
cheese.Visible = true;
chicken.Visible = true;

if (player.HasInventory(icheese))
  {
  
   if (player.HasInventory(ichicken))
{

cheese.Visible = false;
chicken.Visible = false;
}
  }

else {
  cheese.Visible = true;
chicken.Visible = true;
}
 }



Thank you very much for your precious help each time i am stuck
#15
Hello,
I hope eveyone is enjoying Sunday.

I am actually stuck on a problem.
I made a wolf that animate when i "walk into a region" in front of him




The problem is that when i walk out of the region the animation is launching again and if i go back into the region it will restart the animation again.

I would like that the animation can not be started again until it has been fully played and reached the end of the loop.

My code is the classic one:

Code: ags

function region1_WalksOnto()
{
object[owolf].SetView(10);
object[owolf].Animate(0, 1, eOnce, eNoBlock);
}


Unfortunately i have no idea on how do to that.
Or maybe there's another way to do it ?

Any help would be appreciated, thanks a lot in advance. :)





#16
Hello,

I am still learning AGS and i wanted to customize "display message" using a text window GUI that i will create.

Unfortunately it seems that i am having a problem when create a new text window GUI this is what i get:



Nothing is clickable i can't do nothing.

I created a lots of normal GUI and it this is the first time i am trying Text Window GUI.

I have no idea what's wrong maybe i deleted something that was needed for it to work properly (the little arrows ?)

I tried creating a new game and same thing.

I hope someone will be able to help me to fix the problem.

Big thanks in advance

UPDATE:
I found some little red square but i only got the left and middle one none on the right side I only got 4

In General Settings --> Text Output --> Custom Test window GUI i put the number of the text GUI

and i get this message:



Thanks again if you can help

#17
Hello,

Once again i will need your help.

I made a cuckoo animation with 2 loops.
view 6 is used for cuckoo animations
loop 0 = is the clock working
loop 1 = is the bird coming out of the cuckoo


What i wanted to make is the cuckoo animate when i enter the room and if the player click on it the bird comes out of it

It works really well but the problem is that once you click on it and the bird came out the animation is stop and the clock isn't working anymore.

Of course if want the program to go back to the 1st loop so the clock still look animated.

Code: ags

function room_AfterFadeIn()
{

object[0].SetView(6);
object[0].Animate(0, 4, eRepeat, eNoBlock);

}


function cuckoo_Interact()
{

object[0].SetView(6);
object[0].Animate(1, 4, eOnce, eNoBlock);


}


Thank you so much again for you help.
#18
Hello,

There's something i don't understand so i hope someone can help and explain to me.

I have a door locked with a key.
If you interact with the door without the key it says"the door is locked"
Everything is working fine, the key open the door.
I can open and close the door this is how i want it to work.
Unfortunately i have a problem even when the key has been used to unlock the door if you close it and reopen it, it still says "the door is locked" when you click to reopen.
and i don't want that to happen again once the door has been unlocked of course.

This is the code i have in my room script file:

Code: ags

bool door_unlocked = false;

function oDoorclose_Interact()
{
  cChar1.Walk(872, 712, eBlock);
  cChar1.FaceDirection(eDirectionUp);
  if (door_unlocked) door1.Play(eAudioPriorityNormal, eOnce);
  if (door_unlocked) oDooropen.Visible = true; 
 
   else  door1.Play(eAudioPriorityNormal, eOnce);
  
  	player.Say("The door is closed.");

}


I tough that the "else" would have done the job but it looks like there's something i don't understand well.
Thanks a lot for your precious help i can provide the rest of the code if needed but i don't think so.

a few pictures so you can see how it looks:





Thanks again  :)
#19
Hello,

I am kind of new to AGS, it's been a few month now and unfortunately i am struggling with the IF function.

Code: ags

function oObject1_Interact()
{
if (oObject1.Visible = true) {
player.Say("the door is closed");

}


This is the error message i got:
Failed to save room room10.crm; details below
room10.asc(77): Error (line 77): Parse error in expr near 'oObject1'


oObject1 does exist it's the door in closed position

Thanks in advance for you help i wish everyone a nice week-end.
SMF spam blocked by CleanTalk