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

#61
Hello everyone,

I was wondering if there was a way to scroll (jump) straight to the top item in an inventory window. I'm aware of InventoryWindow1.ScrollUp() but I'm looking for a way to jump straight to the first item every time you open up the inventory. Any help would be greatly appreciated :) 

EDIT: All good, solved it myself. Was having a major mental block haha! :S

Code: ags

  if (InventoryWindow1.TopItem > 0) 
  {
  InventoryWindow1.ScrollUp();
}


#62
This is perfect!  :grin: Exactly what I need! Thank you very much eri0o! Most of my games have been coded around using any mouse functions so this fine.
#63
Hi there eri0o :) Is there a way to disable the player from using the mouse and just control the cursor via keyboard?
#64
@eri0o I have yes, it's a very useful module! My only concern was that I am using my own keyboard movement script but I may just use it anyway because it is such a timesaver(I can use it just for the menus). Thanks again everyone for the help! I greatly appreciate it :)
#65
That was one of the ideas I had in mind the other was to use a button and to offset an indicator to the right which would have lined up with the inventory items.Although, I'm not sure a button would work as I've tried to use one in the past with no luck so I guess the GUI would work?
#66
Thanks for the response Khris. I've got a much better understanding of dynamic sprites and have some ideas to use in some of my other projects. And yes, I'm using keyboard only for inventory handling. I'm not sure how to go about inventory click/handling without mouse properties. I've looked at controlling the mouse directly but I'd rather not use one at all if possible.
#67
Thank you both eri0o and khris! This works perfectly! I can interact with the items too! Although, I just need to figure out a way to track them with keyboard functions/GUI button(makeshift cursor) but the bulk of what I was trying to do has been solved! Thank you all who contributed! :)

EDIT: Actually eri0o, while were on the topic of dynamic sprites. Is there a way to track the position of one to uses as a cursor? I was thinking about using one to select an inventory item from the list as I can't figure out a way to make an inventory item active.
#68
@CW: I have an idea on how to call each event by using an alternative (invisible) menu using key presses and have the listbox just for show.

@eri0o: That sounds interesting. How would I exactly go about doing something like this? I haven't played with dynamic sprites before(or maybe I have and not noticed, haha) :)
#69
Thanks for your reply CW! I'll take a crack at that later this afternoon. I'd rather let the engine do the bulk work of keeping track of the items. I wouldn't mind learning how to script it in total for learning purposes though, could be useful in other game engines.

As for adding the item name to the list box item.I tried last night to extract the item.Name string to listbox.additem() but it errors saying something about cannot convert into to string or something similar. I'm not at the PC now so I can't exactly paste the actual error. But I think there's a way of converting an int to a string...I think.

EDIT: This only happens when I go to remove an item from the listbox. Adding an item works fine.

P.S while I'm on the subject, is there a way to track the list box options with say a button? I thinking of making a listbox like menu and because my games are all keyboard based I was wondering if it could be possible to interact with the listbox via script rather than on mouse clicks.
#70
Hello everyone,

I'm looking at creating a text list like inventory. I have an idea to use a list box along side an invisible inventory window to select the item in the list and just use an updater to check if the player has an item it would update the name in the list box. But I'm not sure how to implement it exactly (of if it can be done!). Any help would be greatly appreciated :)
#71
Hello there! I've managed to get the plugin to work and it works fine with my controller. I am having a little trouble setting it up though. Is there any way to use these in the on_keypress function? A lot of my menu navigation code is in there and I sorta don't want to re do everything in an rep_ex function to control gamepad input(If possible that is!). Any help would be greatly appreciated.

P.S I forgot to mention, the reason I want to use it in the on_keypress function is if I hold a button down in the rep_ex function it loops repeatedly and I'm not sure if there's a way to check if the POV/dpad has only been pressed once?
#72
Ah I see, thank you CW!

I thought that would have been the case. And you're right, it looks like a lot more work/code to store two integers into a variable. Arrays is the way to go! :D

EDIT: I've implemented the arrays and it looks all fine but when I run the game I receive this error:

Any ideas as to what could be causing this?

DOUBLE EDIT: I forgot to export the functions, my bad :P

Thanks again CW! :D
#73
Hello everyone,

I'm having trouble trying to figure out something. I've set up my game to use keyboard only so I made a key binding script where each key press to be controlled another variable. The reason behind this is so the player can change keys if they don't like the default ones.

Now, what I'm having trouble with is I would like to set 2 keys to 1 binding. Are you able to add two different int's to one?

Here's the start of the code.
Code: ags

eKeyCode KeyUp;
eKeyCode KeyDown;
eKeyCode KeyLeft;
eKeyCode KeyRight;
eKeyCode KeyAction;
eKeyCode KeyBack;
eKeyCode KeyMenu;
eKeyCode KeySprint;
eKeyCode KeySkip;
eKeyCode KeyInventory;

function game_start() 
{
  KeyUp = eKeyUpArrow;
  KeyDown = eKeyDownArrow;
  KeyLeft = eKeyLeftArrow;
  KeyRight = eKeyRightArrow;
  KeyAction = eKeyZ;
  KeyBack = eKeyX;
  KeyMenu = eKeyEscape;
  KeySkip = eKeyEscape;
  KeySprint = eKeyC;
  //KeySprint = 406;//Right Crtl
  KeyInventory = eKeyE;
}


