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 - gracefully-gauche

#1
Hey, I had an idea for my game where I'd like a character to appear and block off a doorway, but only the second time you walk into a room. The character can be "defeated" (thus unblocking off the door and allowing for you to leave) by giving them three objects that you can pick up. I was thinking of triggering the character with a hotspot, but I know that if I do that, the character will appear every time you try to leave the room when I only want it to appear once. Is there a way for me to create a one-time event like this? Thanks!
#3
Code: ags
Hey, thanks for responding! I'm using the Default template.
Is this what you're referring to?
[code = ags]
function on_mouse_click(MouseButton button)
{
  if (button == eMouseLeft) 
  {
    Room.ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
  if (button == eMouseLeftInv)
  {
    Room.ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
    Room.ProcessClick(mouse.x, mouse.y, mouse.Mode );
  }
  else if (button == eMouseRight || button == eMouseWheelSouth){
    // right-click our mouse-wheel down, so cycle cursor
    mouse.SelectNextMode();
  }
  else if (button == eMouseMiddle) { 
    // Middle-button-click, default make character walk to clicked area (a little shortcut)
    // Could have been just "player.Walk(mouse.x,mouse.y)", but it's best to
    // leave our options open - what if you have a special script triggered
    // on "walking" mode?
    Room.ProcessClick(mouse.x, mouse.y, eModeWalkto); 
  }
  else if (button == eMouseWheelNorth) { 
    // Mouse-wheel up, cycle cursors 
    // If mode isn't WALK, set the previous mode (notice usage of numbers instead
    // of eNums, when it suits us)...
    if (mouse.Mode>0) mouse.Mode=mouse.Mode-1; 
    else 
    { 
      // ...but if it is WALK mode...
      if (player.ActiveInventory!=null) 
      {
        //...and the player has a selected inventory item, set mouse mode to UseInv. 
        mouse.Mode=eModeUseinv; 
      }
      else 
      {
        // If they don't, however, just set it to mode TALK (change this line if you add more cursor modes)
        mouse.Mode=eModeTalkto; 
      }
    }
  }
}
#4
Hey. I'm new to AGS and am still figuring my way out around it. For some reason, certain character functions (e.g. "Look" or "Interact") are looping and playing twice after the interaction occurs. I looked through my code to see if I'd accidentally entered it twice, but it was fine. I looked through my Global Script too, but nothing there either (none of the hotspot interactions are in there). I'm not really sure why it's doing this.

Here's the code from the problematic room:
Code: ags


function hCalendar_Look()
{
    cJessie.Say("It's November 2017.");
}

function hCalendar_Interact()
{
    cJessie.Say("I don't need that.");
}

function hPictureFrames_Look()
{
    cJessie.Say("8 Pictures that Mom framed for me last year.");
}

function hPictureFrames_Interact()
{
    cJessie.Say("I don't need that.");
}

function hJessieClock_Look()
{
    cJessie.Say("It's 3:17 PM.");
}

function hJessieClock_Interact()
{
    cJessie.Say("I don't need that.");
}

function hJessieWindow_Interact()
{
   cJessie.Say("I can't remove the window from the wall.");
}

function hJessieWindow_Look()
{
    cJessie.Say("It's a really nice day outside.");
}

function o8Ball_Interact()
{
    cJessie.Say("There it is!");
    cJessie.Walk(53, 71, eBlock, eWalkableAreas);
    cJessie.AddInventory(i8Ball);
    o8Ball.Visible = false;
    cJessie.Say("Let's ask it where Gigi is.");
}

function o8Ball_Look()
{
    cJessie.Say("My Magic 8-Ball.");
}

function region1_WalksOnto()
{
    cJessie.ChangeRoom(2, 17, 91);
}

function room_AfterFadeIn()
{
    cJessie.Say("Hey there. I'm Jessie. I'm looking for my friend Gigi.");
    cJessie.Say("We were playing hide and seek, and I'm having trouble finding her.");
    cJessie.Say("I think she might be in the basement.");
    cJessie.Say("We should ask the Magic 8-Ball where she is.");
    Display("Look for the Magic 8-Ball.");
}



Thanks!
SMF spam blocked by CleanTalk