Making pawns explode on death

Started by PieCat, July 21, 2021, 12:13:51 AM

Previous topic - Next topic

PieCat

There is almost no documentation for modding this game, so by using the Modding Tutorials on the wiki and copying code from other mods, I managed to make a basic trait with stat offsets and such.

How would one make a pawn who has such trait explode on death?

Side-note, how would one make it so other pawns dislike said pawn?

RawCode

post results of your modding attempts.
post exactly what kind of "documentation for modding this game" is lacking.


both your questions are literally single minute to solve both, i just curious what kind of documentation is required for this.

PieCat

I am really bad at explaining things, but here is my attempt

There isn't anything explaining how exactly to make mods, for example, https://rimworldwiki.com/wiki/Modding_Tutorials(and other things it links to) shows how to make the setup for a mod, but nothing like, how to make a trait (Albeit that is pretty simple, but should still be explained so you don't have to read the code for other traits to figure out how to add stuff)
I tried google searching but nothing for making a pawn dislike another one, and for explosions, I found one but it was for objects, and I don't know enough of how modding this game works to know how to 1. check if a pawn has a trait or 2. if they are dead. I don't even know how to check things like that cause, nothing tells you how to even check for things on a pawn, just a gun mod(https://rimworldwiki.com/wiki/Plague_Gun_(1.1)), that, while useful for, well, a gun, isn't useful for traits.

I... didn't attempt do make anything on my own because I didn't know where to start.

You saying that they "are literally single minute to solve both" made me feel kinda dumb, so sorry if I sound a bit defensive. However if I missed something, or actually am dumb, please tell me.

RawCode

lets begin with extra simple steps, they do not require any kind of manual, tutorial, skill, or education, just reading XML files will do:

is any vanilla object (or some animals) explode on death?
what makes that specific object (or animal) explode on death?
is there are any trait, condition, health effect or anything like that, that have any effect on pawn relationships?

what fields (options) TraitDef can hold?
where is logic of "Nudist" trait?
how to make "Super Nudist" trait with double penalty?

after going over listed questions you will get definite answer about why there is no tutorials about making new traits.

most effective way to check XMLs is notepad++ you should get it if you not have it yet, without notepad++ it will take significantly more time then single minute.

PieCat

I... was actually being dumb. I am sorry for wasting your time with this topic. Also,
Quotewhat fields (options) TraitDef can hold?
this is what I meant about documentation. Cause I can't find things like this anywhere.

Quoteis there are any trait, condition, health effect or anything like that, that have any effect on pawn relationships?
I couldn't find any list of these. Albeit I only looked for traits and DID find a list(https://github.com/RimWorld-zh/RimWorld-Core), but it was from 3 years ago, and the traits that can give a relationship penalty or bonus don't seem to be there.

But yeah, I should have looked for things like that harder. I don't seem to think things through a lot.

Canute

Did you play Rimworld so far ?
Then you should know about what pawn's allready explode on death.
Search for these pawn at the Core XML first, maybe you allready can find your answers there.

RawCode

as stated above, you probably should play game before modding it, probably things you want to add already present.

PieCat

I want to make a pawn that has a custom trait explode on death. There are animals that explode on death, I know. But I can't exactly copy the explosion code of a Boomalope into a trait, because it doesn't work that way (I tried, the code gives an error and is ignored). Now since I am only mediocre at codding, and there is practically no tutorials for modding the game (only a thing for a gun and an animal) I have no idea how to check if a pawn is dead, if they have a trait, or how to have them explode once those checks are complete. Now, I am an idiot sometimes, so if there is something obvious I missed, tell me, otherwise I will keep looking to see if I can find some sort of obscure tutorial that actually helps.

Canute

What you asked for and what you want are 2 different things.
To give a race/faction the explode ability you just would copy&paste the xml parts (i think with my limited modding knowledge).
But as trait it is a different thing.
You know at Royalty the empire pawn get mosttimes the hediff that their stuff vanish on dead, maybe you should investigate there how to detect the dead. But that is far beyond my modding knowledge.
If you have a specific question, i bet RawCode will help you. But he don't give you a tutorial how to mod.

I just notice Vanilla Traits expanded, got some interesting traits like vormit blood, maybe you can get some inspiration there too.

PieCat

Like I said before, I am really bad at explaining things. I did not ask to be given a tutorial I was... ugh I give up trying to explain things with my pea sized brain, I'm just going to try and figure this out myself, and probably give myself a headache doing so. Don't know why I thought I'd be able to explain things when I can barley understand what I'm doing myself. I probably sound like an idiot.
And yea, the Vanilla Traits trait looks like it'd be able to help.

Canute

Noone was born as natural modder/codder, and most of them are self-instructed. Learning from other mods,learning by doing. But you are lucky you can use the internet. 40 years ago i only got books/journals and a school teacher with basic BASIC knowledge! :-)
10 print "Hello world!"
20 goto 10

RawCode

QuoteBut I can't exactly copy the explosion code of a Boomalope into a trait, because it doesn't work that way (I tried, the code gives an error and is ignored).

well, post your code.

it's really hard to help someone who "explain" what wrong with his code without posting that code.