Jump to content

Recommended Posts

This is what I have in modmain.lua

local recipesword = AddRecipe("brainsword", {Ingredient("gears", 1), Ingredient("transistor", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, "ayylmao", "images/inventoryimages/brainsword.xml", "brainsword.tex")
recipesword.sortkey = 1
STRINGS.RECIPE_DESC.BRAINSWORD = "Technology fueled by sanity."
Game's telling me that global RECIPETABS is a nil value. Why is that?
Also am I supposed to put in "local recipes = {    }" around the thing? Because when I do that it doesn't recognize the second "}" for whatever reason.

@Kzisor,

Thanks, that seems to have worked, but now it's telling me that it's not finding a matching asset for the buildertag in any of the search paths.

 

I have this in my character.lua

local common_postinit = function(inst) 
 
inst:AddTag("ayylmao")
 
end
 
Is this not how I'm supposed to do it?

@Kzisor, Those are already in, what I'm literally getting is "[string "scripts/util.lua"]:396: Could not find an asset matching ayylmao in any of the search paths." in the log ("ayylmao" being the buildertag in my character.lua).

 

Unless they're not in the correct format? This is how they are in the modmain assets

Asset("ATLAS", "images/inventoryimages/brainsword.xml"),
Asset("IMAGE", "images/inventoryimages/brainsword.tex"),

@Kzisor,

It works now, but when I craft the item ingame, I get this error

[00:00:47]: [string "scripts/components/builder.lua"]:296: attempt to compare number with string
LUA ERROR stack traceback:
scripts/components/builder.lua:296 in (method) DoBuild (Lua) <264-346>
   self =
      bonus_tech_level = 0
      accessible_tech_trees = table: 4BE2BCA8
      inst = 108932 - ayy (valid:true)
      recipes = table: 4BE2B460
      _ = table: 4BE2B028
      buffered_builds = table: 4BE2BE10
   recname = brainsword
   pt = (12.53, 0.00, 112.27)
   rotation = nil
   recipe = table: 0EAA08F8
   wetlevel = 0
   prod = 109716 - brainsword(LIMBO) (valid:true)
scripts/actions.lua:870 in (field) fn (Lua) <868-874>
   act = Build nil Recipe: brainsword (valid:true)
scripts/bufferedaction.lua:23 in (method) Do (Lua) <19-33>
   self (valid:true) =
      action = table: 0ED9AAF8
      doer = 108932 - ayy (valid:true)
      onfail = table: 4BE9C948
      doerownsobject = false
      recipe = brainsword
      onsuccess = table: 4BE9D6B8
      distance = 1
      options = table: 4BE9C8A8
      pos = (12.53, 0.00, 112.27)
scripts/entityscript.lua:1196 in (method) PerformBufferedAction (Lua) <1188-1206>
   self (valid:true) =
      DynamicShadow = DynamicShadow (42564868)
      inlimbo = false
      GetMoistureRateScale = function - scripts/prefabs/player_common.lua:90
      SetCameraDistance = function - scripts/prefabs/player_common.lua:1036
      ScreenFlash = function - scripts/prefabs/player_common.lua:1090
      player_classified = 108933 - player_classified (valid:true)
      playercolour = table: 30E03778
      AnimState = AnimState (42564788)
      Light = Light (42565288)
      OnRemoveEntity = function - scripts/prefabs/player_common.lua:522
      pendingtasks = table: 4BFC4A68
      ShowHUD = function - scripts/prefabs/player_common.lua:1030
      sg = sg="wilson", state="dolongaction", time=1.00, tags = "doing,"
      IsHUDVisible = function - scripts/prefabs/player_common.lua:1020
      ApplyScale = function - scripts/prefabs/player_common.lua:1105
      SetGhostMode = function - scripts/prefabs/player_common.lua:439
      ShowActions = function - scripts/prefabs/player_common.lua:1024
      HUD = HUD
      OnWakeUp = function - scripts/prefabs/player_common.lua:953
      Transform = Transform (425650C8)
      actionreplica = table: 4BFC3FC8
      event_listening = table: 4BFC4CE8
      actioncomponents = table: 4BFC2FB0
      lower_components_shadow = table: 4BFC3050
      GetMaxMoisture = function - scripts/prefabs/player_common.lua:80
      prefab = ayy
      updatecomponents = table: 4BDB0A30
      ShakeCamera = function - scripts/prefabs/player_common.lua:1050
      OnDespawn = function - scripts/prefabs/player_common.lua:971
      persists = false
      MiniMapEntity = MiniMapEntity (4255EAE8)
      event_listeners = table: 4BFC4BA8
      OnSetSkin = function - scripts/prefabs/player_common.lua:998
      replica = table: 4BFC2F88
      GetTemperature = function - scripts/prefabs/player_common.lua:40
      GUID = 108932
      ghostenabled = true
      EnableMovementPrediction = function - scripts/prefabs/player_common.lua:400
      worldstatewatching = table: 4BE2C338
      Network = Network (42563DC8)
      userid = KU_OTUYZGQI
      LightWatcher = LightWatcher (42565488)
      inherentactions = table: 2EDBF1B8
      spawntime = 3.9000002034009
      SnapCamera = function - scripts/prefabs/player_common.lua:1042
      ScreenFade = function - scripts/prefabs/player_common.lua:1083
      entity = Entity (423AA5E0)
      children = table: 2EC80390
      IsFreezing = function - scripts/prefabs/player_common.lua:50
      AttachClassified = function - scripts/prefabs/player_common.lua:511
      OnSleepIn = function - scripts/prefabs/player_common.lua:925
      IsActionsVisible = function - scripts/prefabs/player_common.lua:1014
      OnSave = function - scripts/prefabs/player_common.lua:894
      SoundEmitter = SoundEmitter (425659E8)
      IsOverheating = function - scripts/prefabs/player_common.lua:60
      name = AfrostLord
      GetMoisture = function - scripts/prefabs/player_common.lua:70
      so
[00:00:47]: [string "scripts/components/builder.lua"]:296: attempt to compare number with string
LUA ERROR stack traceback:
    scripts/components/builder.lua:296 in (method) DoBuild (Lua) <264-346>
    scripts/actions.lua:870 in (field) fn (Lua) <868-874>
    scripts/bufferedaction.lua:23 in (method) Do (Lua) <19-33>
    scripts/entityscript.lua:1196 in (method) PerformBufferedAction (Lua) <1188-1206>
    scripts/stategraphs/SGwilson.lua:2160 in (field) ontimeout (Lua) <2157-2161>
    scripts/stategraph.lua:544 in (method) UpdateState (Lua) <530-574>
    scripts/stategraph.lua:601 in (method) Update (Lua) <593-621>
    scripts/stategraph.lua:123 in (method) Update (Lua) <107-146>
    scripts/update.lua:205 in () ? (Lua) <146-219>
 
[00:00:47]: SCRIPT ERROR! Showing error screen
[00:00:48]: Force aborting...

What do I do?

Edited by AfrostLord

@AfrostLord, AddRecipe("brainsword", { GLOBAL.Ingredient("gears", 1), GLOBAL.Ingredient("transistor", 2) }, GLOBAL.RECIPETABS.WAR, GLOBAL.TECH.NONE, nil, nil, nil, nil, "ayylmao", "images/inventoryimages/brainsword.xml", "brainsword.tex" ) 

 

Try this function, it should work correctly.

 

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