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 - Mantra of Doom

#81
Cool, I think that might be able to sort out my mess. And yeah, before I do anything else, I am going to comment and indent the heck out of my code... just so I know where to find everything.

I sort of just dove in there and starting tossing stuff in as I thought to add it... I'm almost done with the game and my lack of initial neatness has come back to bite me as the more complex things I need to do have gotten lost somewhere.

EDIT:

I replaced the global variables with inventory ones, and I still can't make the interaction work properly. What happens is this

1. I go into the inventory and select the vacuum
2. With the vacuum as the cursor, I click the hotspot
3. Cursor changes back to the regular icon
4. A second click will throw out the normal Interact message

I even commented out all the variable stuff and I still get the normal interaction message. I'm stumped now, as another hotspot that I'm using an inventory on different item) seems to be doing the same thing. I know it worked at one point of time, but I changed so many things since then...
#82
Well, the easiest thing I can think of is set up a view just for falling (and the flailing of arms and screaming that probably goes with it) and when the character hits a point on the edge of the cliff, switch the view to the falling view and have the character "walk" straight down until he stops on the ground (standing frame of fall view). You can then animate him standing up (in a third view).

Read the help in the editor on switching views. It is a handy thing for reference.
#83
You might want to check out the run-script command
Quote from: the AGS Wiki
run-script X Runs global script function "dialog_request", with X passed as the single parameter. This allows you to do more advanced things in a dialog that are not supported as part of the dialog script. The "dialog_request" function should be placed in your game's global script file, as follows:

function dialog_request (int xvalue) {
   // your code here
}

open up the AGS editor and hit the F1 key, type "dialog request" or "run-script" in the search box. F1 is your friend, and so is Search.
#84
I have this interaction code to almost work... and I've been beating my head against a wall for a week trying to straightening this out. I've cut it down to basic elements and it still doesn't seem to work exactly right. I was just wondering if somebody could tell me how to clean it up... or just tell me what I'm doing wrong.

