Lua requests
5 5

55 posts in this topic

Recommended Posts

Like on the old forums people can post their requests for lua additions in this thread. Please just post requests here and don't debate about the ones made. The devs are perfectly capable of deciding what to add and what not to add ;) Anyway, here we go:

New / Changed Events:

  • EveryMinute: Self explanatory.
  • EveryHour: Self explanatory.
  • OnUnequip: When Item is unequipped from the primary or secondary slot.
  • OnItemUse: When item is used in the inventory. (E.g. "Eat Food" or "Bandage Wound")
  • OnContainerUpdate: When the item containers are updated (parameters: table of contained items, getType() of the updated container)

New / Changed Functions:

  • IsoFloorBloodSplats(): in the Chunk class (or whatever is necessary to retrieve blood on walls and floors and remove it)
  • FIX ItemContainer:isInCharacterInventory()
  • getFps() in GameWindow.
  • Getter / Setter for amount of splattered blood.

Finished (already in the game)

  • setPermaLocked(boolean) in IsoWindow -- RM : Done for 2.9.9.17
  • isPermaLocked() in IsoWindow -- RM: Done for 2.9.9.17
  • OnRainStart -- RJ : Done for 2.9.9.14
  • OnRainStop -- RJ : Done for 2.9.9.14
  • OnEquipPrimary: Fires when an item is equipped as primary weapon.-- RJ : Done for 2.9.9.14, param : player, item
  • OnEquipSecondary: Fires when an item is equipped as secondary weapon.-- RJ : Done for 2.9.9.14, param : player, item
  • OnItemEquipAny -- RJ : Use the OnPrimaryItem/OnSecondaryItem instead :)
  • OnAmbientSound: Fires when ambient sounds is played (helicopters, gunshots ... etc.) - RJ : Done for 2.9.9.14, param : name of the ambient sound (like "chopper1", "pistolgun2",..)
  • getClosedSprite() -- RJ : use getSprite()
  • setClosedSprite()-- RJ : use setSprite(IsoSprite)
  • getOpenSprite(...)-- RJ : Done for 2.9.9.14
  • setOpenSprite(...)-- RJ : Done for 2.9.9.14
  • setSmashed(...)-- RJ : Done for 2.9.9.14, use isDestroyed() to know if it's already smashed or not
  • getSmashedSprite()-- RJ : Done for 2.9.9.14

Share this post


Link to post
Share on other sites

Great ideas!

 

Event.OnItem/Weapon/AnythingEquip primary and secondary or just both together would make things alot easier for me I thinks.

 

I'm just learning the stuff but it's something I missed when I started fidling. :P

 

(clyde) (clyde) (clyde) (clyde)

Some clydes for you guys.

Share this post


Link to post
Share on other sites

Great ideas!

 

Event.OnItem/Weapon/AnythingEquip primary and secondary or just both together would make things alot easier for me I thinks.

 

I'm just learning the stuff but it's something I missed when I started fidling. :P

 

(clyde) (clyde) (clyde) (clyde)

Some clydes for you guys.

You could use Hooks, such has Hook.Attack.Add(EventGoesHere);

 

LuaHookManager.class <--

 

 

You're probably aware but the current weather state can be retrieved. One could check it 10 minutes, don't remember how though.

Yea, I remember reading some of the source files. I think it had something to do with ambient or something. not sure. :P

Share this post


Link to post
Share on other sites

Thanks for the suggestions guys, but please don't turn this thread away from its original purpose :) Don't debate about the suggestions being made. RobertJohnson will decide what to add and what not to add :)

 

