Jump to content

Recommended Posts

So, though originally I tried making this of DST, I got it to work on DST.  Basically, you spawn as a regular spider, and you can move and stand idle with good animations, but I had a few issues.

 

 

- You cannot attack anything.  The spider will walk up to the target, but he will immediately go into his idle animation without attacking.

 

-There's a crash with spiderdens that states something about all found map areas.

 

So, if anyone knows how I could fix these two things, i would appreciate it.

Link to comment
https://forums.kleientertainment.com/forums/topic/51224-playable-spider/
Share on other sites

ACTIONS = GLOBAL.ACTIONSActionHandler = GLOBAL.ActionHandlerAddStategraphActionHandler("spider", ActionHandler(ACTIONS.ATTACK, "attack"))

in modmain.lua and

inst:SetStateGraph("SGspider")

in the master_postinit of the character you make a spider.

 

 

Thanks!  I already knew about setting the stategraph (without it, the spider wouldn't even appear!)

 but I did not know about the ActionHandler.  Thank you, kind sir!  Because of you, I now have a fully functional playable spider mod for DST!  Once I add in some dummy art, I can release it!

However, the bug still exists where spider dens attempt to index field knownloactions (a nil value)

Then, there's things about changing the ground speed multiplier.  Any idea on how to fix this?

Also, the spider DOES attack, but does no damage as well.

Edited by Mario384

Try putting in your character:

inst:AddComponent("knownlocations")

So the den doesn't crash when trying to make you investigate. You won't give a damn when given the location, however.

 

And:

EventHandler = GLOBAL.EventHandlerAddStategraphEventHandler("spider", EventHandler("attack", function(inst)    inst.sg:GoToState("attack", inst.components.combat.target) end))

In modmain.lua

 

The movement things are under the locomotor of the spider prefab.

Edited by DarkXero

Try putting in your character:

inst:AddComponent("knownlocations")

So the den doesn't crash when trying to make you investigate. You won't give a damn when given the location, however.

 

And:

EventHandler = GLOBAL.EventHandlerAddStategraphEventHandler("spider", EventHandler("attack", function(inst)    inst.sg:GoToState("attack", inst.components.combat.target) end))

In modmain.lua

 

The movement things are under the locomotor of the spider prefab.

 

Upon adding these changes, I get a crash for calling on AddStategraphEventHandler (which is a nil value)  Any idea there?

 

inst.components.combat:SetDefaultDamage(20)

In the master postinit?

 

 

I had the Spider Tuning there before, still doesnt work.

 

EDIT: Check out SGspider, it seems how spiders actually get their target is different than the Deerclops and other mobs.

Edited by Mario384

I had the Spider Tuning there before, still doesnt work.

 

EDIT: Check out SGspider, it seems how spiders actually get their target is different than the Deerclops and other mobs.

 

I'm not sure how doattack comes into play. I don't think it comes from an attack action.

 

Perhaps what needs to be done is having:

a)

ActionHandler(ACTIONS.ATTACK, "attack")         

b)

    State{        name = "attack",        tags = {"attack", "busy"},                onenter = function(inst, target)            local buffaction = inst:GetBufferedAction()            local target = buffaction ~= nil and buffaction.target or nil            inst.components.combat:SetTarget(target)            inst.components.combat:StartAttack()            inst.components.locomotor:Stop()			inst.Physics:Stop()            inst.AnimState:PlayAnimation("atk")            if target ~= nil then                if target:IsValid() then                    inst:FacePoint(target:GetPosition())                    inst.sg.statemem.attacktarget = target                end            end        end,		        onexit = function(inst)            inst.components.combat:SetTarget(nil)        end,                timeline =        {            TimeEvent(10*FRAMES, function(inst) inst.SoundEmitter:PlaySound(SoundPath(inst, "Attack")) end),            TimeEvent(10*FRAMES, function(inst) inst.SoundEmitter:PlaySound(SoundPath(inst, "attack_grunt")) end),            TimeEvent(25*FRAMES, function(inst) inst:PerformBufferedAction() end),        },                events =        {            EventHandler("animover", function(inst) inst.sg:GoToState("idle") end),        },    },

And replacing the "attack" state of spider with something similar to the wilson one.

 

Instead of adding things left and right you can copy the spider stategraph and make all the changes you want.

I'm not sure how doattack comes into play. I don't think it comes from an attack action.

 

Perhaps what needs to be done is having:

a)

ActionHandler(ACTIONS.ATTACK, "attack")         

b)

    State{        name = "attack",        tags = {"attack", "busy"},                onenter = function(inst, target)            local buffaction = inst:GetBufferedAction()            local target = buffaction ~= nil and buffaction.target or nil            inst.components.combat:SetTarget(target)            inst.components.combat:StartAttack()            inst.components.locomotor:Stop()			inst.Physics:Stop()            inst.AnimState:PlayAnimation("atk")            if target ~= nil then                if target:IsValid() then                    inst:FacePoint(target:GetPosition())                    inst.sg.statemem.attacktarget = target                end            end        end,		        onexit = function(inst)            inst.components.combat:SetTarget(nil)        end,                timeline =        {            TimeEvent(10*FRAMES, function(inst) inst.SoundEmitter:PlaySound(SoundPath(inst, "Attack")) end),            TimeEvent(10*FRAMES, function(inst) inst.SoundEmitter:PlaySound(SoundPath(inst, "attack_grunt")) end),            TimeEvent(25*FRAMES, function(inst) inst:PerformBufferedAction() end),        },                events =        {            EventHandler("animover", function(inst) inst.sg:GoToState("idle") end),        },    },

And replacing the "attack" state of spider with something similar to the wilson one.

 

Instead of adding things left and right you can copy the spider stategraph and make all the changes you want.

 

I created a custom stategraph, added this stuff, and it worked!  Now, last issue really is when trying to run this with the deepclops mod, it crashes.  No logs appear, it just stops working.

 

On hindsight, I think the spider would also have been fixed by using:

ActionHandler(ACTIONS.ATTACK, "doattack")

instead of fusing the wilson and the spider.

 

Now I'm not sure I get your "I ran this". You mean that code I put for the spider? It makes sense it doesn't run for the clops. Why not just use what I put on the other thread?

 

On hindsight, I think the spider would also have been fixed by using:

ActionHandler(ACTIONS.ATTACK, "doattack")

instead of fusing the wilson and the spider.

 

Now I'm not sure I get your "I ran this". You mean that code I put for the spider? It makes sense it doesn't run for the clops. Why not just use what I put on the other thread?

 

I meant to say when I try to use both mods together (say on a server you wanted for players to be a deerclops and someone else be a spider) they don't work.  It simply crashes when you enable them together.

 

EDIT:  Also, for some reason, the doattack thing does not work.  Upon trying to make a Warg, I found out it only works if you mod in a custom stategraph with attack implemented into it.  I believe the Deerclops only works with his attack is because when he attacks, anything within a radius gets hurt and frozen.  Or, it could be sheer coincidence.

Edited by Mario384

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