The scenario: The player has to use a vacuum to get a rodent out of a hole in the wall (yes, I know, cliche but it works for what I need it for). The vacuum is an inventory item (once the item is collected the view will change with the character holding the thing, but that's a different code that does work.) and the hole is a hotspot. When the item is clicked on the hotspot, the little rat appears, gets sucked into the vacuum and disappears and a bag that the character is holding contains 1 rat. This is done three times, but I want the player to have a choice in what hole you can start on.

Right now, any inventory item triggers the item specific action wether or not the variables are changed. This is getting a bit irritating.

Global Ints start out as 0 and are changed when inventory items are picked up. Is this right? Maybe that's where I'm going wrong.

Code: ags
function hvent2_Interact() //Regular Left Click on Hotspot
{
player.Say("I can't get in there.");
}

function hvent2_UseInv() //Inventory Item on Hotspot
{
if (player.ActiveInventory ==iSuck3)  // used item is the vacuum
{
  if (GetGlobalInt(3) ==0)//Don't have inventory item Bag with String
{
   player.Say("I don't have anything to put the critter in.");
}
 if (GetGlobalInt(3) ==1) //Have one or the other item to combine
{
   player.Say("I think I might have an idea. Just need something else.");
}
if (GetGlobalInt(3) ==2) //Have all items necissary to get third thing.
{
  player.Say("I'll get it out.");  // vacuum was used
    player.Walk(109, 153, eBlock);
    player.Say("Gotcha stupid rat!");
    oRat1.Visible=true;
    oRat1.Move(111, 70, 3, eBlock, eAnywhere);
    oRat1.Visible=false;
 if (GetGlobalInt(2) ==0) //if player doesn't have any rats
{
   player.LoseInventory(iBag0); //empty bag
  player.AddInventory(iBag1); //bag with 1 rat
  SetGlobalInt(2, 1);
}

if (GetGlobalInt(2) ==1) //if player has one rat
{
  player.LoseInventory(iBag1); //bag with 1 rat
  player.AddInventory(iBag2); //bag with 2 rats
 SetGlobalInt(2, 2); 
}

if (GetGlobalInt(2) ==2) //if player has 2 rats
{
  player.LoseInventory(iBag2); //bag with 2 rats
 player.AddInventory(iBag3); //bag with 3 rats
  SetGlobalInt(2, 3);
}
}
}
}


Again, I'm sure it's something simple that I either missed, or maybe it's my new Left/Right click code. Which is posted below for reference. I know it's a bit of a mess... but it works most of the time.

Code: ags
// next line above rep_ex function
bool mhboi; // mouse has been over inventory
function repeatedly_execute() {
// following code inside rep_ex:
  if (GUI.GetAtScreenXY(mouse.x, mouse.y)) mhboi = true;
  else if (gInventory.Visible && mhboi) {
    gInventory.Visible = false;
    mhboi = false;
  }
//--------------------------------------REPEADEDLEY EXECUTE------------------------------------

  int x = mouse.x;
  int y = mouse.y;
  
  if (IsGamePaused() == 1) return;

  int mm = mouse.Mode;
  int nm;     // new mode
  Hotspot*h;
  Object*o;
  InventoryItem*i;
  int lt = GetLocationType(x, y);   // what's under the cursor?

  GUI*g = GUI.GetAtScreenXY(x, y);
  
  if (mm != eModeUseinv) {
    if (g == gInventory) {
      if (mm != eModeUseinv) nm = eModePointer;
    }
    else {
      if (lt == eLocationNothing) nm = eModeWalkto;
      if (lt == eLocationHotspot) {
        h = Hotspot.GetAtScreenXY(x, y);
        nm = h.GetProperty("def_curs");
      }
      if (lt == eLocationObject) {
        o = Object.GetAtScreenXY(x, y);
        nm = o.GetProperty("def_curs");
      }
      if (lt == eLocationCharacter) {
        nm = eModeTalkto;
      }
    }
    if (nm != mm) mouse.Mode = nm;  // only change if necessary
  }
}

//--------------------------------------ON_MOUSE_CLICK-----------------------------------------

function on_mouse_click(MouseButton button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button == eMouseLeft) {
   if(GetLocationType(mouse.x, mouse.y) == eLocationNothing) {
      ProcessClick(mouse.x,mouse.y, eModeWalkto);
    }
   if (mouse.Mode == eModeUseinv) {
     mouse.Mode = eModeInteract; // kick off inventory
    }
else if(GetLocationType(mouse.x, mouse.y) != eLocationNothing) {
      ProcessClick(mouse.x,mouse.y, eModeInteract);
      mouse.Mode = eModeInteract;
   }
  }
else if (button == eMouseRight){
    // right-click
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModeWalkto;   // loose inv item
    else ProcessClick(mouse.x, mouse.y, eModeLookat);             // or look at ...
  }

  else if (button == eMouseLeftInv) {
    if (mouse.Mode == eModeUseinv) inventory[game.inv_activated].RunInteraction(eModeUseinv);
    else {
     player.ActiveInventory = inventory[game.inv_activated];

    }
  }
  else if (button == eMouseRightInv) {
    if (mouse.Mode == eModeUseinv) mouse.Mode = eModePointer;
    else inventory[game.inv_activated].RunInteraction(eModeLookat);
  }
}


function show_inventory_window () {
  gInventory.Visible = true;
  mouse.Mode = eModeInteract;

}


Thanks for all the help you guys have given me so far. I know looking at a lot of strange code in one post can be annoying, so thanks for putting up with me.
 
#85
Okay, so I lied. Lesson learned though, don't go mucking about in the inner-workings of the code without making a backup.

I believe that I have to rip out all of the interaction scripts and start over again... as every time I fix one thing, three more things break.

For all of you waiting for an update, here are some cute space rats.

#86
D'oh! That makes much more sense and it works. Thanks Akatosh. Now things are running nicely.
#87
This is my code for the interaction script. I know it's probably older, I got it from a post in here and changed the left and right behavior.