I know that we already can check if it is raining (it's "RainManager.isRaining()" btw) but I want an Event that fires exactly when it starts / stops to rain ;)

 

I have the feeling that this sounds way more "annoyed" than it should :D Just wanted to say this before this turns into a discussion thread.

 

Great ideas!

 

Event.OnItem/Weapon/AnythingEquip primary and secondary or just both together would make things alot easier for me I thinks.

 

I'm just learning the stuff but it's something I missed when I started fidling. :P

 

(clyde) (clyde) (clyde) (clyde)

Some clydes for you guys.

 

I have added your suggestions (if I understood them correctly^^) to the OP.

Share this post


Link to post
Share on other sites

Thanks for the suggestions guys, but please don't turn this thread away from its original purpose :) Don't debate about the suggestions being made. RobertJohnson will decide what to add and what not to add :)

 

I know that we already can check if it is raining (it's "RainManager.isRaining()" btw) but I want an Event that fires exactly when it starts / stops to rain ;)

 

I have the feeling that this sounds way more "annoyed" than it should :D Just wanted to say this before this turns into a discussion thread.

 

Great ideas!

 

Event.OnItem/Weapon/AnythingEquip primary and secondary or just both together would make things alot easier for me I thinks.

 

I'm just learning the stuff but it's something I missed when I started fidling. :P

 

(clyde) (clyde) (clyde) (clyde)

Some clydes for you guys.

 

I have added your suggestions (if I understood them correctly^^) to the OP.

I apologize. I was just answering both of their questions.

 

edit: Aricane didn't actually have a question, I was just agreeing with him and adding on.

Share this post


Link to post
Share on other sites

A few more getters and setters that would be useful in the future :)

Functions:

  • getClosedSprite() for IsoDoor, IsoThumpable and IsoWindow.
  • setClosedSprite() for IsoDoor, IsoThumpable and IsoWindow.
  • getOpenSprite(...) for IsoDoor, IsoThumpable and IsoWindow.
  • setOpenSprite(...) for IsoDoor, IsoThumpable and IsoWindow.
  • setSmashed(...) for IsoWindow and (?) IsoThumpable.
  • getSmashedSprite() for IsoWindow and (?) IsoThumpable.

Share this post


Link to post
Share on other sites
I have added your suggestions (if I understood them correctly^^) to the OP.

Exactly like that, but you accidentally put the OnEquipPrimary two times. The explanations are correct though.

Great, thanks man! (clyde)

 

You could use Hooks, such has Hook.Attack.Add(EventGoesHere);

 

LuaHookManager.class <--

Yeah thanks for the info! I saw that one used somewhere but wasn't sure about how to use it myself. Much to learn...

Share this post


Link to post
Share on other sites

Ahoy everyone! was thinking if item properties were added along the lines of strength change, stealth change etc, similar to the UnhappyChange, StressChange, etc... we could easily make timed boost items, such as the "adrenaline shots" someone was suggesting somewhere, or zombie guts to add a temp. stealth boost.  just randomly thinking it would open a world of mod possibilities without hopefully too much JAVA work. ;) (thanks RJ for being awesome even if this doesnt happen)

Share this post


Link to post
Share on other sites

+1 for OnRainStop - it would be great to somehow add a "Wait till Rain Stops" option.  I might even request the same events for Dawn and Dusk, tbh - for similar reasons.

 

I wouldn't expect this anytime soon, but imo it would be great to see:

 

  • Wider array of item modifiers (like It think GiggleStein suggests) - especially PainChange, i.e. the modifiers currently being held behind Java for pills
  • better tile properties.  It would be nice to be able to easily discern between something like a TV, Bathtub, etc - for adding new context actions on them.

Share this post


Link to post
Share on other sites

Edited the OP with the stuff already done :)

 

Gonna post a list with lua event commented soon :)

 

Oh wow, thank you so much RJ! This is awesome! I think now I can finally get my mod working right!

Share this post


Link to post
Share on other sites
  • InventoryItem.setExactCondition(): A setter that allows us to set a condition directly (e.g.: 93). -- RJ : you can use setCondition(int) already, check with the getConditionMax() what's the highest value :)

