Jump to content

Lua requests


RoboMat

Recommended Posts

  • 3 months later...

Is there a way to get current (sandbox) world options?

It would be quite useful, for example, for a mod to be able to act based on set zombie spawn rate, day length, transmission type, etc.

 

For example, a mod that adds more infection methods (CorpseMod by Johndough for instance) could benefit from knowing if infection is disabled to act propertly, right?

Link to comment
Share on other sites

Is there a way to get current (sandbox) world options?

It would be quite useful, for example, for a mod to be able to act based on set zombie spawn rate, day length, transmission type, etc.

 

For example, a mod that adds more infection methods (CorpseMod by Johndough for instance) could benefit from knowing if infection is disabled to act propertly, right?

 

Yup, everything is in SandboxVars.lua :)

 

But you can check SandboxOptions.lua to see what the number does (check season.lua for example, I use some of the SandboxVars in it)

Link to comment
Share on other sites

 

Is there a way to get current (sandbox) world options?

It would be quite useful, for example, for a mod to be able to act based on set zombie spawn rate, day length, transmission type, etc.

 

For example, a mod that adds more infection methods (CorpseMod by Johndough for instance) could benefit from knowing if infection is disabled to act propertly, right?

 

Yup, everything is in SandboxVars.lua :)

 

But you can check SandboxOptions.lua to see what the number does (check season.lua for example, I use some of the SandboxVars in it)

 

 

Just tried it. Seems like the SandboxVars stores the values selected on SandBox Options screen.

After saving and reloading the world, as we do not go through the SandBox Options screen anymore, the values are set as default, not as the world current set options.

I also tried to go through the getSandboxOptions() global function, but then the Lore field is nil (as I did not go through the options screen).

 

Setting SandboxVars on world loading is missing implementation, isn't it?

(reported it on tracker)

 

BR, neatfire

Link to comment
Share on other sites

  • 3 weeks later...

i would love if you could add something like this to your IsoThumpable. class:

 public IsoThumpable(IsoCell cell, IsoGridSquare gridSquare, String sprite, boolean north, KahluaTable table, String type)

Where "String type" is the ItemContainer type. By default, all container created are of the "crate" type. Thus the following function would need a change too (instead of "crate", this.type or something like this).

 public void setIsContainer(boolean pIsContainer)  {    this.isContainer = pIsContainer;    if (pIsContainer)    {      this.container = new ItemContainer("crate", this.square, this, 6, 6);      this.container.setExplored(true);    }  }

Thus it would be great if i could create a new container with an own type like

self.javaObject = IsoThumpable.new(cell, self.sq, sprite, north, self, "New type");
Link to comment
Share on other sites

another great thing would be if mods would be allowed to use java too. so like for lua files, it would be great if modders could add .class files to the specific mod folders (e.g. zombie\iso\objects) which would override original game classes if named the same.
 else one would have to replace original game files if a mod needs to alter some classes.

Link to comment
Share on other sites

  • 2 weeks later...

MOODLEFACTORY()

 

 

 

Moodles as it stands require a tremendous amount of work for us to alter.  The function "MoodleFactory()" needs to be put in.  Sure, we can alter moodles with item use (such as cigarettes), but firing a moodle change from a player object is much harder.  

 