Code: ags
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  // script fixed for non-popup modal inv guis
 
  int x = mouse.x;
  int y = mouse.y;
  if (button == eMouseLeftInv) {
    if (mouse.Mode == eModeLookat) {
      player.ActiveInventory = InventoryItem.GetAtScreenXY(x, y);
      mouse.Mode = eModeUseinv;
    }
    else if (mouse.Mode == eModeUseinv) {  // tries to combine something
      InventoryItem * item = InventoryItem.GetAtScreenXY(x, y);
      item.RunInteraction(eModeUseinv);
      mouse.Mode = eModeLookat;
    }
  }
  else if (button == eMouseRightInv) {
    InventoryItem * item = InventoryItem.GetAtScreenXY(x, y);
    item.RunInteraction(eModeLookat);
    if(mouse.Mode == eModeUseinv) {
      mouse.Mode = eModeLookat;
    } // re-setting mouse mode if it was useinv
  }
  else if (button == eMouseRight) 
  {
    if(GetLocationType(x, y) == eLocationNothing) {
      ProcessClick(x,y, eModeWalkto);
    }
    else {
      if (mouse.Mode == eModeLookat) {  // look
        ProcessClick(x, y, eModeLookat);
      }
      else if (mouse.Mode == eModeUseinv) {  // tries to useinv
        ProcessClick(x, y, eModeUseinv);
      }
    }
  }
  else if (button == eMouseLeft)
  {
    if (mouse.Mode == eModeUseinv) {
      mouse.Mode = eModeLookat; // kick off inventory
    }
    else if(GetLocationType(x, y) != eLocationNothing) {
      ProcessClick(x,y, eModeInteract);
      mouse.Mode = eModeLookat;
    }
  }
}


EDIT: I got issue #3 resolved with Khris's latest code and extending the bottom of the gui a bit. Works great now. I still can't figure out issues 1 and 2.

For 1, I tried putting this in the item interaction code as a shot in the dark

Code: ags
function iStrap_Interact()
{
player.ActiveInventory = iStrap;
if (GetLocationType(mouse.x,mouse.y) == eLocationNothing) {
    mouse.Mode = eModeInteract;
}
}


Not too sure where that will lead me, but it doesn't work. Am I at least in the ballpark?
#88
Haven't tried the solution to #1 yet, as I've been fiddling with 2 and 3 with Khris's suggestions above.

I tried copying the suggested code for question 2 into the on_mouse_click and it seems to have broken my interaction code. (I'm using a left click Interact and right click Looks system.) I can't seem to get it back to where it worked, though the right click still works alright. I'll play with it a bit more after I take a step back from it and see what's going on.

As for issue 3, I have a gui button at the bottom left of the screen that calls up the inventory, that code makes it so that the inventory flashes on, but then goes away as the mouse is already outside of that area, it goes away real fast. I think I might have to give up on this part.

Though I do think you guys have pointed me in a good direction.

EDIT: I fixed my interaction script and am back where I started from.
#89
I've read over the manual and the BFAQ and have a couple of questions about tweaking my own inventory. And "Handle Inventory Clicks in script" is set to False.

1.) I have a couple of items that the user has to combine to create a new item. The  items combine nicely, but the problem is that I can only do one at a time.. Item A is used on Item B to make Item C... but I can't use Item C on Item D unless I close the inventory window and reopen it. It makes the whole process a little bit frustrating if
you get stuck.

2.) Is it possible to code the item so that a click with the item not on a hotspot the
cursor changes back to the pointer and the item is reset?

3.) One more thing before I go, is it possible to set coordinates in such a way that if
the mouse goes outside of the inventory window, the window disappears? Like

if Mouse.X (coordinates){gInventory.Visible=false;}
I haven't been able to find which command I want to use for that yet, but I'm sure
that I missed something important.

Thanks for putting up with my questions... if the answer exists in a wiki or previous
post that I haven't come across yet, just point me in that direction.
#90
Have you tried changing the tolerance of the magic wand tool? Turning up the tolerance a little might solve your rock issues and take all the gray bits from the green bits. Also, you might want to run a soft blur on the grass, if it's going into another picture, that might get rid of some of the stray pixels or even help it blend into the background a little. This is especially good for grass that is further in the background.

If the transparency bothers you a little, you can make a new layer under the grass, select the grass that you've "cleaned up" and fill the layer underneath it with a greenish-white. That should take care of that.

Hope that helps you a little. Cleaning up around grass and hair is hard... I think I had a magazine that explained how to get "perfect selections" once, I'll try to dig that up.
#91
I've worked out the script issues, and just have to draw up the rest of the inventory items and script the puzzles. I'd post another screenshot, but I want to keep things a surprise... so instead I just changed the screens in the first post to what they look like with the new interface.

I plan to have the game ready for testing before I go to sleep on Sunday (ambitious, I know, but a goal might keep me on track better) so if anyone would like to be a tester, please let me know either by replying to this thread or sending me a PM. I have a couple of non-ags people testing this but I would like some more experienced testers as well.

