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 - Stranga

#121
Thanks khris! I just kept shooting at it hoping something would work and it did by accident. And I did originally had an animated button, what you saw were my desperate attempts to get this to work. Thanks for the tip, I'll also check out the link. I could always use better methods of doing things rather than guessing haha :)
#122
Hey everyone!

I can't quite figure out how to do this. I've tried a few different ways and nothing. What I am trying to achieve is that when the player walks over a hot spot an exclamation mark appears above her head and when not disappears. The game is keyboard only so I'm still new to this.

So far, I've tried this:

Code: ags

function repeatedly_execute() 
{
int px = player.x - GetViewportX(),py = player.y - GetViewportY();
Hotspot*h = Hotspot.GetAtScreenXY(px, py);
if (h!=null){
  gHotspot.Visible=true;
  gActionText.Visible=true;
  lblActionText.Text=h.Name;
  btnExclaim.NormalGraphic=866;
  }
  else
  {
  gHotspot.Visible=false;  
  gActionText.Visible=false;
  lblActionText.Text="....";
  btnExclaim.NormalGraphic=0;
  }  
 }


gHotspot has the exclamation mark button in it and I added the action text to see if it works and the action text does, the button changing graphic does not.
Any help would be greatly appreciated.

EDIT

I solved it by changing this:

Code: ags

function repeatedly_execute() 
{
int px = player.x - GetViewportX(),py = player.y - GetViewportY();
Hotspot*h = Hotspot.GetAtScreenXY(px, py);
if (h.ID ==0 ){ //<CHANGED THIS ----------------------------------------------------------------------
  gHotspot.Visible=false;  
  gActionText.Visible=false;
  lblActionText.Text="....";
  btnExclaim.Animate(82, 0, 1, eOnce);
  }
  else
  {
  gHotspot.Visible=true;
  gActionText.Visible=true;
  lblActionText.Text=h.Name;
  } 



#123
Thank you everyone and especially CW and Khris you both have gave great answers but also solved a few problems that I would of had to post here.
#124
I thought it was the best method at the time didn't think it would be the actual way to do it. The bool method would be good if I weren't using the RestartGame() function. One other thing that I wanted to ask about is which way is better or they both do the same thing:

Code: ags

if (player.ActiveInventory==iAxe && Game.DoOnceOnly("CutTree"))

//or

if (Game.DoOnceOnly("CutTree")){
    if (player.ActiveInventory==iAxe){

    }
}


I have used both ways and they both "seem" fine to me but I am unsure if they would conflict with each other some how with the first example.
#125
Hello everyone, I want to use an item on a hotspot only once to get another item without losing the initial item. So far I've been using
Code: ags
if (Game.DoOnceOnly("GainItem"))


But I'm not sure if this is the best method/way to do this. Anyone have any ideas or experience on how to do this or is this way fine?

P.S wasn't sure If this sort of question should be posted here but any moderators are more than welcome to move it :)
#126
Thanks CW! The alternative worked for me.
#127
Hello everyone!

I want to know is there a way to give the player all inventory items they don't have? I'm making my own debug system because I will be using it as a cheats mechanic later on after the game is finished.

Any help would be greatly appreciated!
#128
Hello everyone, I'm not sure where to post this but it's been bugging me all night.

I'm using AGS 3.4.1.10 and every time I go to test the game I keep getting this error
Code: ags
Could not build target platform _Debug, because the file 'acwin.exe' is unavailable.


Plus the game exe doesn't show up anywhere after it's compiled. Anyone have any idea on what this is or what is causing this?

Thanks in advance

EDIT:

I seem to have fixed this by extracting another acwin.exe in the systems folder but now I have a new error:

Code: ags

Error: Access is denied
Version: AGS 3.4.1.10

System.Exception: Access is denied ---> System.ComponentModel.Win32Exception: Access is denied
   at AGS.Editor.Tasks.RunEXEFile(String exeName, String parameter, Boolean raiseEventOnExit)
   at AGS.Editor.Tasks.TestGame(Boolean withDebugger)
   at AGS.Editor.InteractiveTasks.TestGame(Boolean withDebugger)
   --- End of inner exception stack trace ---
   at AGS.Editor.InteractiveTasks.TestGame(Boolean withDebugger)
   at AGS.Editor.Components.BuildCommandsComponent.TestGame(Boolean withDebugger)
   at AGS.Editor.Components.BuildCommandsComponent.CommandClick(String controlID)
   at AGS.Editor.ToolBarManager.ToolbarEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at AGS.Editor.ToolStripExtended.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


Solved: I found the reason after spending all night researching. It was Avast Antivirus not allowing the exe to run and even deleting it. I added the game files to the ignore list and works like a charm. Hope this helps other people who have the same problem.
#129
Funny you should mention that! I spent all afternoon changing stand on hotspots to regions haha! (Should have done that ages ago)

And I see what you're saying, the only thing is I have a cursor that selects yes or no which is controlled in my global script via keyboard. Would this method still work with that or would I have to transfer the keyboard lines to the room script?

EDIT: I should have read carefully before typing (Sorry). Thank you, it works great! :)
#130
Hello everyone,

