Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Sat 14/04/2012 22:40:40

Title: SOLVED: Stop NPC from changing rooms after reset
Post by: steptoe on Sat 14/04/2012 22:40:40
Hi


Edit:

These scripts seem to do the trick.. at least for the time being.. more tests needed.  Fingers double crossed!


To change button from Arrest to Arrested!


function Button28_OnClick(GUIControl *control, MouseButton button)
{
 if (Button28.Text=="Arrest")
 {
 Button28.Text="Arrested!";
 }
 }


To reset Button 28 to "Arrest"


function Button35_OnClick(GUIControl *control, MouseButton button)
{
 
 if (Button28.Text=="Arrested"")
 {
 Button28.Text="Arrest";
 }
 }


When the "Go to court" button is clicked


if (Button28.Text=="Arrested!")
  {
   Murderer=cHarrington;
   cHarrington.ChangeRoom(6, 170, 310);
  }




Original post
----------------------------------

I have one button (Arrested) that takes an NPC to room 6 when the 'Go to court' button is pressed..

Button that changes the button text to "Arrested!"

function Button28_OnClick(GUIControl *control, MouseButton button)
{
Button28.Text="Arrested!";
Murderer=cHarrington;
}


If NPC is selected and 'Go to court' button is pressed


if (Murderer==cHarrington)
  {
     cHarrington.ChangeRoom(6, 170, 310)
  }


Button that Resets NPC to stay inRoom3 and reset button text back to "Arrest" before the 'Go to court' button is pressed

{
 
if (Button28.Text=="Arrested!")
{
  Button28.Text="Arrest";
  cHarrington.ChangeRoom(3);
}


In short... how can you stop a NPC from changing rooms once selected and wish to deselect it?

cheers

steptoe