Jump to content

(solved!! thanks guys!) character gains sanity on kill+bigportrait not showing


Recommended Posts

hi! i havent been here in a long while heh, but i need some help.

first issue- i found some code in this post that allowed a character to gain a sanity boost when he kills something. i put this code into my prefab file and... nothing. it doesnt crash the game, but it doesnt do anything either. could someone take a look for me? jock.lua

second issue- my characters bigportrait doesnt show! the name updates but the image does not, as shown here

i really appreciate anyone help! if there is a problem with the code, can you tell me exactly what to do with it and where to put it? i dont really know how lua works heh

thanks!

Link to comment
Share on other sites

This should work. I simplified it a little:

local function onkill(inst, data)   
	if data.afflicter == inst   
	and not data.inst:HasTag("prey")     
	and not data.inst:HasTag("veggie")     
	and not data.inst:HasTag("structure") then
		inst.components.sanity:DoDelta(5)
	end
end

This should give you 5 sanity, if the afflicter of death is this instance of the character, and the target is not prey, a veggie or a structure.

Your ListenForEvent looks fine.

It's impossible for us to know why your big portrait is not showing, if we do not have all your mod files. That said, you need to have something like this in your modmain.lua

PrefabFiles = {
	"renneko",
	"renneko_none",
}

Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/renneko.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/renneko.xml" ),

    Asset( "IMAGE", "images/selectscreen_portraits/renneko.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/renneko.xml" ),
	
    Asset( "IMAGE", "images/selectscreen_portraits/renneko_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/renneko_silho.xml" ),

    Asset( "IMAGE", "bigportraits/renneko.tex" ),
    Asset( "ATLAS", "bigportraits/renneko.xml" ),
	
	Asset( "IMAGE", "images/map_icons/renneko.tex" ),
	Asset( "ATLAS", "images/map_icons/renneko.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_renneko.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_renneko.xml" ),
	
	Asset( "IMAGE", "images/avatars/avatar_ghost_renneko.tex" ),
    Asset( "ATLAS", "images/avatars/avatar_ghost_renneko.xml" ),
	
	Asset( "IMAGE", "images/avatars/self_inspect_renneko.tex" ),
    Asset( "ATLAS", "images/avatars/self_inspect_renneko.xml" ),
	
	Asset( "IMAGE", "images/names_renneko.tex" ),
    Asset( "ATLAS", "images/names_renneko.xml" ),
	
	Asset( "IMAGE", "images/names_gold_renneko.tex" ),
    Asset( "ATLAS", "images/names_gold_renneko.xml" ),
	
    Asset( "IMAGE", "bigportraits/renneko_none.tex" ),
    Asset( "ATLAS", "bigportraits/renneko_none.xml" ),

}

 

Link to comment
Share on other sites

14 minutes ago, Ultroman said:

This should work. I simplified it a little:


local function onkill(inst, data)   
	if data.afflicter == inst   
	and not data.inst:HasTag("prey")     
	and not data.inst:HasTag("veggie")     
	and not data.inst:HasTag("structure") then
		inst.components.sanity:DoDelta(5)
	end
end

This should give you 5 sanity, if the afflicter of death is this instance of the character, and the target is not prey, a veggie or a structure.

Your ListenForEvent looks fine.

aAA thankyouthankyouthankyou!! it works perfectly!!

 

about the bigportrait: heres the mod files- i removed the sprites to avoid theft

jock.rar

 

and ohgosh im sosorry if im bothering at all

Edited by toasterbathbomb
Link to comment
Share on other sites

2 hours ago, Ultroman said:

I don't see anything wrong with your things. Check out your client log to see if it is reporting any errors with your images.

Here's my newcomer post explaining a bunch of stuff with debugging.

once again im so soso sorry if im bothering you,, this is a problem with all of the character mods ive made and i just want it fixed

heres a look at the client log, theres a lot of warnings here:

