Jump to content

[Guide] Getting started with modding DST (and some general tips for DS as well)


rezecib
 Share

Recommended Posts

Hello.

I can't find any info about how to set variable amount of items.

My mod (only own use) base on  Auto Planting

In contradistinction to "Auto planting" my mod don't planting items at offset algorithm, but return so much new items as much as I put to container.

And there is in "Auto planting"-mod such code:

if inst.components.container:Has("dug_sapling", 1) then
	inst.components.container:ConsumeByName("dug_sapling", 1)
	inst.plants = "sapling"
	GLOBAL.ThePlayer.components.inventory:ConsumeByName("nightmarefuel", amount)
end

Instead number (there it is 1), I want use variable amount "n", which I will set as "local n = I don't know what code to use here".

I tried to use "local n = self.obj.components.stackable:StackSize()", but it don't work.

And so here is my question: how to set variable amount of items, that based on  the amount of items that I'm going to put in the container. I don't want to set a fixed amount of items, because with each use, amount of items will be different, depending on how many I want use.  

Sorry for my bad english. It's not my native language.

Link to comment
Share on other sites

Hey, new to modding, blah blah blah...

Found this thread really helpful as a starting point, but just wanted to ask if gates are part of that "currently not (nicely) moddable" list. Had a few gate related mod ideas; minor tweaks, new mechanics, different kinds of gates etc.; so I've been searching online/ looking through the Lua scripts to find the best approach.

I'll make my own topic if I need to pick people's brains too much, but just wanted to confirm: am I right in thinking gates cannot currently be tweaked/ built upon too much without scripting them from scratch?

Thankyow =P

Link to comment
Share on other sites

Well looking through the scripts there's nothing in prefabs for fence gates. The best I've found is a zipped file under "data\anim\fence_gate.zip". I'd be surprised if there isn't anything for gates in the scripts, but if there is I'm just not seeing anything.

Also I'm guessing if it's under compiled code then it's pretty much off-limits, right?

Edited by 9bjames
Link to comment
Share on other sites

Yeah, I've seen some custom gate mods and have already considered asking to use parts of their code if "vanilla" fence gates are inaccessible. Anywho, I'll keep looking and move this to another topic if I decide to pursue it. Sounds like it'll be more work than I first imagined at any rate. Just like anything in programming... yay... ._.

Link to comment
Share on other sites

8 hours ago, 9bjames said:

Well looking through the scripts there's nothing in prefabs for fence gates.

fence.lua seems to contain fence and fence_gates.

Also, the code looks pretty complex.

 

8 hours ago, 9bjames said:

Also I'm guessing if it's under compiled code then it's pretty much off-limits, right?

I don't understand what it means.

  • Like 1
Link to comment
Share on other sites

Hah, fence.lua... updated DST today and there it is plain as daylight... Either I'm blind or things have been changed around a bit (correction, I'm definitely blind).

At any rate, by compiled code I meant anything that's in the core "compiled" part of the game written in C++, as opposed to the parts scripted in Lua. I'm not the most experienced programmer so I could be wrong, but I'm pretty sure compiled code is, at best, a pain to get into/ modify.

Edited by 9bjames
grammar
Link to comment
Share on other sites

More detail on Replicas

## EntityScript Replica Components

Replicas only affect the component values of an EntityScript.

Adding components to entities is straight-forward,
for example:

```
	local e = CreateEntity();
	e:AddComponent("named");
	assert(e.components.named == require("components/named"));
```

By default all components are designed to operate locally.
For example, if the following line were evaluated only by
the client, it would not change the value for the same
component on the same entity on any other simulator on the
network:

```
	e.components.named:SetName("SecretBilly");
```