Unfortunately we can't use the setCondition(int) setter, because it multiplies all entries by ten, so if you for example want the condition to be 93 it will be 930 in the game actually. As it only takes an int you can't use 9,3 either because it will be rounded to 90 in the game :)

So my request still stands (I hope) ^^

Share this post


Link to post
Share on other sites

- Getter method for the IsoFloorBloodSplats in the Chunk class (or whatever is necessary to retrieve blood on walls and floors and remove it)

- Fix ItemContainer:isInCharacterInventory() or provide another way of checking whether a particular container is in a player's inventory

Share this post


Link to post
Share on other sites

- Getter method for the IsoFloorBloodSplats in the Chunk class (or whatever is necessary to retrieve blood on walls and floors and remove it)

- Fix ItemContainer:isInCharacterInventory() or provide another way of checking whether a particular container is in a player's inventory

 

Added to the OP :)


+ setPermaLocked(boolean) in IsoWindow

Share this post


Link to post
Share on other sites

Thanks.

 

I would also like to see some way of controlling the amount of blood/gore that is splattered. So:

 

- Getter and setter method for blood/gore amount

Share this post


Link to post
Share on other sites

event: OnUnequip

 

This would feel natural with the OnEquipPrimary and secondary already in. Wouldn't prbobably be necessary to have primary and secondary as there isn't such command in game.

 

Btw the OnEquipPrimary was working beautifully when I played around with it! So thanks again for that! (clyde)

Share this post


Link to post
Share on other sites

event: OnGameEndLoadGridsquare

 

At the begin of a game "LoadGridsquare" seems to be called for all gridsquares, which makes it possible to load and display, all barrels for example, on the whole map.

But after that, only grids around the player are accessible.

This means that, for example water levels stored in the moddata of a gridsquare, can not be updated in grids the player is not close too.

If one exists the game far away from, lets say barrels, the change of waterlevel since leaving them will be lost.

 

If there is no alternative already, I would like to have an event that triggers when one exits the game, before all griddata are stored on HD, to give the chance of updating the gridsquare values all over the map.

Share this post


Link to post
Share on other sites

Maybe something along the lines of:

 

OnTimedActionStart

OnTimedActionEnd

OnMakeItemStart <- like OnMakeItem but this is when the action is started.

 

Apologies if these are noted elsewhere.

Share this post


Link to post
Share on other sites

Maybe something along the lines of:

 

OnTimedActionStart

OnTimedActionEnd

OnMakeItemStart <- like OnMakeItem but this is when the action is started.

 

Apologies if these are noted elsewhere.

 

Just in case you didn't know, every TA already has a start() and stop() function.

Share this post


Link to post
Share on other sites

 

Maybe something along the lines of:

 

OnTimedActionStart

OnTimedActionEnd

OnMakeItemStart <- like OnMakeItem but this is when the action is started.

 

Apologies if these are noted elsewhere.

 

Just in case you didn't know, every TA already has a start() and stop() function.

 

How would I go about accessing that from a mod script? Like for instance say I have a mod that adds a sound on the start of a certain action. (i.e. Gulp sound when drinking and then zombie attraction logic or such) Would I have to over-write the start function or hook it somehow?

 

And thanks by the way.

 

-EDIT: OnItemDropped would also be useful come to think of it, I can't seem to find something similar that would give me access to the Item that was dropped. Any Ideas?

Edited by Viceroy

Share this post


Link to post
Share on other sites

How would I go about accessing that from a mod script? Like for instance say I have a mod that adds a sound on the start of a certain action. (i.e. Gulp sound when drinking and then zombie attraction logic or such) Would I have to over-write the start function or hook it somehow?

 

Check out the code of my Lockpicking Mod (TAPickDoorLock.lua):

 

function TAPickDoorLock:start()self.sound = getSoundManager():PlayWorldSound("rm_loud_Lockpicking", false, self.object:getSquare(), 0, 10, 1, true);end

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
5 5