no, you could make your dll an asi and have asi loader load that too but that's of course gonna load it as the program starts, not whenever during runtime if that's what you're after
can you be so kind and explain why i can't use loops for spawn? I am noob in .lua and have some relative xp in c# and python
-- Initialize module table safely BirdSpawner = BirdSpawner or {}
function BirdSpawner.SpawnBirds() if not g_localActor then return end
local pos = g_localActor:GetWorldPos()
local entityParams = { class = "Birds", position = pos, properties = { Options = { bActivate = true, bFollowPlayer = true, }, Movement = { HeightMin = pos.z, HeightMax = pos.z + 60 } } }
local birdEntity = System.SpawnEntity(entityParams) local birdEntity = System.SpawnEntity(entityParams) local birdEntity = System.SpawnEntity(entityParams) local birdEntity = System.SpawnEntity(entityParams) local birdEntity = System.SpawnEntity(entityParams) end
System.AddCCommand("spawn_birds", "BirdSpawner.SpawnBirds()", "Spawns birds that follow player")
this one is working. but if i try to make same with for loop it is crashing immediately.... can you advice please where to look or to learn. to many crashes and i do not know how to debug why
that is really quite odd, im not sure why it would behave that way. does it behave the same if you load that Lua code into a .pak mod and try to run the command that way? i wouldn't imagine it's unique to this way of executing the code but maybe, I have encountered issues with Script.SetTimer not working correctly via this executor but it works properly if loaded from a mod as usual. edit: yeah strangely it does work if you load that in via a mod and not this. still not sure why but I'll see if I can figure it out and fix it, maybe there's more than 1 Lua state and i'm using the wrong one
Looks promising. How much can we expect to mod the game with this? I have experience with programing, but not with modding and would like to try some things like adding new interactions or animations. Do you expect to release some kind of documentation?
it's just the existing cryengine Lua scripting that the game uses. this is just for making development of mods easier by letting you easily run Lua at runtime instead of having to repack your mod and restart your game every time you want to make a script change.
16 comments
```
Sending script paths to game...
Finished sending script paths
[Output]: Files queued for execution
```
-- Initialize module table safely
BirdSpawner = BirdSpawner or {}
function BirdSpawner.SpawnBirds()
if not g_localActor then return end
local pos = g_localActor:GetWorldPos()
local entityParams = {
class = "Birds",
position = pos,
properties = {
Options = {
bActivate = true,
bFollowPlayer = true,
},
Movement = {
HeightMin = pos.z,
HeightMax = pos.z + 60
}
}
}
local birdEntity = System.SpawnEntity(entityParams)
local birdEntity = System.SpawnEntity(entityParams)
local birdEntity = System.SpawnEntity(entityParams)
local birdEntity = System.SpawnEntity(entityParams)
local birdEntity = System.SpawnEntity(entityParams)
end
System.AddCCommand("spawn_birds", "BirdSpawner.SpawnBirds()", "Spawns birds that follow player")
this one is working. but if i try to make same with for loop it is crashing immediately.... can you advice please where to look or to learn. to many crashes and i do not know how to debug why
BirdSpawner = BirdSpawner or {}
function BirdSpawner.SpawnBirds()
if not g_localActor then return end
local pos = g_localActor:GetWorldPos()
local entityParams = {
class = "Birds",
position = pos,
properties = {
Options = {
bActivate = true,
bFollowPlayer = true,
},
Movement = {
HeightMin = pos.z + 5,
HeightMax = pos.z + 60
}
}
}
for i = 1, 5 do
System.SpawnEntity(entityParams)
end
end
System.AddCCommand("spawn_birds", "BirdSpawner.SpawnBirds()", "XSpawns birds that follow player")
CRASH: Entity can't be created. Too many entities. Save your work, expect crash.
lol... why?
edit:
yeah strangely it does work if you load that in via a mod and not this. still not sure why but I'll see if I can figure it out and fix it, maybe there's more than 1 Lua state and i'm using the wrong one
I have a question though, where can I see the methods for `soul` or `entity`?
some links for KCD1 documentation:
https://warhorse.nexusmods.com/
https://wiki.fireundubh.com/kingdomcome