Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - onizuka666

#1
Hi Guys,

I'm trying to make an inventory bar which should work like the one in Broken Sword.

I used the following commands:


function on_mouse_click (MouseButton button)
{
  if (IsGamePaused())
  {
    return;
  }
  //LEFT MOUSE BUTTON
  else if (button==eMouseLeft)
  {
    if (GetLocationType (mouse.x,  mouse.y) != eLocationNothing)
    {
      if (player.ActiveInventory ==null)
      {
        ProcessClick(mouse.x,  mouse.y,  eModeInteract);
      }
        else
        {
          ProcessClick (mouse.x,  mouse.y, eModeUseinv);
        }
      }
      else
      {
        if (player.ActiveInventory ==null)
        {
          ProcessClick(mouse.x,  mouse.y, eModeWalkto);
        }
        else
        {
         player.ActiveInventory=null;
        }
      }
    }
  //RIGHT MOUSE BUTTON
  else if (button == eMouseRight)
  {
    if (player.ActiveInventory != null)
    {
      player.ActiveInventory = null;
    }
    else if (GetLocationType (mouse.x, mouse.y)!= eLocationNothing)
    {
      ProcessClick(mouse.x,  mouse.y,  eModeLookat);
    }
  }
  //LEFT MOUSE BUTTON INVENTORY
  else if (button == eMouseLeftInv)
  {
    InventoryItem*item = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
    if (item != null)
    {
     
        if (player.ActiveInventory == null)
        {
          player.ActiveInventory = item;
        }
        else
        {
          if (item.ID != player.ActiveInventory.ID)
          {
            item.RunInteraction (eModeUseinv);
          }
        }
      }
   
  }
//RIGHT MOUSE BUTTON INVENTORY
else if (button==eMouseRightInv)
{
   if (player.ActiveInventory !=null)
   {
     player.ActiveInventory=null;
     return;
   }
  InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
  if (item != null)
  {
    item.RunInteraction(eModeLookat);
  }
}
}

The problem is i still cannot handle items in the inventory "drag'n'drop-style", and it doesn' matter if the if the built-in inventory click handle is activated or not because whenever i click on my inventory bar it just disappears again until I hover with the cursor to the top edge.

Alsos since I was using this script all the objects I placed in my rooms weren't responding to the commands I scripted. This used to work when I used the default function for mouse clicks.

I read a lot already about the problems with the selection of items in the inventory bar but no thread got me any further.

I hope anyone can help me with this or give me a detailed explanation how to make it work.

Thanks in advance
#2
Hello guys,

I hope anyone can help me with my problem since it's a bit more complicated...

I have a room with three Backgrounds. One is the main Background which sets my Szene into darkness. The other two Backgrounds are meant to light the room after switching on the light.
The Thing is one of my lamps in this room is defekt and should flicker oddly. To simulate this, I want  the Background to change between two different Backgroundframes after the light is switched on in a certain rythm.

How can I do this? How are the "on-off" Loops introduced?
Does anybody have an idea how I can do this?
I also want the flickering event to stop after the light is switched off again, meaning the same hotspot should Trigger all this. or maybe it is done via repExecute function...

Thank's in advance for your help!
#3
Hello guys!

In my game I introduced a fogg animation loop as an object into a room which is as large as the room itself.
The problem is while the continuous animation of the fogg object runs in the background I cannot move/controll my character anymore because the waiting cursor is always shown!
Does anyone know how I can circumvent this problem?

Thanks in advance!
#4
Hey guys,

I know now how to make the curser-view change when moving it over objects using the following script:

int previousLocationType;
void UpdateMouseCursor()
{
  int lt = GetLocationType(mouse.x, mouse.y);
  if (lt != previousLocationType)
  {  // location type has changed as of this game loop
  if (lt == eLocationObject) mouse.Mode = eModePickup;
  else if (lt == eLocationHotspot) mouse.Mode = eModeLookat;
  else if (lt == eLocationCharacter) mouse.Mode = eModeTalkto;
  else mouse.Mode = eModeWalkto;
  }
  previousLocationType = lt;
  }
function room_RepExec()
{
UpdateMouseCursor();
}

Is there also the possibility to make the curser change to different curser-views for different objects when moving the mouse curser over them?

Thanks in advance!
#5
Hey guys,

I have a delicate problem here:

After I used,
function repeatedly_execute()
{
   Object *obj = Object.GetAtScreenXY(mouse.x, mouse.y);
   if (obj != null)
   {
     // set new mouse mode until mouse leaves object
      Mouse.SaveCursorUntilItLeaves();
      Mouse.Mode = eModePickUp;
   }
}
which worked in principle to make my cursor to change its appearance while moving over an object to the pick up-cursor,
it appeared that the pickUp-curser was flickering permanently.

It turned out that using this congiguration, my pick up-cursor switched between my view-animation loop I created, and the image which I set for the pick up-cursor.
Finally when testing the game it looks like this: when I move the curser over an object, between every single sprite of my view-loop appears the image-sprite which I set up for my pick up-cursor (and this looks like a flickering).

I hope anybody has also experienced this problem and can help me with it!
Thanks in advance!

SMF spam blocked by CleanTalk