Trying to use following character on an item before char has entered room Error.

Started by , Thu 21/12/2006 10:34:09

Previous topic - Next topic

iain_westy

HI there.
My problem is this. The player in the game I'm writing gets an inventory item when the player clicks on IAIN. IAIN also follows the player. If the player wants to use IAIN on a hotspot then he uses the IAIN inventory item on that hotspot.
HOWEREVER If the player trys to use IAIN on a hotspot before IAIN has entered the room then I get an error message. What I'd like is a Conditional so that if the player trys to use IAIN before hes in the room, then the Player will say "I'd better waite for him to catch up first."

I'vwe tryed a few things but my knowledge of scripting isn't good enough yet.
I'm sorry if this is in an faq or a tutorial someware. I've tryed to look for it but I have limmited time online and must leave now.
Hope someone can hellp. (I've only been doing this for a week.)

Khris

Make sure that the script name of the inv item representing IAIN is "Iaininv".

Go to the on_mouse_click function in the global script.
There's a line that says: ProcessClick(mouse.x, mouse.y, mouse.Mode);

Replace it with
Code: ags
  if (mouse.Mode==eModeUseInv && player.ActiveInventory==iIaininv && player.Room!=cIain.Room)
    player.Say("I'd better wait for him to catch up first.");
  else
    ProcessClick(mouse.x, mouse.y, mouse.Mode);

Ashen

Oddly, I couldn't find this is a forum search, although I KNOW it's been asked before....

Bah, Khris beat me to it, but I'll just add that you may also be interested in:
Quote from: The Manual
game.following_room_timer
How long to wait before following char emerges in new room, default 150. (higher is longer).

Setting this to a lower value will mean less time the player will have to wait.

Also, read the manual. You don't have to be online to do it, most of the answers will be in there AND you'll improve your knowledge of scripting.
I know what you're thinking ... Don't think that.

iain_westy


SMF spam blocked by CleanTalk