Jump to content

Search the Community

Showing results for tags 'lua'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Models
    • Animals
    • Barriers
    • Characters
    • Containers
    • Environments
    • Furniture
    • Props
    • Rocks
    • Vegetation
    • Vehicles
    • Weapons
  • Materials
    • Brick
    • Cartoon
    • Decals
    • Dirt
    • Grass
    • Industrial
    • Medieval
    • Metal
    • Plastic
    • Plaster
    • Rock
    • SciFi
    • Sky
    • Signs
    • Tile
    • Stone
    • Walls
    • Wood
  • Plugins
  • Scripts
    • GUI
    • Object
    • Utilities
  • Shaders
    • Post-Processing Effects
    • Surface
  • Sounds
    • Ambience
    • Effects
    • Music
  • Tools
  • BATTLE LEAGUE's Assets
  • BATTLE LEAGUE's Mods

Blogs

There are no results to display.

There are no results to display.

Forums

  • Leadwerks
    • Technical Assistance
    • General Discussion
    • Programming
    • Game Art
    • Suggestion Box
    • Bug Reports
  • Platforms
    • Windows
    • Mac
    • Linux
  • Community
    • Showcase
    • Promotion
    • Off-topic
  • BATTLE LEAGUE's Topics
  • Vec-Tec's Releases
  • Vec-Tec's Topics
  • Forth's Development
  • Forth's Game design
  • Forth's Graphics
  • Forth's Documentation
  • Forth's TODO
  • Forth's IMPORTANT
  • Forth's Screenshots
  • The uncertain world's Game Design
  • The uncertain world's Programming
  • The uncertain world's TODO
  • The uncertain world's Graphics
  • The uncertain world's Screenshots
  • Muerte's Discussion

Categories

  • Records
  • Entity
  • Command Reference
  • Vec3
  • Vec4
  • Script Reference
  • Shader
  • Index
  • Material
  • Object
  • Buffer
  • Asset
  • Font
  • Shape
  • Sound
  • Texture
  • App
  • Context
  • Model
  • Light
  • DirectionalLight
  • PointLight
  • SpotLight
  • Attractor
  • Camera
  • Emitter
  • Listener
  • Pivot
  • Bone
  • Sprite
  • FileSystem
  • Key
  • Source
  • Surface
  • Math
  • AABB
  • dVec3
  • Mat3
  • Mat4
  • Plane
  • Transform
  • Vec2
  • Vec3
  • Vec4
  • Mutex
  • Prefab
  • PickInfo
  • Map
  • Stream
  • System
  • Thread
  • Time
  • Window
  • World
  • Driver
  • SoundDriver
  • GraphicsDriver
  • PhysicsDriver
  • OpenGL2GraphicsDriver
  • OpenGLES2GraphicsDriver
  • OpenALSoundDriver
  • NewtonDynamicsPhysicsDriver
  • Draw
  • Color
  • Blend
  • Joint
  • Debug
  • Component
  • Steamworks
  • LensFlare
  • Vehicle
  • Decal
  • Quat
  • Leaderboard
  • Probe
  • Analytics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


Interests

