Jump to content

need help with sprites/icons, and much more to come


stayxstoned

Recommended Posts

first off, this is my very first time modding or doing anything with code so my knowledge is limited tho i learn fast. i started playing this game and learned most of it and started wanting for more content  i.e. weps/recipes/etc. i couldnt find any working mods that were worth a shit other than a neat item spawner that did nothing new so i deleted it. I just started browsing code until i fond the items, then decided to try to add a new gun(hope to add loads, think of state of decay). I succesfully made a Colt .45 that had its own ammo and a working reload function and got it to spawn into the game.  before all this i downloaded some weapon mod that had ak-47, m16, m14, m1garand, etc.  he had new textures and everything but i couldnt get his mod to work at all.  the way i added my colt pistol was i went to the base item files, found the pistol and all required parts(2clips and the ammo)  made some changes and had my new pistol working perfectly. i then decided to add all of the weapons from the failed mod i downloaded earlier. 

sorry for rambling, its my nature, to the point!!

how do i get the new textures for the weapons i added? i currently have all the weapons added and spawned but they are all shotguns or the 1 pistol textures.... lol.....  and to boot the shotgun textures only show when my character is walking a certian way, its invis while shooting, and none but my original Colt .45 reload at all but thats because i copied most of the other dumbshits code when i made them.(dont no if he was completely incompetent or mod was ruined by update. the item code looked ok so i copied and made changes but am going to have to redo as none currently reload).   

 

 rambled again....  i want to add custom icons/sprites for my guns, read it can be done but the tutorial was very bad and poorly translated, or my understanding of lua is just that bad,  

 

