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

#161
Spoke to soon.

How would I go about adding additional scripts to each (which ==)

For instance -

if (which == 1)
      cPedoMan.SayBackgroundClip("&1 DIALOG 1", aPEDO7);
      set a character view etc.
    else if (which == 2)
      cPedoMan.SayBackgroundClip("&2 DIALOG 2", aStonethrow);
      play another line of dialog
    else if (which == 3)
      cPedoMan.SayBackgroundClip("&3 DIALOG 3", aMonstereat);
      something something etc.
    else if (which == 4)
      cPedoMan.SayBackgroundClip("&4 DIALOG 4", aPickuppebble);
something something etc.
    else if (which == 5)
      cPedoMan.SayBackgroundClip("&5 DIALOG 5", aPEDO7);
something something etc.
    else
      cPedoMan_speechTimer = 0; // Loop around
  }
#162
BAH, never mind, I just missed a huge chunk of your code.

Clinically stupid. Sorry.
#163
Hey Guys,

I'm back on this one.  :sealed:

I decided to try Snarky's code instead as I wanted to add additional code to each line (such as set character animations etc.).

Initially i received the error -
Failed to save room room3.crm; details below
room3.asc(11): Error (line 11): '.SayBackgroundClip' is not a public member of 'Character'. Are you sure you spelt it correctly (remember, capital letters are important)?


I then tried to remove the 'BackgroundClip' and simply have 'cPedoMan.Say'

The game luunches this way, however when in that room the game crashes with the following error -
A blocking function was call from within a non-blocking event such as repeatedly_execute_always

Any ideas? Below is the code -

Code: ags
// room script file
int cPedoMan_speechTimer = 0;
 
function repeatedly_execute_always() {
  cPedoMan_speechTimer++;
  if (cPedoMan_speechTimer % 600 == 0) {
    int which = cPedoMan_speechTimer / 600; 
    if (cPedoMan.Room != player.Room)
      return; // do nothing
 
    if (which == 1)
      cPedoMan.Say("&1 DIALOG 1", aPEDO7);
    else if (which == 2)
      cPedoMan.Say("&2 DIALOG 2", aStonethrow);
    else if (which == 3)
      cPedoMan.Say("&3 DIALOG 3", aMonstereat);
    else if (which == 4)
      cPedoMan.Say("&4 DIALOG 4", aPickuppebble);
    else if (which == 5)
      cPedoMan.Say("&5 DIALOG 5", aPEDO7);
    else
      cPedoMan_speechTimer = 0; // Loop around
  }
}



EDIT - COMPLETELY MISSED THIS BIT. Duh

Code: ags
// A helper function to simplify the job of background speech with voice
void SayBackgroundClip(this Character*, String message, AudioClip* clip)
{
  this.SayBackground(message);
  if(clip != null)
    clip.Play();
}
 
#164
Nah, I wanted to run the code (before) the room faded in AND the first time the player enters the room.

The 'First time player enters room' Function seems to pertain to (after fade in) only.

Therefore I had to use the DoOnceOnly.
#165
NEVERMIND, it randomly works now ;)
#166
Hey all,

Trying to display a graphic the first time a player enters a room (before fade in). The first time player enters room function displays 'after' the fade-in. I've tried the below code to no avail :(

Code: ags
function room_Load()
{
    if (Game.DoOnceOnly("Some More Time Later")) {
ginvwindow.Visible = false;
gIconbar.Visible = false;
  Overlay* myOverlay = Overlay.CreateGraphical(0, 0, 25, true);
Wait(120);
    }
mouse.Mode = eModeWalkto;
}
#167
Amazing, thank you so much.
#168
Hello All,

Wondering what the current legalities (if any) pertain to releasing a game made with AGS commercially. I remember back in the day you had to specifically ask Chris Jones for permission or something to that regard.

Any insight/links/direction would be much appreciated.

Cheers.
#169
Absolutely amazing. You're all noble Jedi. Works a treat now.
#170
Poop, I've tried both suggestions, and it's still playing the sound file from the last if with all dialogs. (aAopentrunk from line 32).

See code below, what am I missing?? Really sorry about this.

Code: ags
// room script file
int cPedoMan_speechTimer = 0;
 
function repeatedly_execute_always() {
  cPedoMan_speechTimer++;
  if (cPedoMan_speechTimer % 600 == 0) {
    int which = cPedoMan_speechTimer / 600;
    String s;
    AudioClip *vs;
 
    if (cPedoMan.Room != player.Room)
      return; // do nothing
 
    if (which == 1) {
      s = "&1 DIALOG 1";
      vs = aPEDO7; 
    }
    if (which == 2) {
      s = "&2 DIALOG 2";
      vs = aStonethrow;
    }
    if (which == 3) {
      s = "&3 DIALOG 3";
      vs = aMonstereat;
    }
    if (which == 4) {
      s = "&4 DIALOG 4";
      vs = aPickuppebble;
    }
    if (which == 5)
      s = "&5 DIALOG 5";
      vs = aAopentrunk;
  
    vs.Play();
    cPedoMan.SayBackground(s);
  }
  if (cPedoMan_speechTimer == 3000)
    cPedoMan_speechTimer = 0;
}

#171
Quoteif (cChar.Room != player.Room) return; // do nothing

Worked brilliantly.

Bit of trouble with the manual clips. It seems to play the last one for each line (aPickuppebble) Is there a way to have a unique clip for each line of dialog?

Code: ags
// room script file
int cPedoMan_speechTimer = 0;
 