Found 362 results

  1. I have a model of a sphere with a collision mesh imported into Leadwerks and I wanted to control how 'bouncy' it was. Did a google search and came across the functions SetElasticity and SetSoftness (seems like they were called SetBodyElasticity and SetBodySoftness in older versions). The current docs don't mention these functions, or at least not on Entity, and when I try to call them they obviously don't exist. Does anyone know if they've been renamed, not available to Lua, removed for some reason? Just a few things I found: http://www.leadwerks.com/werkspace/topic/2546-balls/ (This has a Lua script that calls SetElasticity which makes me think it did exist at some point) http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/bodies/setbodyelasticity-r58 (Old docs) http://www.leadwerks.com/werkspace/topic/4683-problem-with-collision-callback/ (C++ but calls SetElasticity)
  2. I just tried using Math:Lerp for the first time and get the error: attempt to call method 'Lerp' (a nil value) This is how I am calling it, I have also tried Math.Lerp and just Lerp, they don't work either. local R = Math:Lerp(self.DayAmbient.x,self.NightAmbient.x,Intense) As as a test I did I for k,v in pairs(Math) do print(k,v) end and I couldn't see Lerp anywhere in the output I understand how Lerp works and can write the function myself to get around this, I just didn't know if the documentation is wrong or I am having some kind of bug or what.
  3. Based on this forum post where an error was occurring during switching of maps: http://www.leadwerks.com/werkspace/topic/10459-load-map-error/#entry76909 It appears that using Release() on a sound that has been played will cause the OpenAl error. If you release the sound before being played, then no issues. example script to show the problem: function App:Start() self.window=Window:Create("Sound Bug Example",0,0,200,150,Window.Titlebar+Window.Center) self.context=Context:Create(self.window) self.world=World:Create() self.camera = Camera:Create() --import "Scripts/Functions/ReleaseTableObjects.lua" sound = {} sound[1] = Sound:Load("Sound/Footsteps/Concrete/step1.wav") sound[2] = Sound:Load("Sound/Footsteps/Concrete/step2.wav") return true end function App:Loop() if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end if self.window:KeyHit(Key.Space) then local r = math.random(1,2) if sound~=nil then if sound[r]~=nil then sound[r]:Play() end end end if self.window:KeyHit(Key.Up) then if sound~=nil then --ReleaseTableObjects(sound) sound[1]:Release() sound[2]:Release() sound = nil end end Time:Update() self.world:Update() self.world:Render() self.context:Sync() return true end If you press the Up arrow key prior to playing the sounds then there are no issues. If you hit the Space key and play a sound then try to release the sound it will cause the error. Since the fpsplayer script uses the 'ReleasetableObjects' function, it causes this same error when switching maps and the player has been released.
  4. I'm trying to make a Level of detail system, and i found that I can not hide children from a parent. I would like to suggest the ability to hide a child Ie: child:Hide() This would hide the child and leave the childs' children with the same properties (i hide a child and it's children is still visible.). Also the ability to hide all of a childs children ie: child:Hide(True). This would hide a child and all it's children, but leave its' parents alone. My experiments with children Attach this to the parent: function Script:Start() self.entity:Hide() rotation = Vec3(0,0,45) print(self.entity:CountChildren()) local child = self.entity:GetChild(0) print(child:CountChildren()) print(child:GetPosition():ToString()) local child1 = child:GetChild(0) print(child1:CountChildren()) print(child1:GetPosition():ToString()) child1:SetRotation(rotation) -- to check if we are actually manipulating the child of a child child1:Hide() -- the rotated csg should diassapear end Results:
  5. So I run into this issue quite often. I create a particle emitter and it won't start playing(or at least won't be shown playing) until I look at the particle entity. For example if I place a 'rain' emitter above my players head(out of vision unless you look directly upward) it will not show until I look directly at it. Is there anyway I can make particle emitters visible without looking at them before hand? --edit-- also if you have a particle emitter following your character close to the camera (in my case a torch with a fire emitter) if you move to fast and the particles end up behind your camera (because they aren't spawning fast enough) they will stop showing until you look back to where they stopped showing. So what happens is - 1 you have a torch with fire emitter, 2 you start to run, 3 the fire emitter particles don't spawn fast enough to keep up and end up behind the camera 4 the fire emitter particles stop spawning 5 if you keep running in the same direction the fire emitter will never show itself again. if you turn back to where the fire emitter stopped showing it returns to its position and shows itself again. let me know if there is a workaround please, it would be much appreciated! Not sure if this is really a problem but I decided to make a video showing the 'issue'. https://www.youtube.com/watch?v=4__EL9S4M4s
  6. I have been reading a lot about Lua and specifically the garbage collector recently and learned a few things. Such as - source- http://www.lua.org/manual/5.1/manual.html I have been testing my game for memory issues for weeks now and I am starting to think that the garbage collector just isn't fast enough to keep up with the amount of things I have going on. I noticed that since my memory usage rises to quick that the collector waits for my total memory to double before starting the next cycle and things start to get out of hand from there. I know that in most cases the garbage collector should be able to handle by itself but in my case it is not. I do not have any memory leaks in my code. I know this because if I run the garbage collector every frame my memory usage stays consistent. So could it be a better option to control the Lua Garbage Collector manually in my case? Edit ---- I have tested using collectgarbage('setpause',100) in my App Start() function. My game lasted about 2 hours longer than usual!! I normally test my games memory usage by going into release mode and standing completely still until my game crashes(It used to crash after about an hour); this time, well after I reached my normal 'crash point' I started running around doing crazy things to see if I would run out of memory but my game crashed due to an unknown error (I wasn't in debug mode) which I believe to be an issue in my script(not memory related)!!! I found multiple bugs I haven't noticed in my game before as well which I will fix and then I will test this more thoroughly. Also when tested in debug mode I noticed that my memory usage stayed consistent when before it used to constantly increase!
  7. I have a bunch of models that I loaded in the Leadwerks editor. Lets use a broken wall with holes in it for an example to avoid the "just a csg" solution. I want to be able to apply a different texture to a single wall, lets say instead of red bricks I want to use cinder blocks. Is there a way to force the editor to load a non instanced model?
  8. When I walk on terrain with a Character Controller my memory usage consistently goes up. I tested this by using the Terrain map in the MyGame project with a Character Controller using the FPSplayer.script. I also put a check for memory usage and collectgarbage() in my main App Loop. Further details can be found in the video I made-- https://www.youtube.com/watch?v=Bj0brR8_7eQ&feature=youtu.be
  9. Hi when I build a Nav mesh in the editor or through my scripts it doesn't reach the ends of my terrain(using Leadwerks terrain). What can I do? Picture--
  10. As a user of a multi-monitor setup, I was amazed at the number of AAA games that simply do not take into account the possibility that their game may be played on one monitor of a multi-monitor system. After rage quitting a gaming session because I kept dropping back to the desktop because my mouse wandered outside the game window, I decided to write some brain-dead simple lua code to trap the mouse in the game without interfering with any code. -- trap mouse start if (self.trapmouse == true) then if (self.window:GetMousePosition().x<0) then self.window:SetMousePosition(0,self.window:GetMousePosition().y) end if (self.window:GetMousePosition().x>self.context:GetWidth()) then self.window:SetMousePosition(self.context:GetWidth(),self.window:GetMousePosition().y) end if (self.window:GetMousePosition().y<0) then self.window:SetMousePosition(self.window:GetMousePosition().x,0) end if (self.window:GetMousePosition().y>self.context:GetHeight()) then self.window:SetMousePosition(self.window:GetMousePosition().x,self.context:GetHeight()) end end -- trap mouse end I placed this in app.lua before the render, but it can be placed anywhere in your code as long as it is placed AFTER any mouse handling routines. The code is inabled by setting self.trapmouse to true.
  11. For some reason there are dots on the landscape textures. Is there a fix to this? www.youtube.com/embed/KyVyzN9EiGQ SOLUTION:
  12. To prevent non Leadwerks Engine specific/Related entries from my Blog being automatically published here via the Blog Feed, I have removed that functionality, and will simply add a new entry title and link here for all Leadwerks Engine specific/Related entries. Leadwerks Related Blog Entry. Leadwerks 3.2 Indie : Proof Of Concepts & Several Tests.
  13. Hello, I do work with Glowshaders in my Level. Is there a possibility, to make the Glow-Light fade in and fade out (Only texture 5)? Like a blinking Light. Great work by shadmar ... Glow Shader: http://www.leadwerks.com/werkspace/files/file/473-glowmapshaders-leadwerks31/ Might someone have a hint to me for that purpose? C.U. R.E.Z.
  14. I mad a motel room and made the entire room a child of a pivot. When I add a script to one of the csg's the physics and sometimes the light rendering gets misplaced. Here is a Video of it's creation and it happening. :
  15. Hello i recently bought leadwerks on steam to create a game. At the moment i am doing random things in leadwerks to see how everything works. At this point i am trying to get collisions right. I downloaded some content from the steam workshop including this warehouse. How can i get the collisions right? When the player walks against the wall he stops when he walks up the stairs the Y slowly increases. I googled around and found some c++ scripts but i want to create this in lua. I recently started learning lua, so i am not an expert. I hope someone can help me with this thanks!
  16. Hello, I looked around and could not figure it out: How to create a waypoint for moving platform I ran the demo-level moving platforms, but could not figure out, how to set up waypoint. In my Level I want to have a moving platform for an elevator also. Hope, that this question might not sound a bit of stupid, since I could not get a waypoint set up? I use LE 3.2 Indie Edition. Might someone tell me, how I could set such a waypoint up? That would be great C.U. R.E.Z.
  17. Based on : https://github.com/ING1337/CellGrid 1. Create a script called Scripts/class.lua function class(base) local c = {} if type(base) == "table" then for key,value in pairs(base) do c[key] = value end c._base = base end c.__index = c local mt = {} mt.__call = function(class_table, ...) local self = {} setmetatable(self, c) if class_table.init then class_table.init(self, ...) else if base and base.init then base.init(self, ...) end end return self end c.is_a = function(self, klass) local m = getmetatable(self) while m do if m == klass then return true end m = m._base end return false end setmetatable(c, mt) return c end 2. Create a script called Scripts/grid.lua require "Scripts/class" -- LUA CellGrid by ING -- allows massive 3d entity management CellGrid = class() function CellGrid:init(cellSize, offsetX, offsetY) self.grid = {} self.size = cellSize or 100 self.offsetX = offsetX or -15000 self.offsetY = offsetY or -15000 end -- ################################################################################################################################# function CellGrid:AddEntity(entity, position, radius) range = radius and (math.ceil(radius / self.size)) or 0 x = math.max(1, math.floor((position.x - self.offsetX) / self.size - range)) y = math.max(1, math.floor((position.z - self.offsetY) / self.size - range)) for i = x, range * 2 + x, 1 do if self.grid == nil then self.grid = {} end for j = y, range * 2 + y, 1 do if self.grid[j] == nil then self.grid[j] = {} end table.insert(self.grid[j], entity) end end end function CellGrid:RemoveEntity(entity, position, radius) range = radius and (math.ceil(radius / self.size)) or 0 x = math.max(1, math.floor((position.x - self.offsetX) / self.size - range)) y = math.max(1, math.floor((position.z - self.offsetY) / self.size - range)) for i = x, range * 2 + x, 1 do for j = y, range * 2 + y, 1 do for k, comp in ipairs(self.grid[j]) do if comp == entity then table.remove(self.grid[j], k) break end end end end end -- ################################################################################################################################# function CellGrid:GetCell(position) x = math.max(1, math.floor((position.x - self.offsetX) / self.size)) y = math.max(1, math.floor((position.z - self.offsetY) / self.size)) if not self.grid[x] then return nil end return self.grid[x][y] end 3. Example usage for putting in entities : Make a camara/player/etc attached script : require "Scripts/grid" function Script:Start() --init the grid self.cell = CellGrid() self.cell:init(50) -- sets size of one grid cell -- place some entities around the xz plane entities = { } for x=0,20000,1 do entities[x] = some.loaded.entity:Instance() entities[x]:SetPosition(Math:Random(-500,500),0,SetPosition(Math:Random(-500,500)) entities[x]:Hide() end --add entities to the grid for i,j in pairs(entities) local position = { x = j:GetPosition().x, z = j:GetPosition().z } self.cell:AddEntity(j, position, 1) end end function Script:UpdateWorld() -- get player/camera position local position = { x = self.entity:GetParent():GetPosition().x, --assuming parent is player or camera z = self.entity:GetParent():GetPosition().z --assuming parent is player or camera } -- fetch entites and show them within cell size of position local grid = self.cell:GetCell(position) if grid ~=nil then for k,v in pairs(grid) do if v~=nil then v:Show() end end end end
  18. Hello, I do reffer to the following random files: http://www.leadwerks.com/werkspace/files/download/420-random-output-scripts/ When I do use f.e. the random4.lua script, I get the following Script Error: attempt to index global 'os' (a nil value) Line 2 math.randomseed(os.time()) Might anyone know help to this problem? That would be great C.U. R.E.Z.
  19. Hello, I am working on a level, where different messages should be played in the backround. Do You know a scrit in Lua, that does this: randomise different sounds in the Backround? That would be really neat Does anyone knew help for this purpose? Have a nice day, C.U. R.E.Z.
  20. So I have a player and a weapon. I pickup the weapon by parenting it to my entity. I drop the weapon by calling weaponentity:SetParent(nil) and then it drops like it should. My problem is that the weapons collision shape doesn't change back to normal when it drops. I imagine that it keeps the shape it inherited from its parent. It is hard to describe so I added a video to show what's going on. If anyone knows what I can do to fix this let me know. I have tried to change the weapons shape back to its original shape when it is dropped but that hasn't worked. --video https://www.youtube.com/watch?v=woqWma6JJUQ
  21. When an entities View Range is set to Far,Medium, or Near they will not have any shadows if I am using a Directional Light. If I have a spot or point light they will have shadows regardless of view range. Video -- https://www.youtube.com/watch?v=ppHJhwTrsD8 --edit I tested this on a new a map with the same pine tree model seen in the video but in my new map I can see the entities shadow regardless of its view range setting. Maybe my map is just bugged?
  22. Ever since the texture locking update I will occasionally be locked out of editing my entities general values. Can be seen near the end of this video around 3:20 -- https://www.youtube.com/watch?v=ppHJhwTrsD8
  23. Just started getting this error after closing and reopening my project I am working on. Now every time I open the editor this error shows up. Video-- https://www.youtube.com/watch?v=7IPqD4OchVE&feature=youtu.be Microsoft Windows 7 Home Premium Intel® Core™ i5-3230M CPU @ 2.60GHz GeForce GT 630M --edit After deleting the mdl of the last object I was working with everything has gone back to normal and I no longer get this error. I think this is connected to changing an entites script parameters (like Script.MyEntity = nil --entity "MyEntity") because that was the last thing I was doing before this error occurred.
  24. Hey everyone I have been trying to make a LoD (Level of Detail) system lately but I am running into one big issue. Using world:ForEachEntityInAABB() or world:ForEachVisibleEntityDo() works to hide the entity but then I run into my issue. These functions will not return a Hidden entity. So how would I go about 'finding' a Hidden entity? I know I could give each entity a script and make them check for my player when they are hidden but that doesn't seem like the best way to go about doing this. Any other ideas are welcome.
  25. Hello, I recently started to use Leadwerks Indie Edition, but I've never used lua, or a scripting language (I've only programmed in c++, c#, java), so I need some tutorial that explains the basics, but those who I found are all old. So I was wondering if anyone knew of a tutorial lua updated that works with Leadwerks 3.1 Thanks
×
×
  • Create New...