How to change default turret target?

Started by Legault, August 02, 2021, 06:35:20 AM

Previous topic - Next topic

Legault

Hello,
I would like to make a turret that targets specific thing. Standard turret attack only enemies (aggresive pawns, animals).
Is it possible to make new turret that attack only, for example, animals? (imagine long corridor with this turret that will kill any wild animal that tries to get close to colony)
I know how to make new turret from XML, but then its AI would act same as normal turret.

I guess it is possible (everything is, really :P), so I would like to get some pointers about how it could be done. :)

Thank you.

RawCode

XML is data
C# is logic

your guess is
"if wild animal in range attack wild animal"
logic or data?

Legault

Hey, thanks for answering.

I guess I should be more clear. Yes, I know it will be C#. I can program in C# (although I mainly use it for WinForms and WPF applications) but I never modded a game. Especially Unity Engine game.

I just need some pointers where should I look, if I need to somehow decompile something, where I can find turret logic data so I can see how it works and then copy and modify it.

After looking for XML tutorial for making my own "thing" in game I saw how many of them are really outdated and turned here for help for little c# help. :P Or is there actual c# modding tutorial that is not outdated and will help me with problem here?

RawCode

you should start with extra simple step, open
google.com
type
how to decompile c#
you mad add other keywords, like "rimworld" or "unity"

read everything from first and second pages
focus on third line of output
after that, ask specific questions about what exactly you do not understand

Legault

Well.. eh, ok. Thank you for helping (?) me.

I will go and try to accomplish this by myself after reading through google pages, as you hinted. I guess I should have started there and shuffle through bunch of irrevelant things to maybe find this one thing I want, instead of asking for little help on official forums in help section on mods category. Silly me.

RawCode

i hope this video will help you better, it's absolutely best i can do for you

https://youtu.be/iakzVTUjjoY

Canute

What RawCode wanted to say is,
the turret targeting is locatated at the vanilla code and not at some XML.
That why you should decompile the vanilla code and search for that code and find out how the turret's aquire the target.
Once you find it out you could create a patch to change that, like adding button to change targets. Or copy that code with the new target for your own new turrets.

Or did you await that some other modder do your job and search for your the code, modify it and post it that you can use it for your turrets ? :-)



Legault

Wait, what? What is wrong with this forum? Where did I even aluded about someone doing any coding for me?

Really, simple "Oh, you just need TOOL_A, use it to decrypt FILE_B, that will leave you with bunch of things. I didn't looked into it myself but what you looking for is probably in FOLDER_C" would be everything I asked for.
Since my first post I just wanted some pointers, not job done for me. You must understand that for someone with 0 modding knowledge google search gives really little actual answers, especially when most of the them are outdated and for like A8. There is bunch of tutorials from 2016-2018 that do not work properly anymore (and I know it, because I tried to learn from them). Someone with 0 knowledge will not even realize that they are reading answer to their problem, because they do not understand what their problem even is.

So thanks for answers but I'm dropping learning about rimworld modding. I don't really want to be associated with this kind of unfriendly community. "Just use google" for newbie is non-answer and reminds me of elitist groups guarding their sacred knowledge in late 90... and then I was just asking about any precautions I should take before changing power outlets. :)

Best of luck for everyone else though! I love playing with mods and can't wait what mods Ideology will bring in future. :D

Canute

#8
If you would have followed RawCode
Quotegoogle.com
type
how to decompile c#
https://rimworldwiki.com/wiki/Modding_Tutorials/Decompiling_source_code

that would say you need to decompile Assembly-CSharp.dll

RawCode

it feels like you can't read properly, i will repeat my post, please read it carefully, one word at time if required.
probably you will notice, that it _does not__ contains "just use google" and you probably read it very very wrong on your first attempt.

Quote
you should start with extra simple step, open
google.com
type
how to decompile c#
you mad add other keywords, like "rimworld" or "unity"

read everything from first and second pages
focus on third line of output
after that, ask specific questions about what exactly you do not understand

since it was probably too long, or too hard, or my English probably too bad, i made video for you
https://youtu.be/iakzVTUjjoY

if you hit link above, it will open in your web browser.