Fidu Posted January 25, 2017 Share Posted January 25, 2017 i searched a whole day and still can't find it. So i really hope there is one kind soul out there who just tell me, what the code in webbers prefetch is that makes him walk with normal speed on spiderwebs. I wanna make an armor with that feature. this is for DTS not DS. I really appreciat your help. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/ Share on other sites More sharing options...
. . . Posted January 25, 2017 Share Posted January 25, 2017 This makes your character walk without triggering spider webs or being slowed by them inst.components.locomotor:SetTriggersCreep(false) but from my knowledge it can only be put on entities, not armor, I think.. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861127 Share on other sites More sharing options...
Cunning fox Posted January 25, 2017 Share Posted January 25, 2017 38 minutes ago, SuperDavid said: This makes your character walk without triggering spider webs or being slowed by them inst.components.locomotor:SetTriggersCreep(false) but from my knowledge it can only be put on entities, not armor, I think.. I think you need to add to your onequip function owner.components.locomotor:SetTriggersCreep(false) And on uneqquip owner.components.locomotor:SetTriggersCreep(true) 1 Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861137 Share on other sites More sharing options...
CarlZalph Posted January 25, 2017 Share Posted January 25, 2017 @Fidu AddPrefabPostInit( "armorgrass", function(inst) if GLOBAL.TheWorld.ismastersim then inst:ListenForEvent( "equipped", function(inst, data) if data and data.owner and data.owner.components and data.owner.components.locomotor then data.owner.mymodname_triggerscreep_old = data.owner.components.locomotor.triggerscreep data.owner.components.locomotor.triggerscreep = false end end ) inst:ListenForEvent( "unequipped", function(inst, data) if data and data.owner and data.owner.components and data.owner.components.locomotor then if data.owner.mymodname_triggerscreep_old ~= nil then data.owner.components.locomotor.triggerscreep = data.owner.mymodname_triggerscreep_old data.owner.mymodname_triggerscreep_old = nil else data.owner.components.locomotor.triggerscreep = not data.owner:HasTag("spiderwhisperer") end end end ) end end ) Changing "mymodname" to something unique, since it's being stored on the player as a variable rather than having a local table somewhere for each player entity. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861138 Share on other sites More sharing options...
Fidu Posted January 25, 2017 Author Share Posted January 25, 2017 Thank you all very much for your answers. And you CarlZalph... shame on you ^^ you did all the work already Thank you so very much. I will try it out this week and report back. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861236 Share on other sites More sharing options...
Fidu Posted January 26, 2017 Author Share Posted January 26, 2017 (edited) Ok guys, i am absolutely new to this as you might be able to tell already Sooo what i tried to do is this: instead of creating something completely new from the getgo i "stole" an armor from a mod-kit that goes in the direction i want it to be for my own. It has a lot of nice features already, looks good and is even named "spiderarmor". Here is the link to the kit: http://steamcommunity.com/sharedfiles/filedetails/?id=760679972&searchtext=kit Its really impressive. But what this "spiderarmor" is missing is exactly what i wanted to create on my own... you guessed it: web-walking. now... you guys know this stuff waaaay better than i do, so can you help me get the web-walking implemented in this already great work? I don't know where to put it... Here is the code from the spider-armor from the kit i mentioned: ps: i was able to tweak some things here and there... but i am still unable to seriously create and edit stuff And i tried to implement the codes @makar5000 mentioned into this... didn't work. maybe i put it in the wrong place... local assets = { Asset("ANIM", "anim/spiderarmor.zip"), Asset("ANIM", "anim/swap_spiderarmor.zip"), Asset("ATLAS", "images/inventoryimages/spiderarmor.xml"), Asset("IMAGE", "images/inventoryimages/spiderarmor.tex"), } local function spider_update(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") end end local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "swap_spiderarmor", "swap_spiderarmor") if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") if owner and owner.components.leader then if not owner:HasTag("spiderwhisperer") then --Webber has to stay owner:RemoveTag("monster") end end inst.components.fueled:StopConsuming() end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("spiderarmor") inst.AnimState:SetBuild("spiderarmor") inst.AnimState:PlayAnimation("idle") inst.foleysound = "dontstarve/movement/foley/metalarmour" inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname ="images/inventoryimages/spiderarmor.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.USAGE inst.components.fueled:InitializeFuelLevel(TUNING.WALRUSHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(inst.Remove) inst:AddComponent("insulator") inst.components.equippable.insulated = true inst.components.insulator:SetInsulation( TUNING.INSULATION_MED ) MakeHauntableLaunch(inst) return inst end STRINGS.NAMES.SPIDERARMOR = "Spider Coat" STRINGS.RECIPE_DESC.SPIDERARMOR = "Make you dry, cool, warm." STRINGS.CHARACTERS.GENERIC.DESCRIBE.SPIDERARMOR = "Spiders will like me." return Prefab( "common/inventory/spiderarmor", fn, assets) Edited January 26, 2017 by Fidu Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861396 Share on other sites More sharing options...
RedHairedHero Posted January 26, 2017 Share Posted January 26, 2017 5 hours ago, Fidu said: Ok guys, i am absolutely new to this as you might be able to tell already Sooo what i tried to do is this: instead of creating something completely new from the getgo i "stole" an armor from a mod-kit that goes in the direction i want it to be for my own. It has a lot of nice features already, looks good and is even named "spiderarmor". Here is the link to the kit: http://steamcommunity.com/sharedfiles/filedetails/?id=760679972&searchtext=kit Its really impressive. But what this "spiderarmor" is missing is exactly what i wanted to create on my own... you guessed it: web-walking. now... you guys know this stuff waaaay better than i do, so can you help me get the web-walking implemented in this already great work? I don't know where to put it... Here is the code from the spider-armor from the kit i mentioned: ps: i was able to tweak some things here and there... but i am still unable to seriously create and edit stuff And i tried to implement the codes @makar5000 mentioned into this... didn't work. maybe i put it in the wrong place... local assets = { Asset("ANIM", "anim/spiderarmor.zip"), Asset("ANIM", "anim/swap_spiderarmor.zip"), Asset("ATLAS", "images/inventoryimages/spiderarmor.xml"), Asset("IMAGE", "images/inventoryimages/spiderarmor.tex"), } local function spider_update(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") end end local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "swap_spiderarmor", "swap_spiderarmor") if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") if owner and owner.components.leader then if not owner:HasTag("spiderwhisperer") then --Webber has to stay owner:RemoveTag("monster") end end inst.components.fueled:StopConsuming() end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("spiderarmor") inst.AnimState:SetBuild("spiderarmor") inst.AnimState:PlayAnimation("idle") inst.foleysound = "dontstarve/movement/foley/metalarmour" inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname ="images/inventoryimages/spiderarmor.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) inst:AddComponent("fueled") inst.components.fueled.fueltype = FUELTYPE.USAGE inst.components.fueled:InitializeFuelLevel(TUNING.WALRUSHAT_PERISHTIME) inst.components.fueled:SetDepletedFn(inst.Remove) inst:AddComponent("insulator") inst.components.equippable.insulated = true inst.components.insulator:SetInsulation( TUNING.INSULATION_MED ) MakeHauntableLaunch(inst) return inst end STRINGS.NAMES.SPIDERARMOR = "Spider Coat" STRINGS.RECIPE_DESC.SPIDERARMOR = "Make you dry, cool, warm." STRINGS.CHARACTERS.GENERIC.DESCRIBE.SPIDERARMOR = "Spiders will like me." return Prefab( "common/inventory/spiderarmor", fn, assets) So what you'll want to to do is add owner.components.locomotor:SetTriggersCreep(false) into the function that says local function onequip. Basically this means when you equip this item you can walk on spider webs without slowing down. Then add owner.components.locomotor:SetTriggersCreep(true) You want to add this into the local function onunequip. Which will remove the web walking ability from the owner. Now the only issue you'll see with this is if Webber personally equips this armor and removes it he won't be able to web walk anymore. Normally you can add an IF statement that says 'if the owner isn't webber, remove the webwalking', but I won't know the exact coding for that off the top of my head. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861445 Share on other sites More sharing options...
Fidu Posted January 26, 2017 Author Share Posted January 26, 2017 (edited) @RedHairedHero i did exactly what you told me but it still doesn't work Am i just being stupid or did i do something wrong and can't see it? Thank you all guys for being such a great help and for all your patience with me. local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "swap_spiderarmor", "swap_spiderarmor") owner.components.locomotor:SetTriggersCreep(false) if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) -- inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") owner.components.locomotor:SetTriggersCreep(true) if owner and owner.components.leader then if not owner:HasTag("spiderwhisperer") then --Webber has to stay owner:RemoveTag("monster") end end -- inst.components.fueled:StopConsuming() end Edited January 26, 2017 by Fidu Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861451 Share on other sites More sharing options...
RedHairedHero Posted January 26, 2017 Share Posted January 26, 2017 It looks fine to me, not sure why it's not working. I would test this directly on your character to see if it works. Put inst.components.locomotor:SetTriggersCreep(false) into your character's lua file. You'll want to put it into the master postinit function and see if it works. Normally with the ability you walk at normal speed and spiders don't come out of their nest when you walk on the webbing. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861461 Share on other sites More sharing options...
Fidu Posted January 26, 2017 Author Share Posted January 26, 2017 @RedHairedHero I did what you told me and it doesn't work either. I play Caitlin. -- This initializes for both clients and the host local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon("caitlin.tex") inst:AddTag("ophelia") end -- This initializes for the host only local master_postinit = function(inst) inst.components.locomotor:SetTriggersCreep(false) inst.level = 0 inst.shadows = {} inst.soundsname = "wallace" -- Starting Stats Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861468 Share on other sites More sharing options...
RedHairedHero Posted January 26, 2017 Share Posted January 26, 2017 Hm, odd that it's not working. I'll have to do some more research when I get home tonight and get back to you on that. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861470 Share on other sites More sharing options...
Fidu Posted January 26, 2017 Author Share Posted January 26, 2017 (edited) Thank you very much. I don't have any clue whatsoever ^^ Edited January 26, 2017 by Fidu Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861472 Share on other sites More sharing options...
RedHairedHero Posted January 27, 2017 Share Posted January 27, 2017 I personally used the line of code on a piece of equipment and it does end up working. Another way you can tell it's working is spiders won't actually come out of the spider eggs when you step on the webbing while your item is equipped and when you take it off and step on the webbing they will come out. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861669 Share on other sites More sharing options...
Fidu Posted January 27, 2017 Author Share Posted January 27, 2017 (edited) @RedHairedHero They don't come out... you are right on that. BUT the walking speed is considerably slowed down. At least in my case. ps: because of this i thought there might be two different codes. inst.components.locomotor:SetTriggersCreep to make them stay in the spidereggs... And another one to prevent your reduction in movementspeed on spider webs. Edited January 27, 2017 by Fidu Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-861748 Share on other sites More sharing options...
Fidu Posted February 2, 2017 Author Share Posted February 2, 2017 Soooo i cant figure it out... is it just something wrong on my end or can i do something about it? Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-863134 Share on other sites More sharing options...
RedHairedHero Posted February 9, 2017 Share Posted February 9, 2017 Off the top of my head the other option is to go into the locomotor.lua file which is in the components folder and look through there. I can't look at the moment, but the SetTriggersCreep will derive from that file. If you want us to double check the file you can upload that as well and see if everything is setup properly. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-865161 Share on other sites More sharing options...
Fidu Posted February 25, 2017 Author Share Posted February 25, 2017 Here is the code to the spiderarmor. Spiders stay and don't attack you, but you are still slowed down when you walk on webs. local assets = { Asset("ANIM", "anim/spiderarmor.zip"), Asset("ANIM", "anim/swap_spiderarmor.zip"), Asset("ATLAS", "images/inventoryimages/spiderarmor.xml"), Asset("IMAGE", "images/inventoryimages/spiderarmor.tex"), } local function spider_update(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") end end local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "swap_spiderarmor", "swap_spiderarmor") if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") if owner and owner.components.leader then if not owner:HasTag("spiderwhisperer") then --Webber has to stay owner:RemoveTag("monster") end end inst.components.fueled:StopConsuming() end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("spiderarmor") inst.AnimState:SetBuild("spiderarmor") inst.AnimState:PlayAnimation("idle") inst.foleysound = "dontstarve/movement/foley/metalarmour" inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname ="images/inventoryimages/spiderarmor.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) --inst:AddComponent("fueled") --inst.components.fueled.fueltype = FUELTYPE.USAGE --inst.components.fueled:InitializeFuelLevel(TUNING.WALRUSHAT_PERISHTIME) --inst.components.fueled:SetDepletedFn(inst.Remove) inst:AddComponent("insulator") inst.components.equippable.insulated = true inst.components.insulator:SetInsulation( TUNING.INSULATION_MED ) MakeHauntableLaunch(inst) return inst end STRINGS.NAMES.SPIDERARMOR = "Spider Coat" STRINGS.RECIPE_DESC.SPIDERARMOR = "Make you dry, cool, warm." STRINGS.CHARACTERS.GENERIC.DESCRIBE.SPIDERARMOR = "Spiders will like me." return Prefab( "common/inventory/spiderarmor", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-873354 Share on other sites More sharing options...
RedHairedHero Posted February 25, 2017 Share Posted February 25, 2017 59 minutes ago, Fidu said: Here is the code to the spiderarmor. Spiders stay and don't attack you, but you are still slowed down when you walk on webs. local assets = { Asset("ANIM", "anim/spiderarmor.zip"), Asset("ANIM", "anim/swap_spiderarmor.zip"), Asset("ATLAS", "images/inventoryimages/spiderarmor.xml"), Asset("IMAGE", "images/inventoryimages/spiderarmor.tex"), } local function spider_update(inst) local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") end end local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_body", "swap_spiderarmor", "swap_spiderarmor") if owner and owner.components.leader then owner.components.leader:RemoveFollowersByTag("pig") owner:AddTag("monster") end inst.updatetask = inst:DoPeriodicTask(0.5, spider_update, 1) inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:ClearOverrideSymbol("swap_body") if owner and owner.components.leader then if not owner:HasTag("spiderwhisperer") then --Webber has to stay owner:RemoveTag("monster") end end inst.components.fueled:StopConsuming() end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("spiderarmor") inst.AnimState:SetBuild("spiderarmor") inst.AnimState:PlayAnimation("idle") inst.foleysound = "dontstarve/movement/foley/metalarmour" inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname ="images/inventoryimages/spiderarmor.xml" inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.BODY inst.components.equippable:SetOnEquip(onequip) inst.components.equippable:SetOnUnequip(onunequip) inst:AddTag("waterproofer") inst:AddComponent("waterproofer") inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_HUGE) --inst:AddComponent("fueled") --inst.components.fueled.fueltype = FUELTYPE.USAGE --inst.components.fueled:InitializeFuelLevel(TUNING.WALRUSHAT_PERISHTIME) --inst.components.fueled:SetDepletedFn(inst.Remove) inst:AddComponent("insulator") inst.components.equippable.insulated = true inst.components.insulator:SetInsulation( TUNING.INSULATION_MED ) MakeHauntableLaunch(inst) return inst end STRINGS.NAMES.SPIDERARMOR = "Spider Coat" STRINGS.RECIPE_DESC.SPIDERARMOR = "Make you dry, cool, warm." STRINGS.CHARACTERS.GENERIC.DESCRIBE.SPIDERARMOR = "Spiders will like me." return Prefab( "common/inventory/spiderarmor", fn, assets) The reason our suggestions weren't working earlier is because we were saying inst.components.locomotor:SetTriggersCreep(false) when you should actually be using owner.components.locomotor:SetTriggersCreep(false) Just put this up where you put the onequip monster tag and for the unequip change it to true. I tested this and it does work. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-873400 Share on other sites More sharing options...
Fidu Posted February 27, 2017 Author Share Posted February 27, 2017 @RedHairedHero finally you nailed it !!! I love you. It works fine now exactly as i wanted. Link to comment https://forums.kleientertainment.com/forums/topic/73605-armor-with-web-walking/#findComment-874632 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