Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Alen101 on Sun 22/11/2015 06:16:02

Title: mixing two objects
Post by: Alen101 on Sun 22/11/2015 06:16:02
im mixing two objects with this code:

Code (ags) Select

function iPilas_UseInv()
{
if (player.ActiveInventory == iPilas)
  {
  player.Say("Doesnt make sense to use this item on itself.");
  }
 
  if (player.ActiveInventory == iCtrlnopilas)
  {

   player.LoseInventory(iCtrlnopilas);
    player.LoseInventory(iPilas);
    player.AddInventory(iCtrluni);
      player.Say("Ok the control should be functional now.");
     
          if(mouse.Mode != eModeWalkto) //this attempt doesnt work
          {
          mouse.Mode = eModeLookat;
          }
  }


The problem is when i mixed them, after the player make that action, the two objects leave and the new one appears, but:
1:After that the mouse cursor change to Walkto, no matter what, even if i was on look at mode before


Could i disable the walk to while the player is on the menu?
Title: Re: mixing two objects
Post by: AnasAbdin on Sun 22/11/2015 06:24:52
What exactly are you trying to achieve after 'mixing the objects'?  ..cursor wise
Title: Re: mixing two objects
Post by: Alen101 on Sun 22/11/2015 06:31:05
Well is not a big problem, just that after i mixed the two objects the mouse cursor changes for the walking cursor, and in the menue the walking cursor is not used, so im trying this not to happen.
Title: Re: mixing two objects
Post by: Slasher on Sun 22/11/2015 06:41:44
Something like this may help. i believe going back to walkto is default.

This is one way.

After combining inv items return to Lookat:
Code (ags) Select

function on_event(EventType event, int data)  //Locate this function in global and add
{
if(event == eEventAddInventory && mouse.Mode == eModeWalkto)
{
  mouse.Mode = eModeLookat;
  mouse.UseModeGraphic(eModeLookat);
}
}


try it...

Title: Re: mixing two objects
Post by: Alen101 on Sun 22/11/2015 07:05:56
Sorry guys it was a stupid mistake from my part,

this code is working now:
Code (ags) Select
if(mouse.Mode == eModeWalkto)
          {
          mouse.Mode = eModeLookat;
          }


the problem was that i had this: != instead of this ==
really stupid mistake thanks for all the help. and sorry for the stupid question.