Jump to content

Need help debugging a custom hat


Recommended Posts

Problem 1: I have a hat that is a recolor of the flower garland and uses the same anim bank. It works fine until it's dropped on the ground, and then it turns invisible. I have tried for weeks to fix this myself, but the answer eludes me.

 

Problem 2: That same hat provides absolute armor protection against bees. The problem is, it also protects from the bee queen which makes for a very easy exploit in defeating her. How could I add an exception for just the bee queen? SOLVED! Thank you!

happy_bees.zip

happy_bees.lua

Edited by FeatherFallen
Link to comment
Share on other sites

Unfortunately I don't know too much on the invisible item issue, but I can at least tell you an easy fix for your bee queen problem. I would just add your own tag to bees and killer bees (and queen bee drones if you want) and then switch your armor to resist your specific tag.

function BeePostInit(inst)
	inst:AddTag("smallbee")
end
AddPrefabPostInit("bee", BeePostInit)
AddPrefabPostInit("killerbee", BeePostInit)
AddPrefabPostInit("beeguard", BeePostInit) -- optional, queen bee drones

 

Link to comment
Share on other sites

1 hour ago, w00tyd00d said:

Unfortunately I don't know too much on the invisible item issue, but I can at least tell you an easy fix for your bee queen problem. I would just add your own tag to bees and killer bees (and queen bee drones if you want) and then switch your armor to resist your specific tag.


function BeePostInit(inst)
	inst:AddTag("smallbee")
end
AddPrefabPostInit("bee", BeePostInit)
AddPrefabPostInit("killerbee", BeePostInit)
AddPrefabPostInit("beeguard", BeePostInit) -- optional, queen bee drones

 

Bless you. That worked like a charm.

Link to comment
Share on other sites

Another neat little feature you can add to your mod is just to make bees completely docile to anyone who's wearing your hat. I would add a unique tag to your hat (like "happybees") to specifically identify it, then you can add this in your modmain:

Spoiler

