StalkinU Posted December 13, 2014 Share Posted December 13, 2014 Hey folks, I am trying to build a female version of webber. Lyph,She who would be Queen. pic extension not accepted... Problem 2. I need Lyph to not get agro'd by spiders, that part works..But I need spider queen to still go agro on Lyph, this is an important part of manifesting Lyph's personality.How would I extend this part of her code,so that her spiderwhisperer tag ignores the spider queen -- todo: Add an example special power here. inst:AddTag("spiderwhisperer") inst:AddTag("monster") inst.components.locomotor.triggerscreep = falseProblem 3. ---SOLVED--- Can't seem to feed spiders meat.Need to find the code that triggers this possibility. What I did was,I included "spider" in the mainmod.lua prefabs. Spider.lua is loaded from script\prefab folder regardlessThen I copy pasted spider.lua to the scripts folder.I then proceeded to adding this piece of code.local function ShouldAcceptItem(inst, item, giver) if giver.prefab ~= "webber" then return false end if inst.components.sleeper:IsAsleep() then return false end if inst.components.eater:CanEat(item) then return true endendlocal function ShouldAcceptItem(inst, item, giver) if giver.prefab ~= "lyph" then return false end if inst.components.sleeper:IsAsleep() then return false end if inst.components.eater:CanEat(item) then return true endend Problem 1. ---SOLVED---I copy pasted some code from webber's script\prefab file.However the entire local function custom_init(inst) doesn't work.How can I make this work? Here's the scripts\prefabs\lyph.lualocal MakePlayerCharacter = require "prefabs/player_common"local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), -- Don't forget to include your character's custom assets! Asset( "ANIM", "anim/lyph.zip" ),}local prefabs = {}local start_inv = { "spidereggsack", "monstermeat", "monstermeat",}local function custom_init(inst) inst:AddTag("spiderwhisperer") inst:AddTag("monster") inst.components.locomotor.triggerscreep = false inst.components.eater.monsterimmune = true inst.components.health:SetMaxHealth(TUNING.WEBBER_HEALTH) inst.components.hunger:SetMax(TUNING.WEBBER_HUNGER) inst.components.sanity:SetMax(TUNING.WEBBER_SANITY) local nest_recipe = Recipe("spidereggsack", {Ingredient("silk", 12), Ingredient("spidergland", 6), Ingredient("papyrus", 6)}, RECIPETABS.TOWN, TECH.NONE) nest_recipe.sortkey = 1 STRINGS.RECIPE_DESC.SPIDEREGGSACK = "Get a little help from your friends."endlocal fn = function(inst) -- choose which sounds this character will play inst.soundsname = "wolfgang" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "wilson.png" ) -- todo: Add an example special power here.endreturn MakePlayerCharacter("lyph", prefabs, assets, fn, start_inv, custom_init) Here's the new code.local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset( "ANIM", "anim/player_basic.zip" ), Asset( "ANIM", "anim/player_idles_shiver.zip" ), Asset( "ANIM", "anim/player_actions.zip" ), Asset( "ANIM", "anim/player_actions_axe.zip" ), Asset( "ANIM", "anim/player_actions_pickaxe.zip" ), Asset( "ANIM", "anim/player_actions_shovel.zip" ), Asset( "ANIM", "anim/player_actions_blowdart.zip" ), Asset( "ANIM", "anim/player_actions_eat.zip" ), Asset( "ANIM", "anim/player_actions_item.zip" ), Asset( "ANIM", "anim/player_actions_uniqueitem.zip" ), Asset( "ANIM", "anim/player_actions_bugnet.zip" ), Asset( "ANIM", "anim/player_actions_fishing.zip" ), Asset( "ANIM", "anim/player_actions_boomerang.zip" ), Asset( "ANIM", "anim/player_bush_hat.zip" ), Asset( "ANIM", "anim/player_attacks.zip" ), Asset( "ANIM", "anim/player_idles.zip" ), Asset( "ANIM", "anim/player_rebirth.zip" ), Asset( "ANIM", "anim/player_jump.zip" ), Asset( "ANIM", "anim/player_amulet_resurrect.zip" ), Asset( "ANIM", "anim/player_teleport.zip" ), Asset( "ANIM", "anim/wilson_fx.zip" ), Asset( "ANIM", "anim/player_one_man_band.zip" ), Asset( "ANIM", "anim/shadow_hands.zip" ), Asset( "SOUND", "sound/sfx.fsb" ), Asset( "SOUND", "sound/wilson.fsb" ), Asset( "ANIM", "anim/beard.zip" ), -- Don't forget to include your character's custom assets! Asset( "ANIM", "anim/lyph.zip" ),}local prefabs = {} local start_inv ={ "spidereggsack", "monstermeat", "monstermeat",} local fn = function(inst) -- choose which sounds this character will play inst.soundsname = "webber" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "webber.png" ) -- todo: Add an example special power here. inst:AddTag("spiderwhisperer") inst:AddTag("monster") inst.components.locomotor.triggerscreep = false inst.components.eater.monsterimmune = true inst.components.health:SetMaxHealth(TUNING.WEBBER_HEALTH) inst.components.hunger:SetMax(TUNING.WEBBER_HUNGER) inst.components.sanity:SetMax(TUNING.WEBBER_SANITY) local nest_recipe = Recipe("spidereggsack", {Ingredient("silk", 12), Ingredient("spidergland", 6), Ingredient("papyrus", 6)}, RECIPETABS.TOWN, TECH.NONE) nest_recipe.sortkey = 1 STRINGS.RECIPE_DESC.SPIDEREGGSACK = "Get a little help from your subjects."end return MakePlayerCharacter("lyph", prefabs, assets, fn, start_inv) Link to comment Share on other sites More sharing options...
Mobbstar Posted December 13, 2014 Share Posted December 13, 2014 is custom_init even a parameter?! Looking at the functions content, it should work from fn just as well. Link to comment Share on other sites More sharing options...
StalkinU Posted December 13, 2014 Author Share Posted December 13, 2014 copy pasted it directly from webbers script inside the dlc folder Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 13, 2014 Share Posted December 13, 2014 what part of it isnt working if i may ask? u didnt say exactly what you are trying to fix. could you try to run the mod, and then post the log file? Link to comment Share on other sites More sharing options...
StalkinU Posted December 13, 2014 Author Share Posted December 13, 2014 Problem 1. Webbers code under local function custom_init(inst)did'nt work.Moved the code too local fn = function(inst). Problem fixed. On to problem 2 Link to comment Share on other sites More sharing options...
StalkinU Posted December 13, 2014 Author Share Posted December 13, 2014 what part of it isnt working if i may ask? u didnt say exactly what you are trying to fix. could you try to run the mod, and then post the log file? Topic updated Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 13, 2014 Share Posted December 13, 2014 you may need to search the files for things related to spiderwhisperer, spiderhat, and the spiderqueen to see if you can find a specific line of code that you could manipulate to allow the spider queen to agro in the master_postinit and to have spiderwhisperer activate in the common_postinit so that it has a priority to agro instead of be friendly. im not sure if this would work or not. i have the flower tag on mine, but it doesnt consistantly attract bees and butterflies sometimes.i imagine a line something like inst.component.fillerword.agro = true. but again. im unsure. might be a good idea to base your solution path off of. Link to comment Share on other sites More sharing options...
StalkinU Posted December 14, 2014 Author Share Posted December 14, 2014 you may need to search the files for things related to spiderwhisperer, spiderhat, and the spiderqueen to see if you can find a specific line of code that you could manipulate to allow the spider queen to agro in the master_postinit and to have spiderwhisperer activate in the common_postinit so that it has a priority to agro instead of be friendly. im not sure if this would work or not. i have the flower tag on mine, but it doesnt consistantly attract bees and butterflies sometimes.i imagine a line something like inst.component.fillerword.agro = true. but again. im unsure. might be a good idea to base your solution path off of. Hmm, could this work? local events={EventHandler("detected", function(inst)if inst:HasTag("spider_queen") thenagro = trueendend} I feel like this would be the easiest way to get this done.No idea if detected is an actual even tho. Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 14, 2014 Share Posted December 14, 2014 hmm. possibly. im not sure about scripting much in practice but i know that might be able to work if it is either activated before spiderwhisperer or is tailored TO spiderwhisperer as an exception. if you figure out how to make it work, then i would really like to know as it would help me assist people with simular problems and assist me with troubleshooting certain problems. try it Link to comment Share on other sites More sharing options...
StalkinU Posted December 14, 2014 Author Share Posted December 14, 2014 hmm. possibly. im not sure about scripting much in practice but i know that might be able to work if it is either activated before spiderwhisperer or is tailored TO spiderwhisperer as an exception. if you figure out how to make it work, then i would really like to know as it would help me assist people with simular problems and assist me with troubleshooting certain problems. try it Uhm, if you could let me know how to spawn spider queen using the console.Then I'll get back to you tomorrow. Another way would be to expend the locomote component.if inst:HasTag("spider_queen") theninst.components.locomotor.triggerscreep = trueelseinst.components.locomotor.triggerscreep = false Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 14, 2014 Share Posted December 14, 2014 c_spawn("spiderqueen", 1)notice btw that in your code you typed spider_queen. the debug spawn name for the queen is as i wrote it. so you would need to at least change it to spiderqueen in order for it to be able to react to the queen. Link to comment Share on other sites More sharing options...
StalkinU Posted December 14, 2014 Author Share Posted December 14, 2014 c_spawn("spiderqueen", 1)notice btw that in your code you typed spider_queen. the debug spawn name for the queen is as i wrote it. so you would need to at least change it to spiderqueen in order for it to be able to react to the queen. Aahh lol, thanks for that.I'm using a spider_warrior tag as a reference xD Okido, bed time. Link to comment Share on other sites More sharing options...
StalkinU Posted December 14, 2014 Author Share Posted December 14, 2014 @Mobbstar, Your idea fixed it, updated main post.Lets see how godlike you really are @WitchDoctEr16So far I tried this, local fn = function(inst) -- choose which sounds this character will play inst.soundsname = "webber" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "webber.png" ) -- todo: Add an example special power here. if inst:HasTag("spiderqueen") then inst.components.locomotor.triggerscreep = true else inst.components.locomotor.triggerscreep = false end inst:AddTag("spiderwhisperer") inst:AddTag("monster") and this, local fn = function(inst) -- choose which sounds this character will play inst.soundsname = "webber" -- a minimap icon must be specified inst.MiniMapEntity:SetIcon( "webber.png" ) -- todo: Add an example special power here. inst:AddTag("spiderwhisperer") inst:AddTag("monster")if inst:HasTag("spiderqueen") then inst.components.locomotor.triggerscreep = true else inst.components.locomotor.triggerscreep = falseend Neither of them worked, I'm assuming that is because triggercreep only checks if spiders should spawn while walking on webbing. Link to comment Share on other sites More sharing options...
BrotatoTips Posted December 14, 2014 Share Posted December 14, 2014 honestly it would probably be easier to set up the spiderhat ability to be permanant instead of using spiderwhisperer. they are pretty similar, but that the queen attacks a spiderhat wearing character. so if you could figure that out it would probably be easier than the amount of code ur trying to set up here. (spiderqueen isnt a tag, its an entity in the game. that wouldnt work unless you set up an event handler attached to spiderwhisperer that reacts on spiderqueen spawnings. spiderhat is probably what you should try towards instead of this.) Link to comment Share on other sites More sharing options...
StalkinU Posted December 15, 2014 Author Share Posted December 15, 2014 honestly it would probably be easier to set up the spiderhat ability to be permanant instead of using spiderwhisperer. they are pretty similar, but that the queen attacks a spiderhat wearing character. so if you could figure that out it would probably be easier than the amount of code ur trying to set up here. (spiderqueen isnt a tag, its an entity in the game. that wouldnt work unless you set up an event handler attached to spiderwhisperer that reacts on spiderqueen spawnings. spiderhat is probably what you should try towards instead of this.) Thanks for the tip Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.