Again, thanks to all of you here, for reading this and replying. I hope you guys are having as much fun as I am (except for when I get a scripting error... I hate those).
#92
AGS Games in Production / Re: Murphy's Salvage
Wed 24/09/2008 16:52:11
Hello all... again, I'd like to thank everyone here for all the great help with my first game. I have a couple of screenshots... including the new hallway with lighting effects! It makes the room look like a long corridor instead of a box. Hooray for lighting effects.



And here's the engine room, the engine happily animates... because you can't have low-grade scifi without something animating in the background.




The score so far:

  • Backgrounds are finished
  • I only need a couple of incidental animations :pick up, and however the heck one can climb up and down a ladder. Might need to make that a cutscene.
  • I only need to do some tweaking on GUI design.
  • NPC animations will be finished today.
But all this progress and of course there will be some setbacks... Since I have everything set up, I realize that I can't continue with the puzzles I had planned. Some of them will work, but I have to totally rethink the rest. I think the basic story will stay the same (Salvage worker must make sure that the ship makes it to the job so she can get paid) but how it progresses needs to be rethought. 

At this point, I will take some suggestions... because starting next week, I won't have all this wonderful spare time to work on this. Stupid job.
#93
AGS Games in Production / Re: Stick Quest
Wed 24/09/2008 16:10:15
Great idea, looks like something fun to play around with. I know a whiteboard won't scan, but have you thought of setting up a camera and doing it stop-motion style? But I guess that might be a bit too much work to get all the images in.

Anyway, can't wait to see what you come up with.
#94
Another one that I don't see too often, but I think it should be mentioned because it relates to what Jared just said...


  • The Main Character speak in character. As in... if the character is a typical high school girl then she should talk like a high school girl. A high school girl will speak differently than a ten year old boy who will speak much differently than a scientist or a military dude. That being said, if a high school girl is talking to a military dude, they will both have different speech patterns and personalities.


  • Try to cut down on the obscure slang unless it is to set up a specific atmosphere. If I have to try to decipher what a character says because I'm not from where the author is from, then there's a problem. I'm not talking about "y'all", I'm talking about regional slang... things that only people from a certain area say. I don't expect everyone to know what a "steak salad*" is, so I'm not going to have a game where the character assembles one. The only reasonable way I can see having regional slang is if the character is lost in a different place.. but there should be a bit of confusion when coming across those words or phrases.

*The steak salad is a normal salad with bits of grilled steak, two kinds of cheese, tomatoes, hard boiled egg, red onion, and most importantly hot french fries. Served with either French or Ranch dressing. It only exists in Western Pennsylvania.
#95
Critics' Lounge / Re: AGS Sonic Game Pack
Sat 20/09/2008 07:19:11
It looks like the start of a sonic RPG game. It isn't really a module, more like sprites. Sonic is in several views. You would have to code and do the backgrounds yourself though. They aren't in the folder.
#96
Maybe he meant this Rude Goldberg ?

Sorry, don't mind me, I'm just a silly wrestling fan. But back to games...

I think that puzzles should fit the game... make at least a little bit of sense and not feel forced. I remember playing Monkey Island and wondering what the heck I was supposed to do with the "chicken pulley". I like being challenged, but I don't want to give up on the game because I can't figure out what to do.

Though it does make one want to seek out a hint/walkthrough if the story is good enough to want to continue. Though if the story is cliche or slow, it might not even be worth it.
#97
I got it to work, I thought that "text Gui" was what I needed. I guess that's what you get when you try to learn something at 3am.

Thanks for the help guys, now I just have to tweak it so the text is centered.
#98
I have tried 
Code: ags
 gText.SetPosition(50, 100);

but it doesn't seem to have done anything, the dialog options still appear in the center of the screen and often covers up the character while she's talking.
#99
I tried setting DisplayAtY (200, "message"); but that doesn't launch into a conversation, it only gives me the speech/message text at that coordinate. I would like to move the dialog options down towards the bottom.

Or am I completely misunderstand things here and am putting the script in the wrong place with the wrong variables? I was putting it in the global script.

Sorry to be such a pest about this, I spent so much time customizing the rest of the gui windows, I would like to do this last one for conformity's sake.
#100
As I work on all the guis, hotspots, cursors, walkable areas to put off making that last pesky walk cycle, I came across the customized text window feature.

The problem is, that I can't seem to find a way to move the gui anywhere except smack in the middle of the screen. I've tried gText.Y=200 and a few other things that seemed to make sense (it's a bit late now and I can't remember what all gave me an error.

Is there a way that I can manually set the coordinates of this gui?

SMF spam blocked by CleanTalk