One of the classes not inherited to the player object(but inherited by item obj's) is moodleChange(), for example "boredomChange()" or "panicChange()".  That's one other possible solution to this prob.

Link to comment
Share on other sites

Viceroy:  The one you are looking to hook into is the perform() function in a TimedAction.  

 

Overwrite the "perform" function to do your check, for example, for my "Vegetarian" custom trait, I wanted to be able to check the 

 

ISEAT.lua

 

which would then fire a timed action in the perform in it's 'require' at the top, I always think a wee bit of code speaks volumes anyway, here's my code:

require 'TimedActions/ISEatFoodAction' --Hooked into here for "Vegetarian Trait" when they eat ham.   function ISEatFoodAction:perform() -- CUSTOMISED FOR SANCTUARY local player = self.character;local item = self.item;local string whatIam = item:getName();     print("1: is working"); player:Say("AAAAAA"); --If the player eats some ham has the veg trait:if whatIam == "Ham" and player:HasTrait("vegetarian") then print("I ate some " .. whatIam .. " but I'm a bloody vegetarian! eek");else--call the original "Perform" code here: self.item:getContainer():setDrawDirty(true);self.item:setJobDelta(0.0);self.character:Eat(self.item);self.character:getBodyDamage():JustAteFood(self.item);self.item:UseItem(); -- needed to remove from queue / start next.ISBaseTimedAction.perform(self);end-- END CUSTOM HOOK  end  Events.OnFillInventoryObjectContextMenu.Add(ISEatFoodAction:perform());

The code fires every time an item is eaten.  And checks if it is ham.  It fires a print statement.  Pretty self explanatory eh?  Oh!  You might need to alter the require statement at the top if you are using build 26+ because the directory structure is changing now that PZ has gone multiplayer.  

 

The event "Onfillinventory" blah blah blah, is what fires when a player right clicks inventory.  The function name ISEatFoodAction:perform is pinched from the Timed Action which links into that.  

 

Anyway, private message me if you need more help.

Link to comment
Share on other sites

  • 2 weeks later...

Bah, couldn't find the sripting requests thread so I'll post here. Does anyone know if we can create multiple result recipes as in input 1 or more item and output 2 or more different items?

 

If not I'd like to request that. It would open up the recipe modding to allow easy modding for the likes of weapon disassembly mods etc.

Link to comment
Share on other sites

Bah, couldn't find the sripting requests thread so I'll post here. Does anyone know if we can create multiple result recipes as in input 1 or more item and output 2 or more different items?

 

If not I'd like to request that. It would open up the recipe modding to allow easy modding for the likes of weapon disassembly mods etc.

 

That's something I really need to add for a long time.. Will work on it for the 27 :P Cheers !

Link to comment
Share on other sites

  • 1 month later...

It'd be super awesome if the fillContainerType() function appended items to the inventory array instead of overwriting the inventory array.

 

I made a Walking Dead mod, but atm Daryl's crossbow is a little lame. In order to make bolts reusable, I have to either

 

1) spawn crossbow bolts on the floor beneath zombies via OnWeaponHit

2) maintain a global object through OnWeaponHit and check it every time an OnContainerFill event triggers to see if it should add a crossbow bolt to that container and how many

 

Obviously 2) unnecessarily bloats load times by adding a bunch of silly if checks to every container that is filled. But the smart option of just adding it to the zombie's inventory, so the bolt also stays with the zombie if it doesn't die in one hit, is impossible. The zombie's inventory is overwritten on death.

 

At least, that's my assumption, since zombies can have any number of crossbow bolts yet no shoes in their inventories while they are alive, but when checked have no crossbow bolts yet shoes on death.

Link to comment
Share on other sites

I hope I'm not out of line in making this request but I (like I'm sure much of the modding community is as well) am really interested in attempting to modify the look of character sprites to enhance the suspension of disbelief with mods that add lots of choices for things like clothing style, weapon variety, etc.

 

I've spent almost a week studying everything I could discern on my own by reading through and playing with the code in the .class files pertaining to the various managers (Model, Texture, IsoSprite, etc.) and trying to see if I could come up with a way using lua script to play around with customizing anything.

 

Of course, as has been stated many times before in response to those much wiser than myself, the current code set makes it near impossible to do much of anything without access to Indie Stone's custom toolset.

 

What I did discover, however, is that almost all the texture files used as model skins can be replaced with similar files to produce a custom skinned model (much like tommysticks was able to accomplish with his Spiderman Skin Mod.  Kudos to him, btw, for figuring that out!).  The issue is that currently there's no good way to tell the system to use an alternative texture as a texture map for the already implemented models/IsoSprites.  Simply put, you can either replace the texture for a core item and have that texture replace everything that currently utilizes it or you can't touch anything at all.

 

