Standard verb responses

Started by tarek, Sat 13/07/2013 20:39:36

Previous topic - Next topic

tarek

I'm trying to think of a way to easily set up stock verb responses in my game when, for example, using "Talk" or "Open" verbs on objects that don't have any specific responses scripted to them makes the player randomly say one of 4-5 stock response lines depending on the verb.

I don't plan to use any verb coin systems in my game (actually remaking an old, somewhat less known adventure game I loved as a kid and learning about the editor in the meanwhile), just the simple MI2-style verb GUI at the moment. I'm not adept at scripting much at all so I'd appreciate any help with this.

Igor Hardy

#1
This is a bit tricky as by default all player interaction responses are handled by the functions attached to specific in-game objects. For instance if you try to "look at banana", the game by default seeks instructions what to do within the function "banana_lookat" instead of some global "look at" function. To subvert this go to the GlobalScript and within the "on_mouse_click" function add something like:

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  if (button == eMouseLeft) {
    if (IsInteractionAvailable(mouse.x,mouse.y, eModeLookat) == 0) player.Say("looking here would not do anything.");
  }
}

This is only for the look at command (symbolized in the script by "eModeLookat"), so add further lines of script to address the remaining MI2 GUI verbs.

EDIT:

Oh, I forgot there is also the unhandled_event list. Search for "unhandled_event" in the AGS help file to get details how to use it - this could potentially be an even simpler solution than the one mentioned above. But both should accomplish what you need.

tarek

Thanks for the response. It seems like the unhandled_event stuff is the way to go, I'll give it a try.

SMF spam blocked by CleanTalk