image.thumb.png.46fdfc79037db5c29668d9e6c8186641.png

im assuming this has to do with the dimensions of the image? or could it be something else?

heres the full client log if anyone is interested

client_log.txt

 

 

(edit- i did look at your newcomer post, i think i have it bookmarked)

Edited by toasterbathbomb
Link to comment
Share on other sites

Your jock.xml is wrong. It has two duplicate elements, both using the wrong name "jock_none_oval.tex", which is the name used in the jock_none.xml

I'm not sure how the big portrait XMLs are supposed to look, so if I were you I'd find a character mod with a working big portrait, and take a look at how they've done it.

Link to comment
Share on other sites

54 minutes ago, Ultroman said:

Your jock.xml is wrong. It has two duplicate elements, both using the wrong name "jock_none_oval.tex", which is the name used in the jock_none.xml

I'm not sure how the big portrait XMLs are supposed to look, so if I were you I'd find a character mod with a working big portrait, and take a look at how they've done it.

i cant seem to figure this out right now so i guess ill just leave the mod without a bigportrait until i can figure it out. thank you for your help though!!

Link to comment
Share on other sites

14 minutes ago, Ultroman said:

Try just deleting your jock.xml and jock.tex, but leave the jock.png in there. The game should generate the tex and xml properly.

image.png.170ce4cac65974a558d8b97502ddb948.png

nope, immediate crash. i think one of my problems could be im using an outdated tutorial, but i literally cant find any other tutorials so im stuck with this

 

 

Link to comment
Share on other sites

Just now, toasterbathbomb said:

image.png.170ce4cac65974a558d8b97502ddb948.png

nope, immediate crash. i think one of my problems could be im using an outdated tutorial, but i literally cant find any other tutorials so im stuck with this

 

 

Can you send your .xml real quick?

Link to comment
Share on other sites

Well, your Mod Tools should have kicked in, and generated a new xml and tex file.

Looking at other mods, they do things a bit differently than you do. Some just register one big portrait, so their XML looks like this:

<Atlas>
	<Texture filename="bubbles.tex" />
	<Elements>
		<Element name="bubbles.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

Others define two elements, one original one, and one with _none on the name, both referencing the same region of the texture, like this:

<Atlas>
	<Texture filename="walani.tex" />
	<Elements>
		<Element name="walani.tex" u1="0" u2="1" v1="0.4" v2="1" />
		<Element name="walani_none.tex" u1="0" u2="1" v1="0.4" v2="1" />
	</Elements>
</Atlas>

These guys both use the original file name when naming their elements. I'm not sure about the significance of this, as I've never done any texture work, but it seems to be a trend, whether for clarity or functionality reasons.

You have two different textures, so I'm not sure how that should work, but I know the naming is wrong in your jock.xml. Try with these files instead.

bigportraits.zip

 

5 minutes ago, Omaremad74 said:

Uh, sorry I don't have the nesscessary programs to extract a rar file, 

Get 7-zip. Free and awesome.

Link to comment
Share on other sites

14 minutes ago, Ultroman said:

Well, your Mod Tools should have kicked in, and generated a new xml and tex file.

Looking at other mods, they do things a bit differently than you do. Some just register one big portrait, so their XML looks like this:


<Atlas>
	<Texture filename="bubbles.tex" />
	<Elements>
		<Element name="bubbles.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

Others define two elements, one original one, and one with _none on the name, both referencing the same region of the texture, like this:


<Atlas>
	<Texture filename="walani.tex" />
	<Elements>
		<Element name="walani.tex" u1="0" u2="1" v1="0.4" v2="1" />
		<Element name="walani_none.tex" u1="0" u2="1" v1="0.4" v2="1" />
	</Elements>
</Atlas>

These guys both use the original file name when naming their elements. I'm not sure about the significance of this, as I've never done any texture work, but it seems to be a trend, whether for clarity or functionality reasons.

