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

#1
 :grin:  Thanks a lot, I fell stupid, but at the same tame released. I was going crazy. Time to go to bed.
#2
Hello

So, there is a room with a rooster. If the main character talks to the rooster, the game should run one dialog
If the main character gives coffe to the rooster and talks to the rooster, the game should run another dialog
If the main character gives coffe to the rooster again and talks to the rooster, the game should run a third dialog.

For that, first i create a global variable (varGALLOCAFE) with value 1
Then, in the global script, I declare the variable and write two functions, one to use the inventory object on the character cGallo and another to talk to the character cGallo.

Like this

Code: AGS
int varGALLOCAFE = 1;

function cGallo_Talk(Character *theCharacter, CursorMode mode) {
   if (varGALLOCAFE == 1) { 
      dGallo1.Start();
      varGALLO=2; 
      }
  
   if(varGALLOCAFE == 2) {
      dGallo2.Start();
      varGALLO=3;
      }

   if (varGALLOCAFE == 3)  {
       dGallo3.Start();
       }
}

function cGallo_UseInv(Character *theCharacter, CursorMode mode) {
        if (cEgo.ActiveInventory == iCafetera) {
            if (varGALLOCAFE==1) {   
                SetTimer(2, 300);
                cGallo.Walk(800, 900, eBlock, eWalkableAreas); 
                cEgo.Walk(870, 900, eBlock, eWalkableAreas); 
                varGALLO=2;
                }
            if ((varGALLOCAFE==2) && IsTimerExpired(20))  { 
                SetTimer(2, 300);
                cGallo.Walk(800, 900, eBlock, eWalkableAreas); 
                cEgo.Walk(870, 900, eBlock, eWalkableAreas); 
                varGALLO=3;
                }
            if ((varGALLOCAFE==3) && IsTimerExpired(20)) { 
                cEgo.Say("Creo que ya es suficiente");
                 }
}

And it doesn't work, when the main character first give coffe to the rooster, they move to the expected place, but the first dialog remains the one that appears.

Can someone explain what I'm doing wrong?
thanks
#4
Im using the AGS 3.6.057, the sierra style template, no GUIS in the bottom, and I belive pretty default dialog options.

my dialog settings

I'm using 1920 x 1080 resolution, could that interfere here?
#5
I don`t know why, but the last choice of all my dialogs is not clickable, and, as you can see in the picture below, doesn´t react when the mouse is over

https://ibb.co/ykBPDH5

Can someone help?
#6
Quote from: Khris on Sat 08/06/2024 09:55:42Leaving aside my player/cGallo mistake, the bool is defined right there in the first line of my snippet, and you were supposed to also put that in your own room script obviously.

Yeah, that was the problem, i mistakenly did not copy your first line. I dont want this particular NPC to respond to the characters movement, but its something I also wanted to know how to do for another part of the game. Thanks a lot

Quote from: Snarky on Sat 08/06/2024 07:11:25AndreasBlack's code looks correct (apart from horrendously wrong indentation and formatting of the {} braces), but it will introduce a pause of some seconds between each walk. If you want the next movement to begin as soon as the last one is complete, you should replace all the IsTimerExpired() checks with !cGallo.Moving.


That works. Thank U so much. Also,  your comprehensive explanation has been of much help


this community is great. thanks all
#7
Thanks for your answers, but still not working

I tried your code, FortressCaulfield, phrased like this

Code: ags
function room_RepExec()
{
if (player.Room == 6){
  if (cGallo.x == 400){ 
          cGallo.Walk(1000, 1020);
          }
  
  else if (cGallo.x == 1000) {
          cGallo.Walk(400, 1020);
          }

}
}

And the character performs the walking animation while staying at the starting position. I don't get it.

Khris, thank u for your input too, but in your code the movement of the NPC would depend on the main characters move, and I need the NPC to move regardless what the character does. I tried your code anyway just to find out, but it doesnt compile (Error (line 22): undefined symbol 'walking_right'), and I dont know the proper way to phrase it.


In case you are interested, the NPC is a rooster ("gallo" is spanish for rooster) wandering in the background of a farm. I thought this kind of think would be the easiest thing to do...
#8
Thanks so much for your help, I wasnt aware about timers, I'm sure it will be usefull, but its still not working.

Your code only makes the NPC (you were right) to perform the first movement, but it fails to perform the second and just stays still.

I've run into this problem before, I can create global variables, but when I try to change their value through the code I don't seem to be capable of making it work.

Any ideas?
#9
Hello. Can someone explain me why this works

Code: ags
function room_AfterFadeIn() {

   cGallo.Walk(1000, 1020,  eBlock); 
   cGallo.Walk(400, 1020,  eBlock); 
   cGallo.Walk(1000, 1020,  eBlock); 
   cGallo.Walk(400, 1020,  eBlock); 
   cGallo.Walk(1000, 1020,  eBlock); 
   cGallo.Walk(400, 1020,  eBlock); 
}

but this doesn't?


Code: ags
function room_AfterFadeIn() {

   cGallo.Walk(1000, 1020,  eNoBlock); 
   cGallo.Walk(400, 1020,  eNoBlock); 
   cGallo.Walk(1000, 1020,  eNoBlock); 
   cGallo.Walk(400, 1020,  eNoBlock); 
   cGallo.Walk(1000, 1020,  eNoBlock); 
   cGallo.Walk(400, 1020,  eNoBlock); 
}

in this second version, the character just walks directly to the final point, how can I get a character to execute multiple walk commands without stoping the main action?

thanks
#10
ok, now I get it

thank you so much
#11
thanks

and how can I set the timer check in a repeatedly execute mode?
#12
Hello

Im trying to make my character change room after entering for the first time, seen a text displayed and wait for, lets say 4 seconds. I do it like this

Code: ags

// room script file

function room_FirstLoad()
{
Overlay.CreateTextual(20,133,0, Game.SpeechFont, 15,"El 28 de julio de 1914,despues de siglos de tensiones, estalla una gran guerra en Europa.");  
SetTimer(1,160);
if (IsTimerExpired(1)) {
player.ChangeRoom(2);
}

}





It builts, but just never changes to room 2.

I cant see what I'm doing wrong, could someone help please?
SMF spam blocked by CleanTalk