Trying to make a object change the verbs extension with custom properties

Started by AndreasBlack, Mon 18/09/2023 17:01:06

« previous - next »

AndreasBlack

Edit: Solved it myself, solution at the bottom
Abstauber tried to explain to me long ago in a DM. I didn't get it to work then and not now either! (laugh)
Alltho i'm now trying with an object instead of a hotspot that he explained, but i think it should work in theory when i look at his code ???

This is the code i have inside the VerbsGui.asc

Code: ags
static void Verbs::VariableExtensions() 
{

// define here, which things will use a variable extension (>v)
  // by default, it's only used for doors.
  int r = player.Room;
  Object*oo = Object.GetAtScreenXY(mouse.x, mouse.y);
  int o=0;
  if (oo != null) o = oo.ID;
  Hotspot*hh = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
  int h = hh.ID;

  // Other possible extensions could be: Turn On/Turn Off
  
  // Open/Close Extension:
  // Room | Hotspot |(Door_id)


else if (r==20 && o == 0) {  //trying to get object[0] in room20 to flip between open/close verb Extension
    if (oo.GetProperty("Pushed") == 0) Verbs.AddExtension('y');
    else Verbs.AddExtension('s');
}
}

}

and in the room scripts object 0's anyclick  i have this

Code: ags
  if (Verbs.UsedAction(eGA_Open) && oGate_LEFT.X==0)

{
    oGate_LEFT.SetProperty("Pushed",1);

  player.Walk(460, 2250, eBlock);
  player.FaceDirection(eDirectionUp, eBlock);
  aGate_Open.Play();
  oGate_LEFT.Move(-82, 2400, 1, eNoBlock, eAnywhere);
  oGate_RIGHT.Move(82, 2400, 1, eNoBlock, eAnywhere);
  RestoreWalkableArea(3); 
 
}


What should i pick in Custom Properties?
i've created a new one in Object[0] properties to my understanding called Pushed and it's set to 0 as a "Number" and what it should apply to i choose "objects" unsure?



Edit: Solved it myself finally! Solution was to change oGate_LEFT to object[0] and change to the right extension's the example is push/pull, i didn't bother changing them since i couldn't even get the custom properties working..
In custom properties it should be number, so anyone else that might wonder this knows now!




SMF spam blocked by CleanTalk