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

Messages - omegamit6zeichen

#1
okay i found it, i was completely overlooking it:
under visual is an option "when player interface is disabled, GUIs should" .. was set to hide all their control ...

just to anser your question .. yes i was starting with an empty template ..
#2
i've checked, all items in the inventory disapear, and also when say commands unrelated to the inventory are done
#3
Hi, i am using a slightly modified version of the TwoClickEventHandler
Code: ags
function on_mouse_click(MouseButton button)
{
	// when mouse is clicked, text label is cleared
	//lblActionText.Text = "";
	
	// when game is paused, clicks aren't processed
	if (IsGamePaused())
	{
		return;
	}
	
	// Left Mouse Button on Object/Character/Hotspot/Location
	// when no inventory is selected:
	// - INTERACT with target
	// - walk to location
	// else
	// - USE inventory on target
	else if (button == eMouseLeft)
	{
		if (GetLocationType(mouse.x, mouse.y) != eLocationNothing)
		{
			if (player.ActiveInventory == null)
			{
				ProcessClick(mouse.x, mouse.y, eModeInteract);
			}
			else
			{
        MovesToItem=false;
				ProcessClick(mouse.x, mouse.y, eModeUseinv);
        
			}			
			
		}
		else
		{
			if (player.ActiveInventory == null)
			{
        MovesToItem=false;
				ProcessClick(mouse.x, mouse.y, eModeWalkto);
			}
			else
			{
				player.ActiveInventory = null;
			}
		}			
	}

	// Right Mouse Button on Object/Character/Hotspot/Location
	// when no inventory is selected:
	// - EXAMINE target
	// else
	// - DESELECT inventory
	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 on Inventory Item
	// when no inventory is selected:
	// - INTERACT with target 
	// - SELECT target
	// else
	// - USE inventory on target
	else if (button == eMouseLeftInv)
	{
		InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
		if (i != null)
		{
			if (i.GetProperty("propInstantUse") == true)
			{
				if (player.ActiveInventory == null)
				{
					i.RunInteraction(eModeInteract);
				}
				else
				{
					i.RunInteraction(eModeUseinv);
				}
			}
			else
			{
				if (player.ActiveInventory == null)
				{
					player.ActiveInventory = i;
				}
				else
				{
					if (i.ID != player.ActiveInventory.ID)
					{
						i.RunInteraction(eModeUseinv);
					}
				}
			}
		}
	}
	
	// Right Mouse Button on Inventory Item
	// when no inventory is selected:
	// - EXAMINE target
	// else
	// - DESELECT INVENTORY
	else if (button == eMouseRightInv)
	{
		if (player.ActiveInventory != null)
		{
			//player.ActiveInventory = null;
			return;
		}
		
		InventoryItem *i = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
		if (i != null)
		{
			i.RunInteraction(eModeLookat);
		}
	}
	
}


when i rightclick the inventory item the following function is called:
Code: ags
function iInvItem1_Look()
{
player.Say("this is an X");
}

but during the time the player says "this is an X" the item in the inventory disappears, and appears again afterwards
#4
ty for your fast answer,
i've solved the problem .. it was much easier ... the walkable area was a few pixel away from the position where i wanted to go ...

it will try to get an alogrithm which finds the best position around an item ...(because i dont want the char to stand on the item)

#5
Hi, i wanted to write a function that lets the character walk to a specific point and after that pick up an item.

Code: ags

function game_start()
{
  currObj=null;
  currChar=null;
  currItem = null;
  visible=eVisible;
  MovesToItem=false;
}
void WalkToPickUpItem(Character *actChar, Object *obj, InventoryItem *invItem, String onPickup, VisibleAfter vis)
{
  currObj=obj;
  currChar=actChar;
  currItem=invItem;
  XInteractPos=obj.X-XMARGIN;
  YInteractPos=obj.Y-YMARGIN;
  sOnPickup=onPickup;
  visible=vis;
  actChar.Walk(XInteractPos, YInteractPos, eNoBlock, eWalkableAreas);
  MovesToItem=true;
}

function repeatedly_execute()
{
  if(MovesToItem)
  if(currObj != null && currChar != null && currItem != null)
  {
    if(currObj.Visible==true)
    {
      if(currChar.x == XInteractPos && currChar.y == YInteractPos)
      {
        currChar.AddInventory(currItem);
        if(visible != eVisible)
        currObj.Visible=false;
        
        currChar.Say(sOnPickup);
      }
    }
  }
}


the character walks to the specified position but then it does not pick up the item
i think the problem is here:
Code: ags

if(currChar.x == XInteractPos && currChar.y == YInteractPos)

My thoughts about it:
because the char.x, char.y position are the sprite position on the top left side
while the move x,y are the somwhere @ the feet of the character

but i dont know exactly how they are calculated
something like walkx=(char.x +char.width/2) walky=char.y+char.height ?

or is there an easier way to achieve this?
#6
i've never felt so stupid in my whole life... <.<
ty ....
#7
Hi,
i am new to AGS (v.3.3) and for our game i'm currently trying to make a screen which appears when pressing esc, and disappears when pressing it again.
So far so good, i made a little gui, and a method for toggling the visibility
Code: ags

function ToggleIngameGui()
{
   if(PauseGui.Visible == false)
    {
    
    PauseGui.SetSize(300, 1);
    PauseGui.LockView(3);
    
    PauseGui.Visible=true;
    PauseGui.Animate(0, 3, eRepeat, eNoBlock);
    PauseGui.TweenSize(1.0, 300, 400, eEaseInTween, eNoBlockTween);
    PauseGui.TweenTransparency(1.0, 0, eEaseInTween, eNoBlockTween);
    }
    else
    {
      PauseGui.StopAllTweens(eFinishTween);
      
      PauseGui.TweenSize(1.0, 300, 1, eEaseOutTween, eNoBlockTween);
      PauseGui.TweenTransparency(1.0, 100, eEaseInTween, eNoBlockTween);
      WaitSeconds(1.0);
      PauseGui.UnlockView(true);
      PauseGui.Visible=false;
    }  
}


but when the gui appears the game is stopped (visibility = Pause game when shown)

and now the on_key_press event in the global script will not be executed (which is on purpose i think).
Is there some way to catch the event for the gui itself? .. the only thing i have is a very ugly workaround in the repeatedly_execute function ...
Code: ags

function repeatedly_execute() 
{
  //ugly workaround
  if((IsGamePaused() == 1) && (PauseGui.Visible == true))
  if (IsKeyPressed(27) == 1) 
  if(PauseGui.Height == 400)
  {
    ToggleIngameGui();
    Wait(100);
  }
  
}

SMF spam blocked by CleanTalk