Jump to content

Recommended Posts

Hey forum people.

I'm sure you've heard this a thousand times, but I've been having troubles making a modIt's meant to make it so that Spiders don't attack Abigail, and vice-versa, though both me and a friend can't figure out how to do this, and we've been trying for quite a while to no avail.

Is there any way more talented/skilled people can help us out with this? 

Thank you.

AddPrefabPostInit("spider", function(inst)
if not GLOBAL.TheWorld.ismastersim then return end
local OldCanTarget = inst.replica.combat.CanTarget
function inst.replica.combat:CanTarget(target, ...)
return OldCanTarget(self, target, ...) and not ( target:HasTag("abigail") )
end
end)

Put this code in your modmain.lua & I think it should make it that Spiders can never attack Abigail. If you want the same for Abigail to never attack spiders you would do this in your modmain.lua also.

AddPrefabPostInit("abigail", function(inst)
if not GLOBAL.TheWorld.ismastersim then return end
local OldCanTarget = inst.replica.combat.CanTarget
function inst.replica.combat:CanTarget(target, ...)
return OldCanTarget(self, target, ...) and not ( target:HasTag("spider") and target:HasTag("smallcreature") )--Needs both tags so Abigail fights SpiderQueens
end
end)

 

1 hour ago, SuperDavid said:

AddPrefabPostInit("spider", function(inst)
if not GLOBAL.TheWorld.ismastersim then return end
local OldCanTarget = inst.replica.combat.CanTarget
function inst.replica.combat:CanTarget(target, ...)
return OldCanTarget(self, target, ...) and not ( target:HasTag("abigail") )
end
end)

Put this code in your modmain.lua & I think it should make it that Spiders can never attack Abigail. If you want the same for Abigail to never attack spiders you would do this in your modmain.lua also.


AddPrefabPostInit("abigail", function(inst)
if not GLOBAL.TheWorld.ismastersim then return end
local OldCanTarget = inst.replica.combat.CanTarget
function inst.replica.combat:CanTarget(target, ...)
return OldCanTarget(self, target, ...) and not ( target:HasTag("spider") and target:HasTag("smallcreature") )--Needs both tags so Abigail fights SpiderQueens
end
end)

 

looks okay, but I'm not sure if it is enough to mod the "replica" like you did... maybe you also have to mod the normal component.
I would say try it out on a world without and a world with caves ;) 

Edited by Serpens

great :)
whoever wants to upload this, please also upload a version, where spiders do not attack chester, if webber is the eyebone carrier (instead of checking for "weberr" better check for "monster" or simular, so it will be compatible to mod characters with same skill ;)
At best also compatible to "Personal Chester" mod :)

Actually spiders won't attack other spiders with this mod even if Webber is the master. It's some kind of issue. Someone can improve the script by making two groups of creatures where creatures from one group are peaceful to creatures from other group but they aren't peaceful to each other if in the same group.

Edited by Maris
On 10/25/2016 at 6:25 PM, Maris said:

I like the idea. :)

So I made the mod and tested it. You can publish it.

http://pastebin.com/DDYW7gey

Oh man, thank you so much! I'll be sure to give you full credit for this awesome mod. Now Webber and Wendy can finally be played in the same world! :D

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...