I am having trouble with a custom choices GUI I made. It pops up with a yes or no choices which each selection is chosen with the keyboard since this is a completely keyboard controlled game.

The trouble is when I have the GUI displayed everything works fine, BUT, the speech and text keeps going on in the background. What I'm trying to achieve is that when the CHOICE is selected (YES or NO) the text will change depending upon what choice the player makes. I have placed this on a stand on hotspot event.
#131
Yep that's fixed it! Thank you very much Khris! :smiley:
#132
Sorry about that. Wouldn't let me copy the text so I took a screenshot.



Now your code works fine if i scroll through the inventory to the right or down, when I reverse it and go past the first item in the inventory,
^ this occurs. Also another thing I noticed is that the images and names don't match up properly. Say for instance, I have a picture of a key, the
name says blue cup. If I have a picture of a cup it says key. I was thinking it may have something to do with the top of the inventory method (could be something completely different but this is just my guess)
#133
That seems to only work when I scroll through 1 direction. If I scroll to the right it stops on the last item. if I scroll past the first item to the left it errors. Maybe I am missing something from the code?
#134
Ah, that's excellent! That would save a ton of time coding if I can use both normal interactions and item interactions! Thanks very much Khris! :smiley:

There's only one other thing. If there's no inventory to select as active inventory it errors out. Should I just add something like:

Code: ags

if (player.ActiveInventory!=null)
    {
            
          player.ActiveInventory = inventory[InventoryWindow2.TopItem];
          lblItemDescription.Text = player.ActiveInventory.Name;
    }
#135
I fixed the issue with what Gilbert mentioned. I added 12 pixels in on both X and Y.

Khris: It was my original idea to use player active inventory.
For example:

Code: ags

function hDoor_WalkOn()
{
if (player.ActiveInventory==iKey)){
  if (IsKeyPressed(eKeyReturn) && !Inventory)  //If Enter pressed and Inventory is not open
    {
      {
      player.FaceDirection(eDirectionUp);
      player.Say("It Unlocked!");
      player.Say("The door is open!");
      }
    }
}
}


Would this work at all, without mouse support?

Edit: I changed to your code Khris, Much better than I had plus...I'm so dumb for that error before.
#136
Khris: This may be a work around solution, I'll have to test it. I was trying t avoid using active inventory because when I tried that theory in game when the player stood on a hotspot and had th  active inventory code the mouse with the inventory item selected would appear. (I suppose I could remove the cursor images and it may work, not sure).

Gilbert: I think I may have tried your code before and I though so to adding an extra 4- 16 pixels to center the GetAtScreen script. But I didn't try InventoryWindow1 with that line so I will give that a try also.
#137
My apologies, there is no mouse control or cursor, was typing without thinking. I am using a a small HUD like inventory similar to the legend of Zelda how it works is it checks what is in the first slot of the inventory window. Since the inventory only has one slot showing, it uses that information to play an action in the game. For example if you open your inventory selection, press either left or right and it scrolls through the inventory. When you land on an item of choice, close the inventory, your selected item will now show in the HUD. I've set up a global variable for a selected item which uses the item's ID to determine which item is selected (It works quite nicely actually). So when the layer is standing on a hotspot and has that item ID selected and presses the Enter key it does something.



This is an example of what it looks like. Now where it says market key is a label. It wont change when another item is selected. I though of GetTextProperty but that didn't work.

Also here's the secret inventory code I made for the game ;) haha:

Code: ags

function repeatedly_execute_always() 
{
//This checks what is in the equip slot on the HUD then sets the ItemSelect No.
  InventoryItem *i = InventoryItem.GetAtScreenXY(InventoryWindow2.X, InventoryWindow2.Y);
if (i != null)
    { 
      ItemSelect = i.ID; 
      lblItemDescription.Text = i.Name;
    }


InventoryWindow 2 is the HUD inventory window, I made 2 to make 2 separate windows
#138
Hey everyone, this sounds simple but is driving me mad. What I am basically trying to do is to change a label text to = an inventory the mouse cursor is over an inventory item.
Except the game has no mouse control, It's a game made for keyboard
#139
Thanks for replying Slasher. That is actually my back up plan if I couldn't figure this out.
#140
EDIT:

I worked it out but it took a while. What I had to do was make 2 inventory windows 1 for the actual inventory menu and the other for the equip box.
Then I used this:

Code: ags
  InventoryItem *i = InventoryItem.GetAtScreenXY(InventoryWindow2.X, InventoryWindow2.Y);
            if (i != null) ItemSelect = i.ID;


I worked out that you need to gave a visible GUI to use GetAtScreen(Take it easy, I'm a newb at scripting)
But I may upload this inventory system I made if or when I get time. It's easy and simple to use if you want to make a full keyboard integrated game plus you use AGS's inbuilt inventory system rather than create your own from scratch. :)

Hey everyone,

Basically what it says in the subject (If that makes sense). What I'm trying to achieve is when the player has an "equipped item" do something.
For example:

player has a key equipped
(pardon the very watered down code)

if player stands on a hotspot and item.ID = 2;
{
Do something

}

So basically all I need is something to tell and set say a global variable "ItemSelect" what item ID is in the equip box OR at the top of the inventory window.
SMF spam blocked by CleanTalk