hello and welcome this video is about modding - Liam asked me how to find out
variable names which you then mod in DNSPY for example for modding RAVENFIELD
or other Unity-based games but this video might also be useful for other
engines, as long as you can extract the code and modify it
ok the steps are gonna take is: we're gonna extract the code as text files
we're gonna search through the code - all files at the same time - and then we're
gonna look at the code in a text editor that is nice
nicer than notepad - I'm using the following free tools - DNSPY will
allow us to extract the code and modify it but it's specific to Unity or other
C# DLLs - grepwin will allow us to search through many files at the same time
notepad++ is just good for reading the code to understand what it does
ok we're gonna use an older version of RAVENFIELD - one of the free ones
Beta 4 I believe - we're just gonna go and grab the assembly-csharp.dll
drag it into DNSPY and what we could do now is we could search for variable
names function names classes that match what we're looking for but we're not
gonna do that instead we're gonna extract all the source code and search
through it - so you've got to select the root node this "-" thing and then go to
file and then export the project and then you pick a location for this
project and just extract it all and this location you will use later for
searching through the whole folder using grepwin
ok the next step is to open this folder where you extracted it, then copy the
path and paste it into grepwin into the search in a location at this point in
the video should have enabled content search - this thing you should turn on but
I'm gonna show it to you later again you should use content search not
file search - so at this point you would go for words that make sense to you that
you want to modify health life damage things that come to your mind - hold up
wait a minute things that come to your mind is not the essence of what you
should learn because this is the most important creative part of this video of
what I have to tell you - you have to think of words that are used by the
developer of the game to modify stats which you want to mod so if the game
uses words like Health, search for health if it uses life, search for
life but on the other hand it might also be the other way around the developer
might have been thinking in terms that are not as popular with players so keep
your mind open, search for different words, don't give up - if the game has an
active modding community you could also get on their community - steam forums -
discord and ask around - let us now continue with the search - for example the
word life has a lot of matches you can double click the found files to jump to
the correct line even and then you have to try to make sense of a code - in this
case "life" mostly refers to life time which has something to do with effects
and I think animations - things that take time it is unrelated to health so let's
scrap that - instead for example we can search for health - so one interesting
thing we find is Actor.cs contains the line this.health = 100f; - f is
for floating number - we can change this but not in notepad++, instead we have
to go in this case to DNSPY, go to the actor class and there we can change this
number so as per usual we right click, Edit method and here we can just change
this by adding one zero for example press compile and this is all of it and
then we go to file save module and just press ok - ingame we can see that we
indeed have 1000 health and if we try to attack one of our teammates they have a
lot of health they're still alive still alive still alive
anyways the next goal will be to figure out the function that takes away health
so first I want to undo this by going to edit method removing the zero pressing
compile and then saving this but I get an error the solution is to delete all
the stuff loaded into DN spy just select control a in the side bar and press
Delete then I had to import the dll file again and then I could remove a zero
press compile and you know file save module so we do know that health is the
variable name for health that's good now we will search for something that
modifies health so we're going to search for health equal sign for example and
this is nice we have 5 matches and only two files and in a mistake here though
searching for health space equal sign could be a problem
health no space equal sign my smarter but also health plus health -
these things are also important if for example I would have used health space -
I would have found this damage function in the vehicle dot CS file from this I
could have deducted that damage is a keyword I should be looking for so then
I searched for damage and I enable content search which allows me to see
the line in which it is found very very freaking useful and here we see a good
match this health - equals health damage very good let's check this out and here
we can see versus a damage function in the actor so it applies to you know
player character and AI characters now we just need to figure out how to make
this only apply to enemies but not to a player for example first let's just
quickly test whether it works if we multiply this with zero that actually
nobody is taking damage anymore yet works nobody's taking damage especially
not me health stays at 100 so now the task is to find out how to differentiate
whether it's a player or AI so we're just searching for player and we can see
if this actor equals null okay it as an extensible sector dead no sector team no
FPS player control player team player team doesn't seem to be related okay
next line actor instance players we call sector what does that even mean okay
next no public actor player no else okay and so on and so on
okay let's are something else let's search for is player for example alright
if this user is player if this user is player so apparently this is somehow
related to only weapons not sure if that is interesting we're gonna try it out
nonetheless so here we have this user is player we're gonna copy that we're gonna
use this as a check later and here we have the shoot function which we're just
gonna modify we're gonna add if and then the part this user is player and open
less curly bracket at the beginning and at the end we're just gonna add a
scrolling bracket closed ok stop your video stop playback write a comment what
does this code change what do you think write it in the comments later we can
compare it'll be fun do it alright so as you can see nobody's shooting me they
are certainly making the sounds because somehow that is unaffected by the
function but they cannot shoot bullets anymore and that
just fantastic and it is only AI that is affected by that so only AI cannot shoot
which also means my team cannot shoot but hey hey okay so now we know how to
filter whether an actor is a player or a bot or AI and we know where to change
the code so that damage is not being taken in the damage function of a vector
class and here we just add if this you know I've controlled and squirrely
bracket and at the end we add X curly bracket this is the wrong position
though it's not behind return true but instead it has to be before return true
let's just fix that right compile etc etc so I reverted very early our changes
and now it's back to normal except for the latest change and we can survive
helicopter crashes that's cool teammates can die enemies can die and this could
just kill the teammate but I cannot die anymore I cannot even fall because
that's all part of damage like tumbling over that's also part of a damage
function so we fixed all that so that was one example of how to find variable
names to mod watch my other dance by a tutorial if you're new to the Nspire
I show you how to use it there or watch my fruit the model modding video for
unity games which allows you to change any 3d model in any unity game which is
also awesome if you have any more questions leave a comment I'll see you
next time ciao
Không có nhận xét nào:
Đăng nhận xét