I've also tried this and not sure if it was supposed to work or not:
Code: ags

  KeyUp = eKeyUpArrow || eKeyW;


Any help would be greatly appreciated.

P.S Sorry if this doesn't make much sense, it's a little hard to explain.
#74
I was just typing that out as you posted Khris! :) It seems to function a lot smoother as well!
#75
Thanks for your help Crimson, I have a box as a cursor so I didn't think that it would take the coordinates from the corner of the button. I'll try offsetting on both the X and Y axis as it's a perfect square cursor. 

EDIT: Hmm, this doesn't seem to work as the player.ActiveInventory is still registering as null. I could possibly make a separate GUI as a button and use that? Although, I'd prefer to have everything on the on GUI if that's even possible.
#76
Hello everyone,

What I want to achieve is in the title. I'm trying to make a keyboard playable game and somewhat replicating the Resident Evil classic inventory. I was wondering if I'm able to check/activate what inventory item a GUI Button is hovering over. I'm using a single button as a cursor to switch between different elements.

Firstly, is it possible to do this or would I have to manipulate the mouse and process clicks to use the inventory?

Secondly, I have an idea on how I could do it. I tried this:

Code: ags

InventoryItem *iat = InventoryItem.GetAtScreenXY(btnInvCursor.X, btnInvCursor.Y);

player.ActiveInventory = iat; 


But it doesn't seem to work(I'm not sure if GetAtScreen works with GUI layers?). Any help would be greatly appreciated!

:)
#77
Not a problem, Khris :)

It sorta worked, it was giving me random items as intended but when I added all items to the inventory for testing and it was still giving me items.
#78
Thanks Kris, but where would I add this to the code here? I wanted to avoid adding it on every interaction if possible.

My apologies, I definitely overlooked this one!

Here's the code if anyone's interested.

Code: ags

#define ITEM_COUNT 15  // index 0 - 14
InventoryItem* item[ITEM_COUNT];

function game_start()
{
  item[0] = iRoom4Key;
  item[1] = iRoom2Key;
  item[2] = iStoreKey;
}


void GetItem( ) 
{
  int randomIndex;
  while (true) 
  {
    randomIndex = Random(ITEM_COUNT - 1);//Pick an item at random
    if (item[randomIndex]) break;
  }
    if (!player.HasInventory(item[randomIndex]))//Check if we don't already have the item
    {   
      Display("Item: %s found!", item[randomIndex].Name);//Display the item found
      player.AddInventory(item[randomIndex]);
      item[randomIndex] = null;
    }
}
#79
Hello everyone,

I'm looking at making an item randomizer to change up replay-ability. I have an idea in mind but unsure how to execute it. I'm wondering if there's a way to check if the player already has that item then give them a different random item. I'm designing certain sections where you progress differently and thought this may be something cool to add to the game. 

I found some code (which I've tweaked a little) in an older forum which gives the player random items but doesn't really check if they already have that item and give them a different one.

Code: ags


#define ITEM_COUNT 15  // index 0 - 14
InventoryItem* item[ITEM_COUNT];

function game_start()
{
  item[0] = iRoom4Key;
  item[1] = iRoom2Key;
  item[2] = iStoreKey;
}


void GetItem( ) {
  int randomIndex;
  while (true) {
    randomIndex = Random(ITEM_COUNT - 1);
    if (item[randomIndex]) break;
  }
    Display("Item: %s found!", item[randomIndex].Name);

    player.AddInventory(item[randomIndex]);
    item[randomIndex] = null;
}




Any help will be greatly appreciated :)
#80
Hello everyone,

I am looking for someone to write a story and program it in AGS! I'm working on my own titles but I tend to get distracted quite a lot and start newer ones that go nowhere. Hence it may be a better idea to partner up with someone with a creative mind! This will help give me something to do when I have nothing to do (My free time). I know a lot of you will say "just work your own games", but I tend to burnout myself from working on the same things day in and out. This will help me take my mind off things, plus I'm looking to meet new people :)

There are a few conditions to this offering though (nothing bad, I promise!):


  • The game has to be accustomed to a consoles. Helps the porters when porting the game. That means the player will be controlled by keyboard rather than mouse movements(I have a few scripts for that anyway)
  • I'll be doing the artwork, animations, sound and music (Gives me a break from scripting). So I'll need someone who can script and build things in AGS (i.e like scenes, dialogue, puzzle ideas and more.)
  • I want to see what you come up with as a story idea! The whole point is to help someone's creation come to life! So I need someone to write the story, dialogue, characters and script them all!
  • Have to work under a publisher (This is how I gain most of my income) So it will be under a revenue share arrangement and not upfront payment (Sorry)
  • I tend to make a lot of horror themed based stuff. So if you're into that market I'm all for it! :) (Just no medieval stuff please. Looking for more of a modern setting.)

If you're interested hit me up at strangastudios@gmail.com (If you have discord even better! I'll give it out in my email)

I'll be leaving this open for a few weeks until I either find someone or get no replies. I'm only looking for one person so far, but hit me with your best story ideas! :)

Some of my previous/current games I've worked on: https://stranga.itch.io
SMF spam blocked by CleanTalk