Moar Digging
Dig it uh oh oh, dig it
Alright Caveman, here's your task:
Find out how to increase the Palbox build area with a script. Technically you can do this with PalGameSettings but I'm not talking about that, I'm talking about changing it in memory after the box has been placed.
I'll give you some slight guidance:
- Get in a world, place down a palbox, start searching through live view for relevant classes. Remember, we want the box itself, that's going to be an object, which is an instance of a class.
- Once you think you might have an idea, right-click the search box and check
Instances only
. Make sure your search is narrowed down, and then try placing a palbox down while watching the object list. If you're on the right track, you'll see some new objects appear as they get created in game. - Once you think you've found the relevant objects, I want you to create a script that uses
NotifyOnNewObject
to print"found a base"
when a new base object is created.
If you want to try and work it out on your own, you can start digging and come back if you get stuck. I'll leave a few hints here to help you get there without completely giving it away, but again, the more you can figure out on your own, the better off you'll be for your own mods!
All On Your Own
Hint 1: I'm lost on what I should search for
This is your first taste of "not everything is named in a logical way". But we're looking for the palbox, so why not just try searching for that and seeing what comes up? You won't find exactly what you're looking for, but by looking at some of the results, you might get ideas for other things to search...
Hint 2: Give me a little more please
Alright so if you noticed
PalBoxBase
that might have given you the idea to search forBase
. If you did, great! You were on the right track. If not, give that a shot and see what pops up. The next thing is to search through theBase
results and see if there's anything relevant...
Hint 3: Just tell me already..
The particular object we want to search for is
PalBaseCampModel
Hint 4: I think I know the class, but I'm stuck on how to write the script
Alright so lets pull up the class of whatever we want to notify on in Live View so we can get the path... It should be something along the lines of
/Script/Pal.<some_class>
. That's what we're going to notify on. Since this one is a Script, we can do this without aRegisterHook
initializer. Something like:
NotifyOnNewObject("/Script/Pal.<some_class>", function()
-- do your stuff here
end)
Sanity check code
Alright, hopefully you were able to find
PalBaseCampModel
and come up with something similar to the following code:
NotifyOnNewObject("/Script/Pal.PalBaseCampModel", function()
print("found a base")
end)
Once you have a basic script that prints found a base
for both existing bases on login and anytime you place a new base, you're ready to move on! If you made it here, great job! This is the power of NotifyOnNewObject
.
Now that we can detect the placement of new bases, lets dig into the parameters of the base model and try changing them. We'll start by sanity-testing in Live View and then move to the Lua implementation afterwards.