Jump to content

Recommended Posts

I'm trying to make anenemies immune to bearger's slams.
I saw the thumper file from OG DS uses "inst:AddTag("groundpoundimmune")", and i've tried doing:

Quote

AddPrefabPostInit("trap_starfish", function(inst)    
    inst:AddTag("groundpoundimmune")
end)

in my mod's modmain, but that doesn't seem to work, although there are no crashes. I haven't seen that tag anywhere in the DST's prefabs though.

I don't even know if the tag works, as thumpers from the DST port (and bearger) can still destroy eachother. Taking the tag out from the modded prefab won't even make the structure destroy itself so it seems redundant...

Any help is appreciated.

Edited by Juanasdf

After checking the groundpounder component it seems "groundpoundimmune" is no longer a tag available in DST, therefore I have no idea how to add it then.

image.png.cb7008084334f957a6c50829df01a817.png

image.png.a8004643eb74411d19e820e757923206.png

It seems only the thumper, hippopotamooses and pugalisks used that tag, therefore there is no need to have it in DST

As the noTags table is easily accessible you can simply just do:

  1. AddComponentPostinit for the GroundPounder component if you want to make it apply to all entities with this component
  2. AddPrefabPostinit to modify the component on the specific prefab e.g. bearger

Then table.insert your unique tag to the list as its a simple ordered list type of table.

Afterwards you can add your uniquely named tag to whatever you want to be immune to the effects.

Edited by IronHunter

(It doesn't even need to be a tag, it's just that i found out DS originally had a tag for it. I just need a way to make anenemies not be uprooted by bearger's slam but able to be dug up. If I remove the workable component then I wouldn't be able to relocate them.)

7 hours ago, Juanasdf said:

Either way if the tag is absent from DST wouldn't I need to create a function for it?
If so I have 0 idea how the "groundpoundimmune" tag works, and I couldn't find where it is defined to try and copy it...

Tags are just fancy netbools, you can easily create your own tags and don't need to use just vanilla ones. I already said you can add your custom tag to your desired prefab in this case the anenemies. You can then add that tag to the table for the bearger's groundpounder component.

A AddPrefabPostinit for the bearger and one for the anememies is all you need to do.
 

11 hours ago, Juanasdf said:

Yeah, but knowing how the vanilla one functioned would have been easier, as it was already made. But I guess I'll have to lookup how to create a custom tag then.

All you got to do is AddTag("tagname")

All a tag is a networked string, it does nothing on its own and is simply referenced by other code if it exists or not.

I think I understand how you create a tag, and I think i got it working with the original code i posted:

On 7/21/2022 at 1:07 AM, Juanasdf said:

AddPrefabPostInit("trap_starfish", function(inst)    
    inst:AddTag("groundpoundimmune")
end)

But as you said, the tag itself doesn't do anything on its own, unless I specify it, and that's what I meant when I said have no idea how to do that. I'm trying to look up for mods that do something similar to what I'm looking for to understand how everything works a bit better.
The other mods I made were simpler because they didn't mess up with components and tags but rather just easily changeable values.:wilson_resigned:

37 minutes ago, Juanasdf said:

I think I understand how you create a tag, and I think i got it working with the original code i posted:

But as you said, the tag itself doesn't do anything on its own, unless I specify it, and that's what I meant when I said have no idea how to do that. I'm trying to look up for mods that do something similar to what I'm looking for to understand how everything works a bit better.
The other mods I made were simpler because they didn't mess up with components and tags but rather just easily changeable values.:wilson_resigned:

In that case the easiest way is to probably just do something like this:
 

AddPrefabPostInit("bearger", function(inst)
    if GLOBAL.TheWorld.ismastersim and inst.components.groundpounder then
      if not table.contains(inst.components.groundpounder.noTags, "groundpoundimmune") then --attempt to avoid duplicates if the tag already exists in the table
        table.insert(inst.components.groundpounder.noTags, "groundpoundimmune")
      end
    end
  end)

 

Edited by IronHunter
  • Like 3

Ok, that works... but HOW? Don't answer tho, I already wasted a lot of your time lmao
But I clearly don't understand how all of this works, I gotta take a closer look at how components and tags work at some point
You're a life saver <3

Edited by Juanasdf
  • Like 1

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
×
  • Create New...