how to tell if an npc is in a room [SOLVED]

Started by mport2004, Thu 14/04/2005 01:28:19

Previous topic - Next topic

mport2004

i have a game thats almost finished but i came acrossed a problem in the game you have to guide some people to a village but i want them to stop when they get to the village.

strazer

Something like this?:

In the village room's repeatedly_execute interaction:

Code: ags

  // script for room: repeatedly execute

  if (GetGlobalInt(THEGLOBALINTNUMBER) == 0) { // if quest is not solved
    if ((character[PEOP1].room == character[GetPlayerCharacter()].room) && 
       (character[PEOP2].room == character[GetPlayerCharacter()].room) && 
       (character[PEOP3].room == character[GetPlayerCharacter()].room))
    { // if all people are in this room
      FollowCharacter(PEOP1, -1); // people don't follow you anymore
      FollowCharacter(PEOP2, -1);
      FollowCharacter(PEOP3, -1);
      DisplaySpeech(VILLAGER2, "Thank you!"); // people thank you
      SetGlobalInt(THEGLOBALINTNUMBER, 1); // set quest solved
    }
  }

mport2004

thx im not to good a some parts of scripting yet.

mport2004

the code you gave me wont work i tryed it but it kept comming up w/ errors i changed it a bit

  if (GetGlobalInt(43) == 0) { // if quest is not solved
    if ((character[CPA].room == character[GetPlayerCharacter()].room) &&
       (character[CPB].room == character[GetPlayerCharacter()].room) &&
       (character[CPC].room == character[GetPlayerCharacter()].room))
       (character[CPD].room == character[GetPlayerCharacter()].room) &&
     { // if all people are in this room
      FollowCharacter(CPA, -1); // people don't follow you anymore
      FollowCharacter(CPB, -1);
      FollowCharacter(CPC, -1);
      FollowCharacter(CPD, -1);
      MoveCharacter(CPA,60,140);
      MoveCharacter(CPB,255,140);
      MoveCharacter(CPC,100,188);
      MoveCharacter(CPD,300,185);
      DisplaySpeech(CPA, "Guy wants to talk with you.");
      SetGlobalInt(43, 1); // set quest solved
    }
  }

Ashen

Looks like there's an error with the lines:
(character[CPC].room == character[GetPlayerCharacter()].room))
(character[CPD].room == character[GetPlayerCharacter()].room) &&

I think it should be:
(character[CPC].room == character[GetPlayerCharacter()].room) &&
(character[CPD].room == character[GetPlayerCharacter()].room))

(Unless that's just how you typed it here, and not how it is in the script.)
Apart from that - what error messages are you getting?
I know what you're thinking ... Don't think that.

mport2004


SMF spam blocked by CleanTalk