Mario384 Posted February 20, 2015 Share Posted February 20, 2015 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 More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 ACTIONS = GLOBAL.ACTIONSActionHandler = GLOBAL.ActionHandlerAddStategraphActionHandler("spider", ActionHandler(ACTIONS.ATTACK, "attack"))in modmain.lua andinst:SetStateGraph("SGspider")in the master_postinit of the character you make a spider. Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615024 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 (edited) ACTIONS = GLOBAL.ACTIONSActionHandler = GLOBAL.ActionHandlerAddStategraphActionHandler("spider", ActionHandler(ACTIONS.ATTACK, "attack"))in modmain.lua andinst: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 February 21, 2015 by Mario384 Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615028 Share on other sites More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 (edited) 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 February 21, 2015 by DarkXero Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615039 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 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? Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615049 Share on other sites More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 Upon adding these changes, I get a crash for calling on AddStategraphEventHandler (which is a nil value) Any idea there? Because it's AddStategraphEvent, my bad. Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615050 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 Well, the crash with the nests are gone, but the damage bug is still in place. Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615052 Share on other sites More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 inst.components.combat:SetDefaultDamage(20)In the master postinit? Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615053 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 (edited) 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 February 21, 2015 by Mario384 Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615055 Share on other sites More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 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. Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615081 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 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. Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615207 Share on other sites More sharing options...
DarkXero Posted February 21, 2015 Share Posted February 21, 2015 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? Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615211 Share on other sites More sharing options...
Mario384 Posted February 21, 2015 Author Share Posted February 21, 2015 (edited) 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 February 22, 2015 by Mario384 Link to comment https://forums.kleientertainment.com/forums/topic/51224-playable-spider/#findComment-615228 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now