You have two different textures, so I'm not sure how that should work, but I know the naming is wrong in your jock.xml. Try with these files instead.

bigportraits.zip

 

Get 7-zip. Free and awesome.

holy ******* shirhfnjdkm it woRKED\

 

how?? what did you do???

if you didnt already explain it, im dumb ahjdkjk

Edited by toasterbathbomb
Link to comment
Share on other sites

What I said: fixed your xml files :)

Your jock.xml file looked like this:

<Atlas>
	<Texture filename="jock.tex" />
	<Elements>
		<Element name="jock_none_oval.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
		<Element name="jock_none_oval.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

Two identical elements with identical names. Not good. Now, I don't know about the naming rules here, but going by the other character mods, the element names should be the name of the tex file, so I removed "_oval" from the element names.

There can also be an element named jock_none.tex, and I have no idea what it is used for, but as I mentioned in the previous post, some character mods have it and some don't, and some even make both elements use the exact same region in the same texture.

Anyway, since you have one big portrait for the "jock.tex" element and one for the "jock_none.tex" element, now your jock.xml looks like this, declaring only one element:

<Atlas>
	<Texture filename="jock.tex" />
	<Elements>
		<Element name="jock.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

And your jock_none.xml looked like this:

<Atlas>
	<Texture filename="jock_none.tex" />
	<Elements>
		<Element name="jock_none_oval.tex" u1="0.0009765625" u2="0.9580078125" v1="0.30908203125" v2="0.99951171875" />
	</Elements>
</Atlas>

and now it looks like this:

<Atlas>
	<Texture filename="jock_none.tex" />
	<Elements>
		<Element name="jock_none.tex" u1="0.0009765625" u2="0.9580078125" v1="0.30908203125" v2="0.99951171875" />
	</Elements>
</Atlas>

 

Edited by Ultroman
Link to comment
Share on other sites

7 minutes ago, Ultroman said:

What I said: fixed your xml files :)

Your jock.xml file looked like this:


<Atlas>
	<Texture filename="jock.tex" />
	<Elements>
		<Element name="jock_none_oval.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
		<Element name="jock_none_oval.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

Two identical elements with identical names. Not good. Now, I don't know about the naming rules here, but going by the other character mods, the element names should be the name of the tex file, though there also needs to be an element named jock_none.tex, and I have no idea why. So I removed "_oval" from the element names, as well.

So, since you have one big portrait for the "jock.tex" element and one for the "jock_none.tex" element, now your jock.xml looks like this, referencing only one element:


<Atlas>
	<Texture filename="jock.tex" />
	<Elements>
		<Element name="jock.tex" u1="0.00048828125" u2="0.54638671875" v1="0.29736328125" v2="0.99951171875" />
	</Elements>
</Atlas>

And your jock_none.xml looked like this:


<Atlas>
	<Texture filename="jock_none.tex" />
	<Elements>
		<Element name="jock_none_oval.tex" u1="0.0009765625" u2="0.9580078125" v1="0.30908203125" v2="0.99951171875" />
	</Elements>
</Atlas>

and now it looks like this:


<Atlas>
	<Texture filename="jock_none.tex" />
	<Elements>
		<Element name="jock_none.tex" u1="0.0009765625" u2="0.9580078125" v1="0.30908203125" v2="0.99951171875" />
	</Elements>
</Atlas>

 

hidjkdk thankyousomuch you actually fixed the one outstanding problem ive had with all of my other mods

i seriously seriously appreciate your help and appreciate you putting up with my two working braincells

Link to comment
Share on other sites

Heheh, you're welcome :) I hope you can figure out how to fix your other mods from this information.

Don't call yourself dumb, m8. It'll only make you unconsciously make excuses for not being able to do something, instead of giving it a few tries until you can ;) You can mod. That takes a whole lot more than 2 brain cells, my friend.

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
 Share

×
  • Create New...