DoomZ – A DayZ remake in the Gzdoom and Zandronum Doom Engines

DoomZ Forums Developers Coding New inventory

This topic contains 13 replies, has 1 voice, and was last updated by  Superpomme 2 years, 5 months ago.

  • Author
    Posts
  • #219

    Superpomme
    Keymaster

    This is going to be a big job. Currently the code for this is incredibly wasteful, and relies on pressing buttons to navigate. It would be great to improve the back end to this, but perhaps also look at having a mouse driven ui. At least it’s great that the scaling issues are now sorted, so the game runs fine in all reses.

    If anyone has input on a good ai set up, or code to help with it, please let me know

  • #260

    Superpomme
    Keymaster

    Ok, I’m going to test out the inventory by having an array of held items, and having the pickups run a script, this can then kick out the items if you go over (currently if you run over items you can pick up more than you can hold before it kicks in and stops you),

    gonna put together some useful decorate and give it a try

  • #261

    Superpomme
    Keymaster

    Classes:CustomInventory http://zdoom.org/wiki/classes:CustomInventory

    All code pointers in the Pickup state sequence are called when the item is being picked up. The sequence is successful when the last called function in the state doesn’t return failure explicitly; you can also use ACS_ExecuteWithResult to set the result from ACS. Success can be overridden by terminating the state sequence with fail instead of stop.
    Anonymous Functions can utilize return int and return bool to succeed or fail a custominventory chain. An int of 0 or a false boolean fails a function (and possibly the chain), while any other number succeeds the chain. (development version e7b9e7e only)
    Ktip.png Tip: Jumping functions always set success to false.
    If the Pickup sequence returns successfully the behavior depends on the presence of the Use state:
    If there is no Use state the item will be removed from the map and not be placed in the actor’s inventory.
    If there is a Use state the item will be placed in the actor’s inventory.
    If the item has a Use state and is being used by the player the Use state sequence is called. Failure or success are determined the same way as for the Pickup state. If the sequence returns successfully the item is removed from the inventory. Note that due to this special behavior, the Use and Pickup states will ignore all frame durations and shouldn’t be looped, attempts to do to so may result in the sequence being interrupted by the engine; every frame will execute within the same tic.
    If the item is being dropped by a monster the Drop state sequence will be executed and the item will never be spawned. This is mostly there for special actions that can be taken by Strife conversation scripts. For regular monster death actions there are better and more flexible way to achieve the same.
    Notes:

    State jumps should use an actual string instead of an offset number to perform the jump to guarantee it does what it’s supposed to do for the Use state.
    To make an item that’s able to be picked up with conditions (excluding the Inventory.MaxAmount property), the inventory item will have to perform a function such as A_RailWait last in the state, especially after jump functions. The +INVENTORY.ALWAYSPICKUP flag should not be used in this case, because even if the sequence fails, the item will still disappear. Instead, after all conditions are met, you should perform a function akin to the described above to signify success.
    User variables can be used with some conditions.
    A jump to the Use state will NOT be treated the same as the actor actually activating it. For this, the +INVENTORY.AUTOACTIVATE flag must be present if it’s for anything non-player related.
    CustomInventory items cannot be used to “fetch” variables directly. They can perform jumps based upon the current actor’s variables that are defined, and execute DECORATE action functions and ACS scripts accordingly, and they can modify that actor’s variables in particular, but nothing else. Once used, the CustomInventory item loses access to its variables, gaining direct access to the owner’s variables inste

    • This reply was modified 2 years, 6 months ago by  Superpomme.
  • #263

    Superpomme
    Keymaster

    “excluding the Inventory.MaxAmount property ” – unsure if that means it already allows this, or whether this means that you can’t do it

  • #264

    Superpomme
    Keymaster

    This should also be able to fix the issue with unused guns (and items, like the morpheine injecting arm) showing up in the list for zandronum – a frustrating issue as it is fine in gzdoom

  • #265

    Superpomme
    Keymaster

    http://zdoom.org/wiki/User_variable – haven’t been using these at all, but they might prove to be really useful User variables are special variable fields that can be created in an actor’s DECORATE and used for various scripting purposes. Contrarily to the args, user variables are guaranteed not to be used by any pre-existing feature, so they can be used without risk of conflict with obscure functions. – Phil, can you take a look at that?

  • #266

    Superpomme
    Keymaster

    http://zdoom.org/wiki/GetUserArray Usage
    Returns the value of one of the affected actor’s user array-bound variables.

    Can retrieve ints or floats. Note that floats are converted into Fixed point numbers when read. (development version 3512154 only) http://zdoom.org/wiki/GetUserArray

  • #267

    Superpomme
    Keymaster
  • #268

    Superpomme
    Keymaster
  • #269

    Superpomme
    Keymaster

    Ugh, the last hr and a half getting angry at the computer for something just not working. Turns out I changed the filename for the save. so much wasted time. Need to go back and uncomment a load of code now

  • #296

    Superpomme
    Keymaster

    We have more done now, but I made a video of where we had got up to with the new inventory UI a couple of days back.

    This needs lots of work to go change all of the items in the game to work with this new system, but then I should be able to replace a huge chunk of code. To do this, we are actually doing away with sbarinfo and using normal hudmessages, as sbar just wasn’t giving us the functionality that we needed. The hud scales to screen res, so everything still alligns correctly even in 640 480

    new UI test2

  • #352

    Superpomme
    Keymaster

    mouse UI coming on nicely – 70% of items are working with the new inventory, as well as the corresponding “guns” that use them. Guns are added dynamically depending on the item, so this should fix the issues with Zandronum listing all of the empty item users (listing morphein injector before you have it etc).

    Next push is listing the guns and making them selectable via the inventory. Next post is code that might be useful for me on the next push

  • #353

    Superpomme
    Keymaster

    http://zdoom.org/wiki/GetWeapon – check currently selected

    Can we use hasweapon as in sbarinfo, but from acs? We could use the same system as the item adding still, so that needs testing too

    Next step, create actor array and add the weapons to it

  • #354

    Superpomme
    Keymaster

    Phil – I got the new gun script to start putting the guns into the list on the left. Still needs adding to the weapons in decorate, but I wanted to make sure that it was working first.

    Things to change on it:

    -currently it just prints out the first 3 of them. Would be great to have this in a loop (its just a 1 line hudmessage, but with \ln in there in between.

    -If we make it a 2d array for the items, then we can start stacking ammo and items

    -when it adds the guns to the list, it doesn’t check to see if you already have that gun yet, so it will just add it. The return value is also a little pointless at the moment – this could be changed to make it so that it fails to pick up the gun, in the same way that the custom inventory ones work. If there are problems with that, set the gun pickups as custom inventory items themselves

    I wonder if we should make it so that you can pick up multiple of the same item, but that it uses up inventory space to do so. If you made a rifle take up a whole bar of 4 etc? If you stacked it at the start and shifted up the inventory, then you wouldnt need to keep fiddling about to make space for it.

    We should look at seeing if we can create a menu for moving items to and from boxes (tents, car boots etc) with the same drag and drop idea, and we can also see if we can set it up like dayz, so you have an “items on the floor around you” type thing

    The new inventory could be used to add items to dead corpses now, so that you can go and loot corpses to pick up items

You must be logged in to reply to this topic.