Start

End

Group

Location

Interests

Hello everyone, I just playing around leadwerks c++ to learn engine. I've created a simple map with editor and save it under Maps folder.
Once I try to load that map through cpp code and give path parameter as "Maps/sm.map", leadwerks can not find the map. Because engine is trying to load file at "../LeadwerksEngine/Projects/Maps/sm.map"
It get fixed by adding project name to path as follows (Cube is project name) ../LeadwerksEngine/Projects/Cube/Maps/sm.map"
However even so engine loads the map, engine can not load textures and etc within the map. Engine gives errors to read files with path on ../LeadwerksEngine/Projects/Textures/sometexture.tex"
What did i make wrong? Could Anybody faced this problem help me?

Hello,
Because I made myself some thoughts about a saving mechanic for my current project, I searched the web and especially the Leadwerks site for how to save simple game data, like the players health or position. The only kind of useful thing I found which works for LUA was this: http://www.leadwerks.com/werkspace/topic/2103-save-data-to-lua-syntax-as-textcompressed/page__hl__save+data
and this:
http://www.leadwerks.com/werkspace/topic/1853-howto-using-lua-script-as-data-file/
I actually was able to create a data file and read it into my code with "dofile". However I didnt find out how to create/save a file with lua yet. I searched the Leadwerks API and found the Stream and FileSystem Class.
So I tried the following code:
function Script:Start()
local gamedata = FileSystem:WriteFile("Test.txt")
end
It didnt work, and I also dont know how it works. Where has the file been created? I searched my PC and the Projectsfolder but couldnt find such a file and I also dont get any kind of error message.
I guess this is completely wrong, but I was just playing around, because I don't have that much experience with Lua and Leadwerks. The file you can download in the first thread I posted ("TStoreData.lua") doesnt work anymore and I cant find where he saves data.
That you clearly undersand what I want. I would like to do something like this:
function Script:Start()
local gamedata = {}
gamedata.playerHealth = 100
gamedata.playerWeapon = "Sword"
gamedata.playerPos = Vec3(10, 100, 53)
FileSystem:WriteFile("gamedata.lua", gamedata)
end
This is just some code that you know what I mean. I know this doesnt work xD. So could you please help me out a little bit .
PS.: I kind of understood what AndyGFX wrote in his post, I just couldnt find anything how to save a file.

Created a script this morning to load a cylinder with an attached script, however the material does not seem to load for the cylinder, or a cone, shaped CSG. Spheres and boxes load without issue. Not really sure why the materials are not loading, but I am hoping someone could clear this up.
function Script:Use(entity)
local bottle = Model:Cylinder()
local material = Material:Load("Materials/Developer/bluegrid.mat")
bottle:SetMaterial(material)
bottle:SetScale(0.15,0.65,0.15)
bottle:SetPosition(-4.4,1.6,1.9)
local shape = Shape:Cylinder()
bottle:SetShape(shape)
bottle:SetMass(1)
bottle:SetScript("Scripts/Functions/PickupHealth.lua")
end

I'm slowly getting to grips with the game engine and seeing how far I can go with just LUA, so plenty of learning opportunities! I'm looking at how to implement all the functionality I need for an RPG and decided the latest bit was worth sharing. This allows you to control where on the map the player is positioned when the map is loaded.
I created TriggerChangeMapPos.lua which accepts a second optional parameter, a target object. If this is not specified then the saved player position is used as previously so this could be used as a drop in replacement for the original TriggerChangeMap.lua
I then updated App.lua so that it created an entity list on map load and then searched for the specified entity and copied its location to the players. Pivots are of course excellent for this kind of purpose.
The files are
TriggerChangeMapPos.lua
App.lua