and i plan on adding lots of recipes and other items after i finish this (crafting silencers, generator of some type for after power is out, and much much more, i have a huge imagination, and i could use the help of someone who knows a lil bit about this stuff. I have the time and desire to do a lot of modding so any and all help is very appreciated.

 

and i couldnt get anything to work in the "Mod" folder so i've been putting everything in the base game files, not sure if thats the best way to do it or not but after i finish some more work im going to upload and ill need to consolidate the files if possible, any help here be great.       

 

sorry for the shit typing, and rambling. if you need anymore info about how i went about this just ask and ill try to respond asap. thanks for reading.

Link to comment
Share on other sites

also, where/how to i make it so the reloading is on "hardcore" all the time, the ingame setting doesnt work, wanting to have all the weapons i add have mags you'll need to find and save for intense fighting. and would it be possible to add a drag function, for bodies and objects, maybe on a long loot run drag a box full of stuff back(or wheelbarrow/shopping cart for that) but primarily i want to move objects like stoves/fridges around, block doors or position them away from weakspots(windows)

 

and im very inexperienced with lua, ive read a few tuts but nothing that makes much sense, if anyone is willing to put in a lil time and answer some possilby dumb questions i would love to be able to acually talk to someone about it, post chat program and name if you wanna do that,

Link to comment
Share on other sites

 ok i have run into a new larger problem the attached file is a exact copy of wat i've done so far.  The Colt .45 (pistol2) works perfectly, fires proper, hits proper, reloads proper. all the other weapons i tried to make dont work at all. they are spawned in with the correct icon but thats about it, when i use them it shows me as barehanded and have makes the sound, but has no attack, doesnt do anything until the zed is in pushing range and then it does the proper damage and knockback. i copied everything exactly from the working Colt .45 i made  and just changed the values and sprites etc to each gun, but nothing works.  

 

                                                                      wtf.txt

                         

any help is greatly appreciated.

 

and yes i no they are unbalanced, getting them working first, but thoughts are welcome.

Link to comment
Share on other sites

Hey stayxstoned,

 

I wrote the reloading mechanic and I will take a look (probably Monday at the earliest I'm afraid) to see if I can make it a little easier for you to do what you want.

 

As a precursor, in your item declarations make sure you avoid spaces. e.g.:

 

item 308 bullet
{
Type = Normal,
DisplayName = .308 Bullets,
Icon = 40calAmmoBox,
Weight = 0.1,
Count = 15
}
 
should be
 
item 308bullet
{
Type = Normal,
DisplayName = .308 Bullets,
Icon = 40calAmmoBox,
Weight = 0.1,
Count = 15
}
 
The DisplayName can contain spaces but the item declaration can not. If the Colt 45 was the one you added, and it works, then most likely the others just need naming correctly.
Link to comment
Share on other sites

i removed everything and just put the colt.45 files back in, now it will reload but wont shoot(wont take the bullets but files appear to be in order), exact same files i used when it was working properly..... ill just wait till you look at the reloading codes or i start understanding lua enough to do it myself, gonna keep the thread unanswered until you reply about the reloading code.

 

thanks for you're time.

Link to comment
Share on other sites

Ok,

 

First thing, I've noticed some bugs with this and I need some extra time to look into them. For example you seem to be able to put more ammo than you need to inside a magazine.

 

There were also a few things that meant you were unable to add extra weapons. So, I fixed these problems and I've made the following mod for you which you can then use to expand upon. You mentioned that you were modifying the original zomboid files in the \Steam\steamapps\common\ProjectZomboid folder.

 

First step, revert these. Whenever zomboid updates it will automatically do this so it's safer to use the mod folder. That way you won't lose any hard work. If you to need restore the steam version manually, right click on the game in steam and select properties, go to the local files tab and click verify local cache.

 

Next step, find  your zomboid mod directory, if you launch the game, click mods, you'll find the path at the bottom of the mod window. Mine is:

 

C:\Users\Stormy\Zomboid\mods\

 

Where Stormy would be your windows user name.

 

Next, extract the following zip to that directory:

 

http://download846.mediafire.com/4fl0g3m6c3wg/tttr0ci0smpr924/moreguns.zip

 

I've sorted out the mod structure for you, so you can continue building on the files inside. Once extracted, the file structure should resemble:

 

C:\Users\Stormy\Zomboid\mods\moreguns

C:\Users\Stormy\Zomboid\mods\moreguns\media

C:\Users\Stormy\Zomboid\mods\moreguns\media\lua

C:\Users\Stormy\Zomboid\mods\moreguns\media\scripts

 

The devs have been clever so that if you name the lua files the same in the mod directory, the game will replace the originals. Therefore, from now on, you can just modify these files to get the results you want. Remember, you'll have to enable the mod once upon starting the game and from then on it will use the mod until you disable it.

 

There is an important script that I noticed to do with languages which must have additional entries for each weapon you add for the mod to work. These are to do with language translations. It's not immediately obvious (I don't fully understand it) but goes something like this.

 

In the C:\Users\Stormy\Zomboid\mods\moreguns\media\lua\Mods\Translate there is a file called Items_empty.txt. You need to create entries for your weapons in there. 

 

For your Colt where the weapon name is Colt .45 I've created the entry:

 

DisplayNameColt_.45 = "",

 

Replacing the space with an underscore. Same for the magazine

 

DisplayNameColt_Magazine = "",

 

Compare this with the items.txt in 

 

C:\Users\Stormy\Zomboid\mods\moreguns\media\scripts\Mods\MoreGuns

 

Here's the shorter entry (the magazine) as an example:

 

item ColtClip
{
CanStack = FALSE,
Weight = 0.2,
Type = Normal,
DisplayName = Colt Magazine,
Icon = BerettaClip,
}
 
You'll see the name in the Items_empty.txt corresponds to the DisplayName of the item in the items.txt. I've made sure the item name (that follows the 'item' declaration above the '{' )doesn't have any spaces or unusual characters (like a period/full stop).
 
The rest is essentially what you managed to do in the ISReloadUtil.lua now found in:
 
C:\Users\Stormy\Zomboid\mods\moreguns\media\lua\Mods\Reloading
 
I added the entries for the Colt and the Colt magazine and made sure they were added to the lua tables.
 
I've left a debug line in for you as well. The code for which can be found in the stormysReload.lua script. Press L and the game will give you the original Pistol, the new Colt,  a magazine for each and some ammo. Both use the 9mm ammo type.

 

There seems to be some glitches about the magazine appearing in your inventory. I need to look at these too. Hopefully though, there is enough here for you to make a start with.

Link to comment
Share on other sites

ok ty harrakka, it wasnt sure if it could or couldn't, ill stick with ingame textures until then.

 

stormy, i greatly appreciate you helping me out with this, im just reading over the post now so ill post again later on about my progress and probably my problems lol. i've been adding a few reg items and such while i waited on you to work you're magic and ran into some lua (was trying to add a plant to the farming mod... marijuana for my joints lol) and i know next to nothing about it or any other code so im trying to fast track it, might post a few questions on here but ive seen a few decent tutorials around so hopefully not. Are other lua scripts done like Reloading, as in they weren't meant for items to be added, that you know of, because i'll probably be adding something to almost everything..... im a content junky lol.

 

Thanks again for the help Stormy and Harakka.

 

edit: 3 quick questions I forgot, 

1. I notice you have a Revolver Reload already setup but not currently used, is it fully functioning or a work-in-progress?

 

2. How do you size something to use as an icon or mod pic? I'm wanting to create some icons at least for my new items and a screen for the overall mod if i release it, but I've never messed with images much before, not sure if you do much in that department or not but can't hurt to ask.

 

3. When you say the files in the mod folder overides the base versions, do you mean they merge or it doesn't use the base at all so I'll need to include the full file with orginal content and new? (noticed some mods have separate files with only new content but they import the base, they aren't placed in the mod folder tho, just in scripts)

 

also when i extract moreguns to the mod folder i get nothing in game, just the Examplemod, which is just in the PZ folder and not even in the mods folder for me. I tried putting the moreguns folder just in the PZ folder and got the nothing in game doing that either.

Link to comment
Share on other sites

think something is wrong with my mods folder, the example mod isn't in there, its in the PZ folder. it wont pick up moreguns no matter where i put it, in PZ, or in mods. So I tried to just hijack the examplemod.... changed name and such, still displays the normal example mod in the mod options... so i delete the whole examplemod folder..... still shows and loads the mod in the game lol. no idea what it's doing. Guess I'll do it like ive had to do other mods, just put modded files in the scripts folder and import the base, those files have remained untouched after getting a clean version of the game so hopefully I wont lose anything, I back most up anyways but still.

 

edit: also my in game reload difficulty selector doesn't change anything, could I just put a lua code in to force it to go on hardcore?

Link to comment
Share on other sites

Stoned,

I have PZ installed on a separate HD than my OS. If you are not aware, there are two separate Mod folders, one where the game was installed and one under your user name.

Any mods I've placed in the mod folder under my username work great (relatively). I also mirrored the example mod with each one I installed.

So inside the folder of the mod I install, there is a mod file that lets the game activate it, a poster.png, and a media file with all the scripting in it.

Does your shit look like that?
Also, I had the same problem with reloading difficulty, but I haven't messed around with it much. The game may recognize it as a mod, there for you have to restart once activated (before creating a game) and probably can't change it on an existing game.

I could be wrong on this, but will verify when I get to my comp.

post-4103-0-85115600-1384714321_thumb.pn

Link to comment
Share on other sites

yea im putting the mod in the correct folder, its just not working at all, and i've seen the reload difficulty selector in some of the lua I looked at so im pretty sure i can do a short code to make it always go to that difficulty if i can get my mod folder working and then it should override default lua, I'll wait for stormy to reply though since he wrote the whole reload function

 

computer > local disk c > program files x86 > steam >steam apps > common > PZ > mods       only place i installed and only have my one 512gb ssd so im putting it in the correct folder unless there's another somewhere you didn't list

 

edit: ok you're correct tommy, I'm just a fucking idiot haha, I was putting it in install folder instead of the one under user's, just found it in users and put it there and all working great, thanks for pointing that out lol.... I feel smart now... back to working on items   :)

Edited by stayxstoned
Link to comment
Share on other sites

I'm not an expert on the mod directory stuff. I'm running off this:

 

http://theindiestone.com/forums/index.php/topic/2011-how-to-use-the-modloader/

 

So if the  C:\Users\Stormy\Zomboid\mods\ doesn't work and the c:\program files x86\steam\steam apps\common\PZ\ I don't know what to suggest. You can work by dropping the files into the actual directories.

 

Can you launch the game, go to the mod screen and tell me what the filepath it suggests there is?

Link to comment
Share on other sites

yea I was using the wrong mod folder, I just overlooked that the pathing was the user folder, i found it and have it working after tommy pointed it out I finally actually read the path, rookie mistake hopefully i can avoid any more obvious problems I have lol. And i have been just dropping modded files into the directory until now.

 

Stormy is the Revolver reload working or a work-in-progress, I notice there's the file but its not in the util?

I also noticed that the mags hold the capacity they are set to, but the guns hold a different number. my reload difficulty wont change so i cant get it to where i have to put the mag in the gun. gonna play around with forcing the reload dif with a lua file in my mods but my hopes aren't high lol.

Link to comment
Share on other sites

yea I was using the wrong mod folder, I just overlooked that the pathing was the user folder, i found it and have it working after tommy pointed it out I finally actually read the path, rookie mistake hopefully i can avoid any more obvious problems I have lol. And i have been just dropping modded files into the directory until now.

 

Stormy is the Revolver reload working or a work-in-progress, I notice there's the file but its not in the util?

I also noticed that the mags hold the capacity they are set to, but the guns hold a different number. my reload difficulty wont change so i cant get it to where i have to put the mag in the gun. gonna play around with forcing the reload dif with a lua file in my mods but my hopes aren't high lol.

 

tommysticks has provided me with the line that the capacity inconsistency is originating from. I'll double check when I get home from work and fix that one.

 

If I'm not too tired I'll also implement the revolver reload style which I haven't got round to doing yet.

 

The reload difficulty would be saved where other settings such as keyboard config and screen res are being saved. If they are being saved, I'll track down where that needs to be done as well. I've took a quick look at the MainOptions.lua and on line 567 there is a call to the getCore():saveOptions(). This is a call to the java which must be handling the settings. It may be difficult to get this to save out but I can take a look.

Link to comment
Share on other sites

I think I figured out what the problem is with reloading.

No matter what the maxCapacity of any weapon was, I was only able to reload 12 rounds at a time.

I just changed a line in ISSemiAutoWeapon under the games Lua from the following:

local amountToRemove = 12 - self.currentCapacity;

To the following:

local amountToRemove = self.maxCapacity - self.currentCapacity;

And as far as I can tell, it's working.

Link to comment
Share on other sites

Tommysticks that did the trick, all guns now reload the correct amount, good eyes and thanks for pointing it out, think stormy was gonna fix but now I don't have to wait  :)  another problem I have is i want to force the reload to always be set on the hardest where you have to reload the mags, and rack the weapons. I see they're on the reload lua, could I just do away with the part of code about the difficulty, or just change the " if(difficulty == 3) then "  to " if(difficulty == 1) then "  or is there something i could put there to make it where whatever the difficulty is it always does it?

Link to comment
Share on other sites

Well, I figured out how to force the difficulty, but I encountered a lot of bugs when I did that. I have it set to spawn items when a key is hit so I can test new items quickly (thanks to stormy) and I spawned all the weapons and a mag for each, the first loading of the magazine and the magazine into the gun then raking it worked properly, but I reloaded after the mag was empty to eject the mag, after I loaded the mag I tried to reload the gun and instead of inserting the full mag it just ejected another mag, and after the first loading it continued to eject mags and never let me insert the full one. I haven't looked at all the coding yet so I might find a fix myself but wanted to go ahead and post it on here. Another potential problem or it might be the current problem, not sure, is that in the inventory it doesn't separate the full mags from the empty mags, just stacks them all up. Any help with this would be greatly appreciated.

 

Stormy you done with the bolt action and revolver reloads yet, and if you find time and feel like doing it, a lever action reload would be awesome (tube fed, loading similar to a shotgun) there are also some lever actions that use small clips but the semiauto reloading works fine for them, seems like it would be a lot of unnecessary work to have a clip and tube fed lever action.

Thanks.

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