function repeatedly_execute_always() {
  cPedoMan_speechTimer++;
  if (cPedoMan_speechTimer % 600 == 0) {
    int which = cPedoMan_speechTimer / 600;
    String s;
    AudioClip *vs;
      if (cPedoMan.Room != player.Room) return; // do nothing
  if (which == 1) s = "&1 I am randomly talking to myself"; vs = aPEDO7; 
    if (which == 2) s = "&2 Again I speak to myself"; vs = aStonethrow;
    if (which == 3) s = "&3 I am randomly talking to myself"; vs = aMonstereat;
    if (which == 4) s = "&4 Again I speak to myself"; vs = aAopentrunk;
    if (which == 5) s = "&5 I am randomly talking to myself"; vs = aPickuppebble; // plays this every time.
   vs.Play();
   cPedoMan.SayBackground(s);
  }
  if (cPedoMan_speechTimer == 3000) cPedoMan_speechTimer = 0;
}
#172
Seems to work great!

At one point the character dies and is removed from screen. I'm thinking I should use a global variable in conjunction with this? So that it doesn't run if the character is absent.

Also. the audio "&1" etc. doesn't seem to be working?
#173
Thank Khris,

So this just goes into the room repeat exec?
#174
Thanks Kumpel,

That's one of the Modules' I used. While the the functions explain in that thread are very easy to understand. To actually "make it go!" aren't... at least for me.

Do you write the actual dialog in the module script? or in the room? After installing the module, the BgSpeech.Add worked. but Wasn't sure how to "call it"? If that makes sense.
#175
Hey all,

Just a quickie. I'm trying to get a character to talk to himself in the background (with audio), I've been using the forum search function over the last week or so and ultimately downloaded a couple of modules that didn't work (they may have been out of date). I only need this to occur during one room of my game, so the easiest I can get away with coding this the better.

It doesn't need to be randomized though it would be nice if it looped.

The code would be roughly as follows (I tried this in the room repeat execute, with little luck).

Code: ags
cChar.SayBackground("&1 I am randomly talking to myself");
Wait(600, NoEblock);
cChar.SayBackground("&2 Again I speak to myself");
Wait(600, NoEblock);
cChar.SayBackground("&3 Talkie Talkie Poo Poo");
Wait(600, NoEblock);
cChar.SayBackground("&4 Yawn... Running out of things to say");
Wait(600, NoEblock);
cChar.SayBackground("&5 Weenis!");
Wait(600, NoEblock);
#176
Wow, haven't tried this yet, but that's truly amazing thank you.

I will leave the eModeInteract line of code, as for some reason the pointer doesn't seem to select inventory items.


EDIT, still no cigar :( Whilst the code doesn't run any errors, the cursor still returns to the previous mode when the cursor leaves the ginvwindow GUI. Ultra poop.

EDIT 2 - NEVERMIND, I see why I had to remove the Modeinteract in the second part of the code!!! Works brilliantly now. Thank you so much.
#177
Quote from: MiteWiseacreLives! on Wed 28/10/2015 02:16:52
Yes you can have if statement inside of another.
Not to be insulting, but are you actually reading my replies?
The code goes where I indicated, inside of the (overmenubar == true) block of code, you want to intercept the mouse.Mode = old_mouse_mode
If this is still not clicking for you I can get on my computer and type up the code for you later.

No insult taken at all, I did try the code provided 5-6 different which ways before resorting to the boards, I always do.

I'll give it a go when I get home, thanks again for the patience and assistance.
#178
It's complete hieroglyphs at this point. I already have an if statement, am I able to have two following each other?

Error - undefined token 'IF".

If I could just see where to put the code, I know it would make sense. (Invention via necessity).

Code: ags
function repeatedly_execute() {
  
  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
    if (GUI.GetAtScreenXY(mouse.x, mouse.y) == ginvwindow)
  {
    if (overmenubar == false)
    {
      old_mouse_mode = mouse.Mode;
      mouse.Mode = eModeInteract;
      overmenubar = true;
      mouse.DisableMode(eModeTalkto);

      //etc...
    }
  }
  else
  {
    if (overmenubar == true)
    {
      mouse.Mode = eModeInteract;
      overmenubar = false;
      mouse.Mode = old_mouse_mode;
      mouse.EnableMode(eModeLookat);
     
      //etc...
    }    
  }
}
#179
Tried that one initially but it posted an error, something about not a valid GUI.

EDIT - I've made a new GUI with an inventory window using the above code. Now when I select and inventory item, as soon as I leave the GUI it goes back to the previous mode mode. Is there a way I can make it not return to previous mouse mode If I've selected an inventory item?

#180
Hey guys,

Works with the below code. However it works over the whole GUI (which makes it impossible to select any modes to use on the screen walk/look etc.), is there a way to make the return function work only on the inventory window, not the whole GUI?

EDIT - I could probably make a single UI just for the inventory window and put it on top of the menu bar, this might be the best option?



Code: ags
function repeatedly_execute() {
  
  // Put here anything you want to happen every game cycle, even when
  // the game is paused. This will not run when the game is blocked
  // inside a command like a blocking Walk()
    if (GUI.GetAtScreenXY(mouse.x, mouse.y) == gIconbar)
  {
    if (overmenubar == false)
    {
      old_mouse_mode = mouse.Mode;
      mouse.Mode = eModeInteract;
      overmenubar = true;
      mouse.DisableMode(eModeTalkto);

      //etc...
    }
  }
  else
  {
    if (overmenubar == true)
    {
      mouse.Mode = eModeInteract;
      overmenubar = false;
      mouse.Mode = old_mouse_mode;
      mouse.EnableMode(eModeLookat);
      mouse.EnableMode(eModeTalkto);
      //etc...
    }    
  }
}
SMF spam blocked by CleanTalk