For every component that requires network synchronization,
a components/*_replica.lua is created. The name is also
registered via AddReplicableComponent().

While the original component and replica component may
share the same interface, the replica's job is to sync
its data so all machines in the network receive the same
values, using netvars and RPC. For example, if the server
evaluates the following code, all clients with a copy of
the same entity will receive the same changes to their 
component values, as well:

```
	// component names listed in REPLICATABLE_COMPONENTS list
	// automatically have their replica components added to 
	// the entity during the AddComponent() step above.
	assert(e.replica.named == require("components/named_replica"));
	e.replica.named:SetName("EverybodyKnowsBilly");
```

The named component is a real example, so read its source
for more detailed examples.

 

Link to comment
Share on other sites

well im getting this error but i don't know  what to do

Quote

[00:00:00]: 
System Memory:
    Memory Load: 42%
    Available Physical Memory: 4678m/8131m
    Available Page File: 4100m/9754m
    Available Virtual Memory: 3969m/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: 240k
    Quota Page Pool Usage: 232k
    Quota Peak Non Paged Pool Usage:16k
    Quota Non Paged Pool Usage: 15k
    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: 387834
[00:00:00]: Current time: Thu Dec 26 10:04:34 2019

[00:00:00]: Don't Starve Together: 387834 WIN32_STEAM
[00:00:00]: Build Date: 4816
[00:00:00]: Mode: 32-bit
[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: 4522784
[00:00:00]: ....Done
[00:00:00]: PersistUserStorage is now APP:Klei//DoNotStarveTogether/93988299/ 
[00:00:00]: Fixing DPI
[00:00:00]: ...Done
[00:00:00]: THREAD - started 'GAClient' (12072)
[00:00:00]: CurlRequestManager::ClientThread::Main()
[00:00:00]: Mounting file system databundles/klump.zip successful.
[00:00:00]: Mounting file system databundles/shaders.zip successful.
[00:00:00]: Mounting file system databundles/fonts.zip successful.
[00:00:00]: Mounting file system databundles/anim_dynamic.zip successful.
[00:00:00]: Mounting file system databundles/bigportraits.zip successful.
[00:00:00]: Mounting file system databundles/images.zip successful.
[00:00:00]: Mounting file system databundles/scripts.zip successful.
[00:00:04]: ProfileIndex:3.13
[00:00:04]: [Connect] PendingConnection::Reset(true)
[00:00:04]: Platform: 1
[00:00:04]: THREAD - started 'Ping Job Thread' (10276)
[00:00:04]: Network tick rate: U=15(2), D=0
[00:00:04]: Authorized application D:\Programs\Steam\steamapps\common\Don't Starve Together\bin\dontstarve_steam.exe is enabled in the firewall.
[00:00:04]: WindowsFirewall - Application already authorized
[00:00:04]: THREAD - started 'StreamInput' (7932)
[00:00:04]: loaded ping_cache
[00:00:04]: Offline user ID: OU_76561198054254027
[00:00:04]: SteamID: 76561198054254027
[00:00:04]: HardwareStats:
  OS                        
    name                      Microsoft Windows 10 Pro
    version                   10.0.10586
    architecture              64 bit
    platformSpecific          SP 0.0
  CPU                       
    numCores                  6
    features                  SSE,SSE2,SSE3,SSSE3,SSE41,SSE42,AVX
    name                      Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    manufacturer              GenuineIntel
    clockSpeed                2808
  RAM                       
    megsOfRam                 8192
  GPU                       
    name                      NVIDIA GeForce GTX 1050 Ti
    driverDate                20191206000000.000000-000
    megsOfRam                 4095
    refreshRate               60
    videoModeDescription      1920 x 1080 x 4294967296 renk
    driverVersion             26.21.14.4166

[00:00:04]: cGame::InitializeOnMainThread
[00:00:04]: WindowManager::Initialize
[00:00:04]: CreateWindow: Requesting 1920,1080 - 5/6/5 - -1/-1/-1 - 0
[00:00:04]: CreateEGLContext: 12 configs found
[00:00:04]:      0: 8/8/8 -  0/ 0/ 0 - 0
[00:00:04]:      1: 8/8/8 -  0/16/ 0 - 0
[00:00:04]:      2: 8/8/8 -  0/24/ 0 - 0
[00:00:04]:      3: 8/8/8 -  0/24/ 8 - 0
[00:00:04]:      4: 5/5/5 -  0/ 0/ 0 - 0
[00:00:04]:      5: 5/5/5 -  0/16/ 0 - 0
[00:00:04]:      6: 5/5/5 -  0/24/ 0 - 0
[00:00:04]:      7: 5/5/5 -  0/24/ 8 - 0
[00:00:04]:      8: 8/8/8 -  8/ 0/ 0 - 0
[00:00:04]:      9: 8/8/8 -  8/16/ 0 - 0
[00:00:04]:     10: 8/8/8 -  8/24/ 0 - 0
[00:00:04]:     11: 8/8/8 -  8/24/ 8 - 0
[00:00:04]: WindowManager::SetFullscreen(0, 1920, 1080, 60)
[00:00:04]: SetCommonDefaultControlMapping
[00:00:04]:    X-pos and Y-pos available (Left Stick)
[00:00:04]:    Z-pos and Z-rot available (Right Stick)
[00:00:04]: GLInfo
[00:00:04]: ~~~~~~
[00:00:04]: GL_VENDOR: Google Inc.
[00:00:04]: GL_RENDERER: ANGLE (NVIDIA GeForce GTX 1050 Ti)
[00:00:04]: GL_VERSION: OpenGL ES 2.0 (ANGLE 1.0.0.2249)
[00:00:04]: GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 1.00 (ANGLE 1.0.0.2249)
[00:00:04]: OpenGL extensions (19, 19):
[00:00:04]: GL_ANGLE_depth_texture
[00:00:04]: GL_ANGLE_framebuffer_blit
[00:00:04]: GL_ANGLE_framebuffer_multisample
[00:00:04]: GL_ANGLE_instanced_arrays
[00:00:04]: GL_ANGLE_pack_reverse_row_order
[00:00:04]: GL_ANGLE_texture_compression_dxt3
[00:00:04]: GL_ANGLE_texture_compression_dxt5
[00:00:04]: GL_ANGLE_texture_usage
[00:00:04]: GL_ANGLE_translated_shader_source
[00:00:04]: GL_EXT_read_format_bgra
[00:00:04]: GL_EXT_robustness
[00:00:04]: GL_EXT_texture_compression_dxt1
[00:00:04]: GL_EXT_texture_format_BGRA8888
[00:00:04]: GL_EXT_texture_storage
[00:00:04]: GL_OES_get_program_binary
[00:00:04]: GL_OES_packed_depth_stencil
[00:00:04]: GL_OES_rgb8_rgba8
[00:00:04]: GL_OES_standard_derivatives
[00:00:04]: GL_OES_texture_npot
[00:00:04]: GL_MAX_TEXTURE_SIZE = 16384
[00:00:04]: GL_MAX_TEXTURE_IMAGE_UNITS = 16
[00:00:04]: GL_MAX_RENDERBUFFER_SIZE = 16384
[00:00:04]: GL_MAX_VIEWPORT_DIMS = 16384, 16384
[00:00:04]: GL_MAX_VARYING_VECTORS = 10
[00:00:04]: GL_MAX_VERTEX_ATTRIBS = 16
[00:00:04]: GL_MAX_VERTEX_UNIFORM_VECTORS = 254
[00:00:04]: GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 4
[00:00:04]: GL_MAX_FRAGMENT_UNIFORM_VECTORS = 221
[00:00:04]: 4 compressed texture formats
[00:00:04]: texture format 0x83f0
[00:00:04]: texture format 0x83f1
[00:00:04]: texture format 0x83f2
[00:00:04]: texture format 0x83f3
[00:00:04]: THREAD - started 'WindowsInputManager' (12120)
[00:00:05]: Renderer initialize: Okay
[00:00:05]: AnimManager initialize: Okay
[00:00:05]: Buffers initialize: Okay
[00:00:05]: cDontStarveGame::DoGameSpecificInitialize()
[00:00:05]: GameSpecific initialize: Okay
[00:00:05]: cGame::StartPlaying
[00:00:05]: LOADING LUA
[00:00:05]: DoLuaFile scripts/main.lua
[00:00:05]: DoLuaFile loading buffer scripts/main.lua
[00:00:05]:   taskgrouplist:    default    Together    
[00:00:05]:   taskgrouplist:    classic    Classic    
[00:00:05]:   taskgrouplist:    cave_default    Underground    
[00:00:05]:   taskgrouplist:    lavaarena_taskset    The Forge    
[00:00:05]:   taskgrouplist:    quagmire_taskset    The Gorge    
[00:00:05]: running main.lua
    
[00:00:05]: loaded modindex    
[00:00:05]: ModIndex: Beginning normal load sequence.
    
[00:00:05]: Event data unavailable: lavaarena_event_server/lavaarena_achievement_quest_defs
[00:00:07]: LOADING LUA SUCCESS
[00:00:07]: PlayerDeaths loaded morgue    5606    
[00:00:07]: PlayerHistory loaded player_history (v2) len:219    
[00:00:07]: ServerPreferences loaded server_preferences    2    
[00:00:07]: bloom_enabled    true    
[00:00:07]: loaded saveindex    
[00:00:07]: OnFilesLoaded()    
[00:00:07]: OnUpdatePurchaseStateComplete    
[00:00:07]: Klump load on boot started.    
[00:00:07]: Klump files loaded:     0    
[00:00:08]:     Load FE    
[00:00:09]:     Load FE: done    
[00:00:09]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/93988299/client_save/blocklist.txt (Failure)
[00:00:09]: OnLoadPermissionList: APP:Klei//DoNotStarveTogether/93988299/client_save/adminlist.txt (Failure)
[00:00:09]: OnLoadUserIdList: APP:Klei//DoNotStarveTogether/93988299/client_save/whitelist.txt (Failure)
[00:00:09]: THREAD - started 'FilesExistAsyncThread' (10624)
[00:00:09]: FilesExistAsyncThread started (14501 files)...
[00:00:09]: [MOTD] Downloading info from   https://motd.klei.com/?game=dst&platform=STEAM&locale=TR&lang=turkish&user=76561198054254027  
[00:00:09]: SimLuaProxy::QueryServer()
[00:00:09]: Check for write access: TRUE
[00:00:09]: Check for read access: TRUE
[00:00:09]: ModIndex: Load sequence finished successfully.    
[00:00:09]: Reset() returning
[00:00:11]: [MOTD] Downloading image for box1
[00:00:16]: [MOTD] Done Loading.    
[00:00:19]: [Steam] Auth Session Ticket requested...
[00:00:19]: [Steam] Got Auth Session Ticket
[00:00:20]: ... FilesExistAsyncThread complete
[00:00:21]: [200] Account Communication Success (3)
[00:00:21]: Logging in as KU_yy8VPGPr
[00:00:21]: There is no active event to get the status of.
[00:00:22]: loaded inventory_cache_prod
[00:00:22]: loaded inventory_cache_prod
[00:00:25]: Getting top mod details...
[00:00:25]: Frontend-Unloading mod 'all'.    
[00:00:25]: ../mods/workshop-442635304/moreintumbleweed-icon.tex is 200x200 but compressed textures must have power of 2 dimensions.
[00:00:25]: ../mods/workshop-623286817/modicon.tex is 200x200 but compressed textures must have power of 2 dimensions.
[00:00:25]: ../mods/workshop-1815741984/modicon.tex is 316x316 but compressed textures must have power of 2 dimensions.
[00:00:25]: ../mods/workshop-908528377/preview.tex is 200x200 but compressed textures must have power of 2 dimensions.
[00:00:25]: FrontendLoadMod    deneme karakter    
[00:00:25]: Could not load mod_config_data/modconfiguration_deneme karakter    
[00:00:25]: Fontend-Loading mod: deneme karakter (Extended Sample Character) Version:1.2.5    
[00:00:25]: Mod: deneme karakter (Extended Sample Character)    Loading modworldgenmain.lua    
[00:00:25]: Mod: deneme karakter (Extended Sample Character)      Mod had no modworldgenmain.lua. Skipping.    
[00:00:25]: GOT top mod details...50
[00:00:26]: Could not load mod_config_data/modconfiguration_deneme karakter    
[00:00:26]: Network tick rate: U=15(2), D=0
[00:00:26]: ModWorkshop::CancelDownloads clearing all unfinished downloads
[00:00:26]: About to start a server with the following settings:
[00:00:26]:   Dedicated: false
[00:00:26]:   Online: true
[00:00:26]:   Passworded: false
[00:00:26]:   ServerPort: 10999
[00:00:26]:   SteamAuthPort: 8766
[00:00:26]:   SteamMasterServerPort: 27016
[00:00:26]:   ClanID: false
[00:00:26]:   ClanOnly: false
[00:00:26]:   ClanAdmin: false
[00:00:26]:   LanOnly: false
[00:00:26]:   FriendsOnly: false
[00:00:26]:   EnableAutosaver: true
[00:00:26]:   EncodeUserPath: true
[00:00:26]:   PVP: false
[00:00:26]:   MaxPlayers: 6
[00:00:26]:   GameMode: survival
[00:00:26]:   OverridenDNS: 
[00:00:26]:   PauseWhenEmpty: true
[00:00:26]:   IdleTimeout: 1800s
[00:00:26]:   VoteEnabled: false
[00:00:26]:   InternetBroadcasting: true
[00:00:26]:   Intent: social
[00:00:26]: [Warning] Could not confirm port 10999 is open in the firewall. 
[00:00:26]: Could not load mod_config_data/modconfiguration_deneme karakter    
[00:00:26]: Online Server Started on port: 10999
[00:00:27]: Collecting garbage...
[00:00:27]: lua_gc took 0.03 seconds
[00:00:27]: ~ShardLuaProxy()
[00:00:27]: ~cEventLeaderboardProxy()
[00:00:27]: ~ItemServerLuaProxy()
[00:00:27]: ~InventoryLuaProxy()
[00:00:27]: ~NetworkLuaProxy()
[00:00:27]: ~SimLuaProxy()
[00:00:27]: Cancelling LuaQueryCallback handle [11]
[00:00:27]: ModWorkshop::CancelDownloads clearing all unfinished downloads
[00:00:27]: lua_close took 0.04 seconds
[00:00:27]: ReleaseAll
[00:00:27]: ReleaseAll Finished
[00:00:27]: cGame::StartPlaying
[00:00:27]: LOADING LUA
[00:00:27]: DoLuaFile scripts/main.lua
[00:00:27]: DoLuaFile loading buffer scripts/main.lua
[00:00:27]:   taskgrouplist:    default    Together    
[00:00:27]:   taskgrouplist:    classic    Classic    
[00:00:27]:   taskgrouplist:    cave_default    Underground    
[00:00:27]:   taskgrouplist:    lavaarena_taskset    The Forge    
[00:00:27]:   taskgrouplist:    quagmire_taskset    The Gorge    
[00:00:27]: running main.lua
    
[00:00:27]: loaded modindex    
[00:00:27]: ModIndex: Beginning normal load sequence.
    
[00:00:27]: ModIndex:GetModsToLoad inserting moddir,     deneme karakter    
[00:00:27]: Could not load mod_config_data/modconfiguration_deneme karakter    
[00:00:27]: Loading mod: deneme karakter (Extended Sample Character) Version:1.2.5    
[00:00:27]: Mod: deneme karakter (Extended Sample Character)    Loading modworldgenmain.lua    
[00:00:27]: Mod: deneme karakter (Extended Sample Character)      Mod had no modworldgenmain.lua. Skipping.    
[00:00:27]: Mod: deneme karakter (Extended Sample Character)    Loading modmain.lua    
[00:00:27]: Event data unavailable: lavaarena_event_server/lavaarena_achievement_quest_defs
[00:00:27]: LOADING LUA SUCCESS
[00:00:27]: PlayerDeaths loaded morgue    5606    
[00:00:27]: PlayerHistory loaded player_history (v2) len:219    
[00:00:27]: ServerPreferences loaded server_preferences    2    
[00:00:27]: bloom_enabled    true    
[00:00:27]: loaded saveindex    
[00:00:27]: OnFilesLoaded()    
[00:00:27]: OnUpdatePurchaseStateComplete    
[00:00:27]: Loading world: session/726E76F9AB3E8C16/0000000002    
[00:00:27]: Save file is at version 5.031    
[00:00:27]: Klump load on boot started.    
[00:00:27]: Klump files loaded:     0    
[00:00:27]:     Unload FE    
[00:00:27]:     Unload FE done    
[00:00:28]: Mod: deneme karakter (Extended Sample Character)    Registering prefabs    
[00:00:28]: Mod: deneme karakter (Extended Sample Character)      Registering prefab file: prefabs/esctemplate    
[00:00:28]: error calling LoadPrefabFile in mod deneme karakter (Extended Sample Character): 
[string "scripts/mainfunctions.lua"]:150: Error loading file prefabs/esctemplate
[string "../mods/deneme karakter/scripts/prefabs/esctemplate.lua"]:46: 'then' expected near '='
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(150,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(161,1)
        scripts/mods.lua(603,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(278,1) in function 'LoadAssets'
        scripts/gamelogic.lua(911,1) in function 'cb'
        scripts/saveindex.lua(312,1) in function 'OnLoadSaveDataFile'
        scripts/saveindex.lua(327,1)
        =[C] in function 'GetPersistentStringInClusterSlot'
    ...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(278,1) in function 'Load'
        scripts/gamelogic.lua(1117,1) in function 'callback'
        scripts/playerprofile.lua(997,1) in function 'Set'
        scripts/playerprofile.lua(852,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(850,1) in function 'Load'
        scripts/gamelogic.lua(1116,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(940,1)    
[00:00:28]: Disabling deneme karakter (Extended Sample Character) because it had an error.    
[00:00:28]: [string "scripts/mainfunctions.lua"]:150: Error loading file prefabs/esctemplate
[string "../mods/deneme karakter/scripts/prefabs/esctemplate.lua"]:46: 'then' expected near '='
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(150,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(161,1)
        scripts/mods.lua(603,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(278,1) in function 'LoadAssets'
        scripts/gamelogic.lua(911,1) in function 'cb'
        scripts/saveindex.lua(312,1) in function 'OnLoadSaveDataFile'
        scripts/saveindex.lua(327,1)
        =[C] in function 'GetPersistentStringInClusterSlot'
    ...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(278,1) in function 'Load'
        scripts/gamelogic.lua(1117,1) in function 'callback'
        scripts/playerprofile.lua(997,1) in function 'Set'
        scripts/playerprofile.lua(852,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(850,1) in function 'Load'
        scripts/gamelogic.lua(1116,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(940,1)
[00:00:28]: [string "scripts/mainfunctions.lua"]:150: Error loading file prefabs/esctemplate
[string "../mods/deneme karakter/scripts/prefabs/esctemplate.lua"]:46: 'then' expected near '='
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(150,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(161,1)
        scripts/mods.lua(603,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(278,1) in function 'LoadAssets'
        scripts/gamelogic.lua(911,1) in function 'cb'
        scripts/saveindex.lua(312,1) in function 'OnLoadSaveDataFile'
        scripts/saveindex.lua(327,1)
        =[C] in function 'GetPersistentStringInClusterSlot'
    ...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(278,1) in function 'Load'
        scripts/gamelogic.lua(1117,1) in function 'callback'
        scripts/playerprofile.lua(997,1) in function 'Set'
        scripts/playerprofile.lua(852,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(850,1) in function 'Load'
        scripts/gamelogic.lua(1116,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(940,1)    
[00:00:28]: Mod: deneme karakter (Extended Sample Character)      Registering prefab file: prefabs/esctemplate_none    
[00:00:28]: Mod: deneme karakter (Extended Sample Character)        esctemplate_none    
[00:00:28]: Mod: deneme karakter (Extended Sample Character)      Registering default mod prefab    
[00:00:28]: Warning: Widget:SetFocusFromChild is happening on a widget outside of the screen/widget hierachy. This will cause focus moves to fail. Is     ScriptErrorWidget    not a screen?    
[00:00:28]: stack traceback:
    scripts/widgets/widget.lua:605 in (method) SetFocusFromChild (Lua) <602-627>
    scripts/widgets/widget.lua:656 in (method) SetFocus (Lua) <629-665>
    scripts/widgets/scripterrorwidget.lua:107 in (method) OnUpdate (Lua) <102-119>
    scripts/update.lua:90 in () ? (Lua) <33-129>
    =[C]:-1 in (method) RenderOneFrame (C) <-1--1>
    scripts/gamelogic.lua:133 in (upvalue) KeepAlive (Lua) <127-139>
    scripts/gamelogic.lua:280 in (upvalue) LoadAssets (Lua) <159-309>
    scripts/gamelogic.lua:911 in (local) cb (Lua) <906-913>
    scripts/saveindex.lua:312 in (upvalue) OnLoadSaveDataFile (Lua) <294-313>
    scripts/saveindex.lua:327 in () ? (Lua) <326-328>
    =[C]:-1 in (method) GetPersistentStringInClusterSlot (C) <-1--1>
    scripts/saveindex.lua:326 in (method) GetSaveData (Lua) <321-340>
    ...
    scripts/saveindex.lua:280 in () ? (Lua) <279-281>
    =[C]:-1 in (method) GetPersistentString (C) <-1--1>
    scripts/saveindex.lua:278 in (method) Load (Lua) <275-282>
    scripts/gamelogic.lua:1117 in (local) callback (Lua) <1116-1118>
    scripts/playerprofile.lua:997 in (method) Set (Lua) <864-1000>
    scripts/playerprofile.lua:852 in () ? (Lua) <851-853>
    =[C]:-1 in (method) GetPersistentString (C) <-1--1>
    scripts/playerprofile.lua:850 in (method) Load (Lua) <849-854>
    scripts/gamelogic.lua:1116 in () ? (main) <0-0>
    =[C]:-1 in (global) require (C) <-1--1>    
[00:00:28]:     LOAD BE    
[00:00:31]:     LOAD BE: done    
[00:00:31]: Begin Session: 726E76F9AB3E8C16
[00:00:31]: saving to server_temp/server_save    
[00:00:31]: MiniMapComponent::AddAtlas( minimap/minimap_data.xml )
[00:00:31]: MiniMapComponent::AddAtlas( ../mods/deneme karakter/images/map_icons/esctemplate.xml )
[00:00:31]: Loading 17 new character(s)    
[00:00:31]: Could not preload undefined prefab (esctemplate)
[00:00:31]: Total 17 character(s) loaded    
[00:00:32]: Loading Nav Grid    
[00:00:32]: World generated on version 387834, using seed: 1577346533    
[00:00:36]: Reconstructing topology    
[00:00:36]:     ...Sorting points    
[00:00:36]:     ...Sorting edges    
[00:00:36]:     ...Connecting nodes    
[00:00:36]:     ...Validating connections    
[00:00:36]:     ...Housekeeping    
[00:00:36]:     ...Done!    
[00:00:36]: 1 uploads added to server. From server_temp
[00:00:36]: Telling Client our new session identifier: 726E76F9AB3E8C16
[00:00:36]: Check for write access: TRUE
[00:00:36]: Check for read access: TRUE
[00:00:36]: ModIndex: Load sequence finished successfully.    
[00:00:36]: Reset() returning
[00:00:37]: Best lobby region is aws/EU (ping 65)
[00:00:37]: Registering master server in EU lobby
[00:00:47]: Registering master server in EU lobby
 

here is the 46th line

if inst.level = 0 then

im not

Link to comment
Share on other sites

Well as I am too dumb to understand coding, I'll actually try to contact you about something.

You see I've been trying for ages to actually implement swimming on one of my characters. Asked the community, looked through tutorials, files, scripts, and well it didn't really help. I've been searching, and I found this little piece of code.

 

 if data.amphibious then
        inst:AddComponent("embarker")
        inst.components.embarker.embark_speed = inst.components.locomotor.runspeed
        inst.components.embarker.antic = true

        inst.components.locomotor:SetAllowPlatformHopping(true)

        inst:AddComponent("amphibiouscreature")
        inst.components.amphibiouscreature:SetBanks(bank, bank.."_water")
        inst.components.amphibiouscreature:SetEnterWaterFn(
            function(inst)
                inst.landspeed = inst.components.locomotor.runspeed
                inst.components.locomotor.runspeed = TUNING.HOUND_SWIM_SPEED
                inst.hop_distance = inst.components.locomotor.hop_distance
                inst.components.locomotor.hop_distance = 4
            end)            
        inst.components.amphibiouscreature:SetExitWaterFn(
            function(inst)
                if inst.landspeed then
                    inst.components.locomotor.runspeed = inst.landspeed 
                end
                if inst.hop_distance then
                    inst.components.locomotor.hop_distance = inst.hop_distance
                end
            end)

        inst.components.locomotor.pathcaps = { allowocean = true }
    end

 

This is a piece of code from the hound.lua script page. I assume this is the thing that allows them to swim in game, and so I decided to try to use this coding on my character so I can make her swim, but of course I don't know how to do that. Would you be so kind and help me please? We'll be able to do something innovatory in the community if yes.

Link to comment
Share on other sites

On 12/23/2014 at 1:28 AM, rezecib said:

Component Actions

Hidden Content

For custom component actions:

Is it possible to change only prompt of an existing action but only if it relates to specific item? Let's say there is "Eat" prompt on a custom food given by default component, can it be changed to "Devour" when interacting only with this custom food?

Is there an action priority? Let's say there is an item with a container component, that makes it have "Store" prompt when hovering over it. When custom action is added, does the "Store" action no longer pop up when hovering? Is it displayed on ALT press? What if there are more than 2 possible actions, how are they prompted all at the same time?

Edited by Parusoid
Link to comment
Share on other sites

On 5/26/2023 at 6:35 AM, Parusoid said:

For custom component actions:

Is it possible to change only prompt of an existing action but only if it relates to specific item? Let's say there is "Eat" prompt on a custom food given by default component, can it be changed to "Devour" when interacting only with this custom food?

Is there an action priority? Let's say there is an item with a container component, that makes it have "Store" prompt when hovering over it. When custom action is added, does the "Store" action no longer pop up when hovering? Is it displayed on ALT press? What if there are more than 2 possible actions, how are they prompted all at the same time?

Actions do have a strfn that you can define. However to do this for an existing action you will have to monkeypatch the existing action's strfn. This doesn't really relate to the componentaction part of this (which is just about deciding whether an action can be shown to be performed).

And yes there is action priority, also on the action definition side rather than the componentaction side. Look at scripts/actions.lua for usage. Only two actions can be displayed, but the logic is a bit complicated. You can look at the component PlayerActionPicker:DoGetMouseActions for details.

  • Thanks 1
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...