Considering how simple it is to whip up a compatible texture (see below for some examples I've made while experimenting this week), would it be at all possible to have an item property included that allows modders to tell the client to load a pre-existing model but skinned with a custom texture?  I know its not everything we've been asking for in terms of customization tools but it just seemed to me like a simple addition that would give us something new and creative to play with until you have the opportunity and time to release the official toolset.

 

Again, I hope I don't sound ungrateful or demanding in this request.  My thoughts were simply that with all the other priorities you guys have to juggle right now, an additional property or similar method seemed like a quick and easy addition to give us something new to play with without having to produce a full, professional suite of software tools that I understand would take considerable time and resources to properly release for the community right now.

 

Some examples of what I did while playing around are:

 

A black "anodized" knife blade:

ji30gkustevsd1vfg.jpg

 

A shotgun with black furniture (as opposed to the usual brown):

a4i1xf4641i96xnfg.jpg

 

A Poolcue skinned to look like a katana:

rwz4vzb9ux35r57fg.jpg

 

A makeshift "crowbar sprite" created from reskinning the Golfclub:

ru4v5mkck7v9fpkfg.jpg

 

Thanks for your consideration and for making such a fantastic game with so much modding potential! 

Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...

Set variants to Get functions would be really nice. Things like InventoryCapacity, player skill modifiers like SprintMod, etc etc don't have a set function.

I don't know if there's a reason for that, as I'm a noob at Java (only experience with it so far was decompiling Project Zomboid to see what functions I could call). PZ is a really fun game to mod, and there could be a lot more modding opportunities if the get functions without a set function had one.

Link to comment
Share on other sites

  • 4 months later...
  • 9 months later...
  • 3 months later...

Don´t know if this thread is still a thing, but I´ve got a rather little request (I think).

It seems like the client is only able to send/receive commands once the IsoPlayer.instance.OnlineID is set.

 

The problem: If you want to send stuff from the server to the client or vice versa right after the client has joined you can´t seem to do that.

 

The event "OnGameStart" fires before the OnlineID is valid.

 

Solution: Please add an event which is fired after the OnlineID is valid.

 

PS: My post could be complete nonsense and there is a way or it doesn´t even have anything to do with the OnlineID. If so, please tell me.

 

UPDATE: This is fixed with the integration of LuaNet

Edited by Dr_Cox1911
fixed with LuaNet
Link to comment
Share on other sites

  • 1 month later...

I would like to request that ScriptManager.ModuleMap be retrievable, and that all of the fields within ScriptModule be readable as well. This would allow Lua scripts to read, write and interact with every item loaded into the game. For instance to store a reference to every available item in the game you could use the following code.

 

local gameMods = getScriptManager():getModuleMap()
local gameItems = {}

for modName, modObj in pairs( gameMods ) do
	for itemID, itemData in pairs( modObj:getItemMap() ) do
		local tbl = { mod: modName, id: itemID, data: itemData }
		table.insert( gameItems, tbl )
	end
end

for _, gameItem in pairs( gameItems ) do
	print( string.format( "Mod: %s Item: %s\n", tostring( gameItem.mod ), tostring( gameItem.id ) ) )
end

 

This would eliminate the need for members of the community to manually parse individual mods media/scripts/<script>.txt files to build compatibility with each-other. Alternatively TIS can simply implement getAllItems() , similar to getAllRecipes().

Edited by looter
Link to comment
Share on other sites

Function to populate the ModData of an InventoryItem with all the variables from the item and an according function to repopulate all the variables of a newly created InventoryItem with ModData.

Why is this needed: Currently the ModData of InventoryItem is empty and you can´t send an InventoryItem object with LuaNet as payload.

 

A populated ModData of an InventoryItem might come in handy in other situations too.

Link to comment
Share on other sites

3 minutes ago, Dr_Cox1911 said:

Function to populate the ModData of an InventoryItem with all the variables from the item and an according function to repopulate all the variables of a newly created InventoryItem with ModData.

Why is this needed: Currently the ModData of InventoryItem is empty and you can´t send an InventoryItem object with LuaNet as payload.

 

A populated ModData of an InventoryItem might come in handy in other situations too.

I just imagine a listener for every object in the game and cringe.

 

It'd be better just to give access to those variables and to properly transmit the mod table.

Link to comment
Share on other sites

11 minutes ago, Butter Bot said:

I just imagine a listener for every object in the game and cringe.

 

It'd be better just to give access to those variables and to properly transmit the mod table.

I thought more like the current "save" and "load" functions are working. Every important variable regarding that item is put into a bytebuffer with this functions, so instead of putting them into a bytebuffer put them in a lua table. Or have I misunderstood your post?

 

EDIT: And I don´t mean to populate the ModData on itemcreation, just if the function is called the ModData for this item gets initiliased with the variables.

Edited by Dr_Cox1911
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 2 months later...

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
×
×
  • Create New...