Unhandled event dont work if stuff has already been asigned with code?

Started by Alen101, Sun 22/11/2015 05:19:28

Previous topic - Next topic

Alen101

Im using UNHANDLED EVENT,

Code: ags
 if ((what==2) && (type==3)) //Use inventory on object
  {
  player.Say("Dont work.");
  }



the problem is that it works ok but not on an object with this code on it:
Code: ags
function hElectdoor_UseInv()
{
if (player.ActiveInventory == iCtrluni)
 {
 player.Walk(130, 125, eBlock, eWalkableAreas);
player.FaceObject(oPorton, eBlock);
aClick.Play();
Wait(5);
aDoorclose.Play();
 hElectdoor.Enabled = false;
 oPorton.Visible = true;
 player.Say("Listo, la puerta esta abierta.");
}
}

If the function "function hElectdoor_UseInv()" is running it doesnt work :(   //i think it doesnt matter the code, just that the useinv function is on.


Example: I got a garage door that opens only with an inventory item (remote control). I got a (bottle) as another inventory item.
If i use the (bottle) on the door it would be great that the "Dont work" message would be displayed, but because the function hElectdoor_UseInv() have code on it for the
remote control to open the door, if i use the bottle on the door the message wont display so the unhandled event dont work.

So is there any option for this to happen in the rigth way?:confused:???
I need it in the simple way possible because im not a programer.

Cassiebsg

Code: ags

function hElectdoor_UseInv()
{
if (player.ActiveInventory == iCtrluni)
   {
    player.Walk(130, 125, eBlock, eWalkableAreas);
    player.FaceObject(oPorton, eBlock);
    aClick.Play();
    Wait(5);
    aDoorclose.Play();
     hElectdoor.Enabled = false;
     oPorton.Visible = true;
     player.Say("Listo, la puerta esta abierta.");
    }
else if "Don't work."; // probably the easiest solution.
}
There are those who believe that life here began out there...


SMF spam blocked by CleanTalk