function CombatCompPostInit(comp)
	local old_SetTarget = comp.SetTarget

	comp.SetTarget = function(self, target)
		if self.inst:HasTag("smallbee") and (target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then
			target = nil
		end
		old_SetTarget(self, target)
	end
end
AddComponentPostInit("combat", CombatCompPostInit)

function WaspHivePostInit(inst)
	local function new_onnear(inst, target)
	    if inst.components.childspawner ~= nil and not
	    	(target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then
	        inst.components.childspawner:ReleaseAllChildren(target, "killerbee")
	    end
	end

	local function new_onhitbyplayer(inst, attacker, damage)
	    if inst.components.childspawner ~= nil and not
	    	(attacker.components.inventory and attacker.components.inventory:EquipHasTag("happybees")) then
	        inst.components.childspawner:ReleaseAllChildren(attacker, "killerbee")
	    end
	    if not inst.components.health:IsDead() then
	        inst.SoundEmitter:PlaySound("dontstarve/bee/beehive_hit")
	        inst.AnimState:PlayAnimation("cocoon_small_hit")
	        inst.AnimState:PushAnimation("cocoon_small", true)
	    end
	end
	
	if GLOBAL.TheWorld.ismastersim then
		inst.components.playerprox:SetOnPlayerNear(new_onnear)
		inst.components.combat:SetOnHit(new_onhitbyplayer)
	end
end
AddPrefabPostInit("wasphive", WaspHivePostInit)

 

to first, modify the combat component to prevent bees from targeting anybody who has your hat equipped, and then secondly to modify wasp hives to prevent any wasps from spawning when you walk past or hit them (otherwise they'd just pop out for a split second and then immediately retreat back to their hive because they "lost their target").

No hard feelings if these aren't the intended features you're looking for, I just thought I'd suggest another option for you :) 

Edited by w00tyd00d
Link to comment
Share on other sites

Oh, I love that idea!

I pasted it in my modmain, added the tag "happybees" to the hat,  and gave it a test. I'm getting a crash... seems to be if the bees go after something without the hat. In this case, a hound.

2a1b2d3183.png

Spoiler

[00:00:00]:
System Memory:
    Memory Load: 32%
    Available Physical Memory: 5394m/7991m
    Available Page File: 6621m/9271m
    Available Virtual Memory: 3971m/4095m
    Available Extended Virtual Memory: 0m
[00:00:00]:
Process Memory:
    Peak Working Set Size: 29m
    Working Set Size: 29m
    Quota Peak Page Pool Usage: 242k
    Quota Page Pool Usage: 235k
    Quota Peak Non Paged Pool Usage:16k
    Quota Non Paged Pool Usage: 16k
    Page File Usage: 5m
    Peak Page File Usage: 5m
[00:00:00]: PersistRootStorage is now APP:Klei//DoNotStarveTogether/
[00:00:00]: Starting Up
[00:00:00]: Version: 233071
[00:00:00]: Current time: Sat Oct 21 13:04:45 2017

[00:00:00]: Don't Starve Together: 233071 WIN32_STEAM
[00:00:00]: Build Date: 2243
[00:00:00]: Parsing command line
[00:00:00]: Command Line Arguments:
[00:00:00]: Initializing distribution platform
[00:00:00]: Initializing Minidump handler
[00:00:00]: ....Done
[00:00:00]: Steam AppBuildID: 2127799
[00:00:00]: ....Done
[00:00:00]: Fixing DPI
[00:00:00]: ...Done
[00:00:00]: THREAD - started 'GAClient' (10260)
[00:00:00]: CurlRequestManager::ClientThread::Main()
[00:00:02]: ProfileIndex:4.58
[00:00:02]: [Connect] PendingConnection::Reset(true)
[00:00:02]: Network tick rate: U=15(2), D=0
[00:00:02]: Authorized application C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\bin\dontstarve_steam.exe is enabled in the firewall.
[00:00:02]: WindowsFirewall - Application already authorized
[00:00:02]: THREAD - started 'StreamInput' (4084)
[00:00:02]: loaded ping_cache
[00:00:02]: Offline user ID: OU_76561198097558965
[00:00:02]: SteamID: 76561198097558965
[00:00:02]: HardwareStats:
  OS                        
    name                      Microsoft Windows 10 Pro
    version                   10.0.15063
    architecture              64-bit
    platformSpecific          SP 0.0
  CPU                       
    numCores                  2
    features                  SSE,SSE2,SSE3,SSSE3,SSE41,SSE42
    name                      Intel(R) Core(TM) i5 CPU         650  @ 3.20GHz
    manufacturer              GenuineIntel
    clockSpeed                3333
  RAM                       
    megsOfRam                 8196
  GPU                       
    name                      Intel(R) HD Graphics
    driverDate                20121126000000.000000-000
    megsOfRam                 3771
    refreshRate               59
    videoModeDescription      1366 x 768 x 4294967296 colors
    driverVersion             8.15.10.2900

[00:00:02]: cGame::InitializeOnMainThread
[00:00:02]: WindowManager::Initialize
[00:00:02]: CreateWindow: Requesting 1362,705 - 5/6/5 - -1/-1/-1 - 0
[00:00:03]: CreateEGLContext: 16 configs found
[00:00:03]:      0: 8/8/8 -  0/ 0/ 0 - 0
[00:00:03]:      1: 8/8/8 -  0/16/ 0 - 0
[00:00:03]:      2: 8/8/8 -  0/24/ 0 - 0
[00:00:03]:      3: 8/8/8 -  0/24/ 8 - 0
[00:00:03]:      4: 5/5/5 -  0/ 0/ 0 - 0
[00:00:03]:      5: 5/5/5 -  1/ 0/ 0 - 0
[00:00:03]:      6: 5/5/5 -  0/16/ 0 - 0
[00:00:03]:      7: 5/5/5 -  1/16/ 0 - 0
[00:00:03]:      8: 5/5/5 -  0/24/ 0 - 0
[00:00:03]:      9: 5/5/5 -  1/24/ 0 - 0
[00:00:03]:     10: 5/5/5 -  0/24/ 8 - 0
[00:00:03]:     11: 5/5/5 -  1/24/ 8 - 0
[00:00:03]:     12: 8/8/8 -  8/ 0/ 0 - 0
[00:00:03]:     13: 8/8/8 -  8/16/ 0 - 0
[00:00:03]:     14: 8/8/8 -  8/24/ 0 - 0
[00:00:03]:     15: 8/8/8 -  8/24/ 8 - 0
[00:00:03]: RestoreWindowPosition
[00:00:03]:    Saved Client Pos (0 x 23)
[00:00:03]:    Adjusted Window Pos (-8 x -8)
[00:00:03]: EnsureWindowOnScreen
[00:00:03]:    All good.
[00:00:03]: GLInfo
[00:00:03]: ~~~~~~
[00:00:03]: GL_VENDOR: Google Inc.
[00:00:03]: GL_RENDERER: ANGLE (Intel(R) HD Graphics)
[00:00:03]: GL_VERSION: OpenGL ES 2.0 (ANGLE 1.0.0.2249)
[00:00:03]: GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 1.00 (ANGLE 1.0.0.2249)
[00:00:03]: THREAD - started 'WindowsInputManager' (8356)
[00:00:03]: OpenGL extensions (18, 18):
[00:00:03]: GL_ANGLE_depth_texture
[00:00:03]: GL_ANGLE_framebuffer_blit
[00:00:03]: GL_ANGLE_instanced_arrays
[00:00:03]: GL_ANGLE_pack_reverse_row_order
[00:00:03]: GL_ANGLE_texture_compression_dxt3
[00:00:03]: GL_ANGLE_texture_compression_dxt5
[00:00:03]: GL_ANGLE_texture_usage
[00:00:03]: GL_ANGLE_translated_shader_source
[00:00:03]: GL_EXT_read_format_bgra
[00:00:03]: GL_EXT_robustness
[00:00:03]: GL_EXT_texture_compression_dxt1
[00:00:03]: GL_EXT_texture_format_BGRA8888
[00:00:03]: GL_EXT_texture_storage
[00:00:03]: GL_OES_get_program_binary
[00:00:03]: GL_OES_packed_depth_stencil
[00:00:03]: GL_OES_rgb8_rgba8
[00:00:03]: GL_OES_standard_derivatives
[00:00:03]: GL_OES_texture_npot
[00:00:03]: GL_MAX_TEXTURE_SIZE = 8192
[00:00:03]: GL_MAX_TEXTURE_IMAGE_UNITS = 16
[00:00:03]: GL_MAX_RENDERBUFFER_SIZE = 8192
[00:00:03]: GL_MAX_VIEWPORT_DIMS = 8192, 8192
[00:00:03]: GL_MAX_VARYING_VECTORS = 10
[00:00:03]: GL_MAX_VERTEX_ATTRIBS = 16
[00:00:03]: GL_MAX_VERTEX_UNIFORM_VECTORS = 254
[00:00:03]: GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4
[00:00:03]: GL_MAX_FRAGMENT_UNIFORM_VECTORS = 221
[00:00:03]: 4 compressed texture formats
[00:00:03]: texture format 0x83f0
[00:00:03]: texture format 0x83f1
[00:00:03]: texture format 0x83f2
[00:00:03]: texture format 0x83f3
[00:00:03]: Renderer initialize: Okay
[00:00:04]: AnimManager initialize: Okay
[00:00:04]: Buffers initialize: Okay
[00:00:04]: cDontStarveGame::DoGameSpecificInitialize()
[00:00:04]: GameSpecific initialize: Okay
[00:00:04]: cGame::StartPlaying
[00:00:04]: LOADING LUA
[00:00:04]: DoLuaFile scripts/main.lua
[00:00:04]: DoLuaFile loading buffer scripts/main.lua
[00:00:04]: running main.lua
    
[00:00:04]: loaded modindex    
[00:00:04]: ModIndex: Beginning normal load sequence.
    
[00:00:06]: LOADING LUA SUCCESS
[00:00:06]: PlayerDeaths loaded morgue    5333    
[00:00:06]: PlayerHistory loaded player_history    1104    
[00:00:06]: bloom_enabled    false    
[00:00:06]: loaded saveindex    
[00:00:06]: OnFilesLoaded()    
[00:00:06]: OnUpdatePurchaseStateComplete    
[00:00:09]:     Load FE    
[00:00:09]:     Load FE: done    
[00:00:09]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/client_save/blocklist.txt (Failure)
[00:00:09]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/client_save/adminlist.txt (Failure)
[00:00:09]: OnLoadUserIdList: APP:Klei//DoNotStarveTogether/client_save/whitelist.txt (Failure)
[00:00:09]: SimLuaProxy::QueryServer()
[00:00:09]: ModIndex: Load sequence finished successfully.    
[00:00:09]: Reset() returning
[00:00:11]: [Steam] Auth Session Ticket requested...
[00:00:11]: [Steam] Got Auth Session Ticket
[00:00:12]: [200] Account Communication Success (3)
[00:00:12]: loaded inventory_cache
[00:00:12]: Logging in as KU_Vk_kf2xu
[00:00:13]: loaded inventory_cache
[00:00:14]: SimLuaProxy::QueryServer()
[00:00:15]: QueryStats: { "req":"modrank", "field":"Session.Loads.Mods.list", "fieldop":"unwind", "linkpref":"external", "limit": 20}
[00:00:15]: Frontend-Unloading mod 'all'.    
[00:00:16]: FrontendLoadMod    pollen    
[00:00:16]: Could not load mod_config_data/modconfiguration_pollen    
[00:00:16]: Fontend-Loading mod: pollen (Pollen) Version:1.2.7    
[00:00:16]: Mod: pollen (Pollen)    Loading modworldgenmain.lua    
[00:00:16]: Mod: pollen (Pollen)      Mod had no modworldgenmain.lua. Skipping.    
[00:00:16]: ../mods/workshop-767776640/modicon.tex is 640x640 but compressed textures must have power of 2 dimensions.
[00:00:17]:    EResult 15, 463655483
[00:00:17]: Failed getting mod details.
[00:00:17]:    EResult 15, 364255295
[00:00:17]: Failed getting mod details.
[00:00:19]: Could not load mod_config_data/modconfiguration_pollen    
[00:00:19]: Network tick rate: U=15(2), D=0
[00:00:19]: ModWorkshop::CancelDownloads clearing all unfinished downloads
[00:00:19]: About to start a server with the following settings:
[00:00:19]:   Dedicated: false
[00:00:19]:   Online: true
[00:00:19]:   Passworded: false
[00:00:19]:   ServerPort: 10999
[00:00:19]:   SteamAuthPort: 8766
[00:00:19]:   SteamMasterServerPort: 27016
[00:00:19]:   ClanID: false
[00:00:19]:   ClanOnly: false
[00:00:19]:   ClanAdmin: false
[00:00:19]:   LanOnly: false
[00:00:19]:   FriendsOnly: true
[00:00:19]:   EnableAutosaver: true
[00:00:19]:   EncodeUserPath: true
[00:00:19]:   PVP: false
[00:00:19]:   Event: false
[00:00:19]:   MaxPlayers: 6
[00:00:19]:   GameMode: survival
[00:00:19]:   OverridenDNS:
[00:00:19]:   PauseWhenEmpty: true
[00:00:19]:   VoteEnabled: false
[00:00:19]:   InternetBroadcasting: true
[00:00:19]:   Intent: social
[00:00:19]: [Warning] Could not confirm port 10999 is open in the firewall.
[00:00:19]: Could not load mod_config_data/modconfiguration_pollen    
[00:00:19]: Online Server Started on port: 10999
[00:00:21]: Collecting garbage...
[00:00:21]: lua_gc took 0.04 seconds
[00:00:21]: ~ShardLuaProxy()
[00:00:21]: ~ItemServerLuaProxy()
[00:00:21]: ~InventoryLuaProxy()
[00:00:21]: ~NetworkLuaProxy()
[00:00:21]: ~SimLuaProxy()
[00:00:21]: ModWorkshop::CancelDownloads clearing all unfinished downloads
[00:00:21]: lua_close took 0.04 seconds
[00:00:21]: ReleaseAll
[00:00:21]: ReleaseAll Finished
[00:00:21]: cGame::StartPlaying
[00:00:21]: LOADING LUA
[00:00:21]: DoLuaFile scripts/main.lua
[00:00:21]: DoLuaFile loading buffer scripts/main.lua
[00:00:21]: running main.lua
    
[00:00:21]: loaded modindex    
[00:00:21]: ModIndex: Beginning normal load sequence.
    
[00:00:21]: ModIndex:GetModsToLoad inserting moddir,     pollen    
[00:00:21]: Could not load mod_config_data/modconfiguration_pollen    
[00:00:21]: Loading mod: pollen (Pollen) Version:1.2.7    
[00:00:21]: Mod: pollen (Pollen)    Loading modworldgenmain.lua    
[00:00:21]: Mod: pollen (Pollen)      Mod had no modworldgenmain.lua. Skipping.    
[00:00:21]: Mod: pollen (Pollen)    Loading modmain.lua    
[00:00:21]: LOADING LUA SUCCESS
[00:00:22]: PlayerDeaths loaded morgue    5333    
[00:00:22]: PlayerHistory loaded player_history    1104    
[00:00:22]: bloom_enabled    false    
[00:00:22]: loaded saveindex    
[00:00:22]: OnFilesLoaded()    
[00:00:22]: OnUpdatePurchaseStateComplete    
[00:00:22]:     Unload FE    
[00:00:22]:     Unload FE done    
[00:00:23]: Mod: pollen (Pollen)    Registering prefabs    
[00:00:23]: Mod: pollen (Pollen)      Registering prefab file: prefabs/apidae    
[00:00:23]: Mod: pollen (Pollen)        apidae    
[00:00:23]: Mod: pollen (Pollen)      Registering prefab file: prefabs/apidae_none    
[00:00:23]: Mod: pollen (Pollen)        apidae_none    
[00:00:23]: Mod: pollen (Pollen)      Registering prefab file: prefabs/light_bees    
[00:00:23]: Mod: pollen (Pollen)        light_bees    
[00:00:23]: Mod: pollen (Pollen)      Registering prefab file: prefabs/happy_bees    
[00:00:23]: Mod: pollen (Pollen)        happy_bees    
[00:00:23]: Mod: pollen (Pollen)      Registering default mod prefab    
[00:00:24]: ../mods/pollen/images/saveslot_portraits/apidae.tex is 120x104 but compressed textures must have power of 2 dimensions.
[00:00:24]: ../mods/pollen/images/selectscreen_portraits/apidae.tex is 188x284 but compressed textures must have power of 2 dimensions.
[00:00:24]: ../mods/pollen/images/selectscreen_portraits/apidae_silho.tex is 188x284 but compressed textures must have power of 2 dimensions.
[00:00:24]:     LOAD BE    
[00:00:26]:     LOAD BE: done    
[00:00:27]: Loading world: session/2FFB175C846855ED/0000000002    
[00:00:27]: Save file is at version 4.77    
[00:00:27]: Begin Session: 2FFB175C846855ED
[00:00:27]: saving to server_temp/server_save    
[00:00:27]: MiniMapComponent::AddAtlas( minimap/minimap_data.xml )
[00:00:27]: MiniMapComponent::AddAtlas( ../mods/pollen/images/map_icons/apidae.xml )
[00:00:28]: Loading Nav Grid    
[00:00:34]: Reconstructing topology    
[00:00:34]:     ...Sorting points    
[00:00:34]:     ...Sorting edges    
[00:00:34]:     ...Connecting nodes    
[00:00:34]:     ...Validating connections    
[00:00:35]:     ...Housekeeping    
[00:00:35]:     ...Done!    
[00:00:35]: Truncating to snapshot #2...
[00:00:35]:  - session/2FFB175C846855ED/A7JUTVNA8BNO/0000000003
[00:00:35]:    1 file(s) removed
[00:00:35]: 1 uploads added to server. From server_temp
[00:00:35]: Telling Client our new session identifier: 2FFB175C846855ED
[00:00:35]: ModIndex: Load sequence finished successfully.    
[00:00:35]: Reset() returning
[00:00:36]: Attempting to send resume request
[00:00:36]: Resuming user: session/2FFB175C846855ED/A7JUTVNA8BNO
[00:00:36]: ReceiveResumeNotification
[00:00:36]: Deleting user: session/2FFB175C846855ED/A7JUTVNA8BNO/0000000003
[00:00:36]: Validating portal[1] <-> <nil>[1] (inactive)    
[00:00:36]: Validating portal[2] <-> <nil>[2] (inactive)    
[00:00:36]: Validating portal[3] <-> <nil>[3] (inactive)    
[00:00:36]: Validating portal[4] <-> <nil>[4] (inactive)    
[00:00:37]: Validating portal[5] <-> <nil>[5] (inactive)    
[00:00:37]: Validating portal[6] <-> <nil>[6] (inactive)    
[00:00:37]: Validating portal[7] <-> <nil>[7] (inactive)    
[00:00:37]: Validating portal[8] <-> <nil>[8] (inactive)    
[00:00:37]: Validating portal[9] <-> <nil>[9] (inactive)    
[00:00:37]: Validating portal[10] <-> <nil>[10] (inactive)    
[00:00:40]: Spawn request: wilson from [Host] Bee
[00:00:40]: Skin request: (wilson_none) () () () ()
[00:00:41]: Spawning player at: [Fixed] (-86.00, 0.00, 310.00)    
[00:00:41]: Serializing user: session/2FFB175C846855ED/A7JUTVNA8BNO/0000000003
[00:00:41]: Deserializing tile data (425 x 425)
[00:01:54]: Could not find anim bank [hat_flower]
[00:01:54]: giving     120381 - happy_bees    
[00:02:50]: [string "../mods/pollen/modmain.lua"]:91: attempt to index local 'target' (a nil value)
LUA ERROR stack traceback:
../mods/pollen/modmain.lua:91 in (method) SetTarget (Lua) <90-95>
   self =
      hiteffectsymbol = body
      defaultdamage = 10
      nextbattlecrytime = 136.80358658554
      forcefacing = true
      inst = 120451 - killerbee (valid:true)
      retargetperiod = 2
      hitrange = 0.6
      playerstunlock = 3
      lastwasattackedtime = 0
      keeptargettimeout = 0
      lastdoattacktime = 131.3333401829
      SetTarget = function - ../mods/pollen/modmain.lua:90
      retargettask = PERIODIC 120451: 2.000000
      losetargetcallback = function - scripts/components/combat.lua:265
      laststartattacktime = 130.83334015682
      battlecryenabled = true
      _ = table: 59735BA8
      targetfn = function - scripts/prefabs/bee.lua:112
   target = nil
scripts/behaviours/chaseandattack.lua:68 in (method) Visit (Lua) <35-131>
   self =
      give_up_dist = 25
      onattackfn = function - scripts/behaviours/chaseandattack.lua:12
      numattacks = 0
      parent = table: 59B00150
      startruntime = 132.90000693128
      max_chase_time = 10
      name = ChaseAndAttack
      status = SUCCESS
      inst = 120451 - killerbee (valid:true)
      lastresult = RUNNING
      nextupdatetime = 133.12500693649
   combat = table: 59735E50
   is_attacking = false
scripts/behaviourtree.lua:643 in (method) Visit (Lua) <633-664>
   self =
      name = Parallel
      status = RUNNING
      parent = table: 59B00790
      children = table: 59AFFB10
      lastresult = RUNNING
   done = true
   any_done = true
   idx = 2
   child = target 120438 - hound
scripts/behaviourtree.lua:601 in (method) Visit (Lua) <554-610>
   self =
      idx = 3
      lasttime = 132.90000693128
      name = Priority
      status = RUNNING
      period = 1
      children = table: 59AFEF58
      lastresult = RUNNING
   time = 133.10000694171
   do_eval = false
   oldidx = 3
   child = table: 59B00150
scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27>
   self =
      root = table: 59B00790
      inst = 120451 - killerbee (valid:true)
      forceupdate = false
scripts/brain.lua:212 in (method) OnUpdate (Lua) <205-214>
   self =
      bt = Priority - RUNNING <RUNNING> (execute 3, eval in 0.80)>0.80
   >Parallel - READY <READY> ()>0.00
   >   >PanicHaunted - READY <READY> ()>0.00
   >   >Panic - READY <READY> ()>0.00
   >Parallel - READY <READY> ()>0.00
   >   >OnFire - READY <READY> ()>0.00
   >   >Panic - READY <READY> ()>0.00
   >Parallel - RUNNING <RUNNING> ()>0.00
   >   >AttackMomentarily - SUCCESS <SUCCESS> ()>0.00
   >   >ChaseAndAttack - SUCCESS <RUNNING> ()>0.00
   >Parallel - READY <READY> ()>0.00
   >   >Dodge - READY <READY> ()>0.00
   >   >RunAway - READY <READY> ()>0.00
   >go home - READY <READY> ()>0.00
   >Wander - READY <READY> ()>0.00

      events = table: 59AFF340
      behaviourqueue = table: 59AFF3E0
      stopped = false
      inst = 120451 - killerbee (valid:true)
scripts/brain.lua:135 in (method) Update (Lua) <105-147>
   self =
      hibernaters = table: 0C640998
      updaters = table: 0C640A88
      tickwaiters = table: 0C640D58
      instances = table: 0C640948
   current_tick = 3993
   waiters = table: 663C6500
   k = --brain--
sleep time: 0.80
Priority - RUNNING <RUNNING> (execute 3, eval in 0.80)>0.80
   >Parallel - READY <READY> ()>0.00
   >   >PanicHaunted - READY <READY> ()>0.00
   >   >Panic - READY <READY> ()>0.00
   >Parallel - READY <READY> ()>0.00
   >   >OnFire - READY <READY> ()>0.00
   >   >Panic - READY <READY> ()>0.00
   >Parallel - RUNNING <RUNNING> ()>0.00
   >   >AttackMomentarily - SUCCESS <SUCCESS> ()>0.00
   >   >ChaseAndAttack - SUCCESS <RUNNING> ()>0.00
   >Parallel - READY <READY> ()>0.00
   >   >Dodge - READY <READY> ()>0.00
   >   >RunAway - READY <READY> ()>0.00
   >go home - READY <READY> ()>0.00
   >Wander - READY <READY> ()>0.00

   v = true
scripts/update.lua:222 in () ? (Lua) <149-228>
   dt = 0.033333335071802
   tick = 3993
   i = 3993

[00:02:50]: [string "../mods/pollen/modmain.lua"]:91: attempt to index local 'target' (a nil value)
LUA ERROR stack traceback:
    ../mods/pollen/modmain.lua:91 in (method) SetTarget (Lua) <90-95>
    scripts/behaviours/chaseandattack.lua:68 in (method) Visit (Lua) <35-131>
    scripts/behaviourtree.lua:643 in (method) Visit (Lua) <633-664>
    scripts/behaviourtree.lua:601 in (method) Visit (Lua) <554-610>
    scripts/behaviourtree.lua:22 in (method) Update (Lua) <20-27>
    scripts/brain.lua:212 in (method) OnUpdate (Lua) <205-214>
    scripts/brain.lua:135 in (method) Update (Lua) <105-147>
    scripts/update.lua:222 in () ? (Lua) <149-228>
  

 

Link to comment
Share on other sites

@FeatherFallen The crash log you posted says that it seems to be a clash with the "pollen" mod you have installed. I downloaded the mod really quick to take a peak at its code and apparently they also have something that changes the behavior of how wasp hives act, so I believe that's what's causing your issue.

According to their mod, it's set up in a very similar fashion except it checks for the "bee" tag instead of your "happybees" tag (assuming because the "pollen" character has the "bee" tag since they're a bee anthropmorph :P). So what I suggest you try is also adding the "bee" tag to your hat as well as the "happybees" tag and then just comment out the wasp hive AddPrefabPostInit and see if it fixes the problem.

EDIT: Actually taking a second look at it, it won't work due to the "bee" tag being tied directly to the player instead of a piece of equipment. So the wasp hive suggestion unfortunately is not gunna be compatible with that mod I'm afraid :\

Edited by w00tyd00d
Link to comment
Share on other sites

@FeatherFallen Ah okay lol well that helps your situation :P

What I would try to do is on line 91 of your modmain, try switching the line to/from this:

Replace:

if self.inst:HasTag("smallbee") and (target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then

With:

if self.inst:HasTag("smallbee") and (target and target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then

and see if it still gives you a crash.

Edited by w00tyd00d
Link to comment
Share on other sites

@w00tyd00d

I have the feeling I'm missing something really obvious here. I tried to expand the use of the "happybees" tag to include neutrality to Chester, Abigail, Hutch and beefalo mounts using another PostInit, but the bees still attack them. 

Spoiler

function BeePostInit(inst)
    inst:AddTag("smallbee")
end
AddPrefabPostInit("bee", BeePostInit)
AddPrefabPostInit("killerbee", BeePostInit)
AddPrefabPostInit("beeguard", BeePostInit)

function BeeFriendPostInit(inst)
    inst:AddTag("happybees")
end
AddPrefabPostInit("abigail", BeeFriendPostInit)
AddPrefabPostInit("chester", BeeFriendPostInit)
AddPrefabPostInit("hutch", BeeFriendPostInit)
AddPrefabPostInit("beefalo", BeeFriendPostInit)

function CombatCompPostInit(comp)
    local old_SetTarget = comp.SetTarget

    comp.SetTarget = function(self, target)
        if self.inst:HasTag("smallbee") and (target and target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then
            target = nil
        end
        old_SetTarget(self, target)
    end
end

AddComponentPostInit("combat", CombatCompPostInit)

 

Link to comment
Share on other sites

@FeatherFallen It's because the check you have for the tag only checks for equipment the target has for the tag in question, but by doing what you're doing above you're attaching the tag directly to the instance itself. To allow a check for this as well as the equipment, just replace the following line:

REPLACE:

if self.inst:HasTag("smallbee") and (target and target.components.inventory and target.components.inventory:EquipHasTag("happybees")) then
  
WITH:
  
if self.inst:HasTag("smallbee") and (target and (target:HasTag("happybees") or target.components.inventory and target.components.inventory:EquipHasTag("happybees"))) then

 

Edited by w00tyd00d
Link to comment
Share on other sites

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
 Share

×
  • Create New...