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


  • 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


There are no results to display.

There are no results to display.


  • Leadwerks
    • Technical Assistance
    • General Discussion
    • Programming
    • Game Art
    • Suggestion Box
    • Bug Reports
  • Platforms
    • Windows
    • Linux
    • OSX
  • Community
    • Showcase
    • Promotion
    • Off-topic
  • Arena Shooter's Forum
  • BATTLE LEAGUE's Topics
  • Away from Home's Zone Script
  • Away from Home's General
  • Away from Home's Zone Rigging / Modeling
  • 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
  • Dark Age Mist's Videos

Product Groups

  • Leadwerks
  • Model Packs
  • Gear

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Found 363 results

  1. Platform: Windows. Downloads: FPS Player scenario (Preconfigured scenario ready to play Updated 08/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/LUA%20XBOX%20360%20controller%20FPS%20Template.rar Marble game ball (Preconfigured scenario ready to play Updated 03/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/Marblegame%20XBOX360%20controller%20template.rar Only DLL: (Updated 08/may/2015) https://dl.dropboxusercontent.com/u/107114506/Leadwerks/SDL2.dll%20and%20LuaGamePad.dll.zip Note: - You must have connected the XBOX 360 controller to work. - If you want put the code in you proyect, copy and paste the "LuaGamePad.dll" and "SDL2.dll" in your project folder. ----------------------------------------------------------------------------------------------------------------------------------- New update!! Data: 08/May2015 Working hard on my free time, I developed the LUA FPS XBOX 360 controller. What's new: - The movement is now analog (Left stick). - The view is now analog (Right stick). - The sprint is now analog (Right Trigger). - The sound of the steps are automatically adjusted to the speed of the player, also considers the sprint. It is fully preconfigured and is 100% functional, I've tested with the FPS Weapons Pack and works fine. If you find a bug please send me a report. Open the project and open the "07-AI and Events.map" The "FPSPlayer XBOX360 controller adapted.lua" is in the same folder that "FPSPlayer.lua" The empty template XBOX 360 controller is in the "Scrips / objects / XBOX 360 controller" folder. Controller mapping: ----------------------------------------------------------------------------------------------------------------------------------- Data: 03/May2015 Hello everyone! I work hard to create a Lua XBOX 360 controller template. (Based on the work of Skrakle). http://www.leadwerks.com/werkspace/topic/12476-lua-lib-game-controller-support/ Upgrade Author: Daniel0213 What's new: DRIVER: I have expanded the functions and recompile the driver. I added: - The right analog stick is now functional. - The left and right trigger just happen to be digital to be analog + digital. SCRIPT: - The script is not oriented to App.lua, now is oriented to the object you want to control, the player. (You must insert the script on the object that you want to control). - I created a template fully explained with comments. - I've written and adapted the formulas needed to converter from analog value to Leadwerks. Not any knowledge of analog sensors are required to write your own program. The code gives you automatically a converted analog value. - To change analog values you do not need to enter the code can be changed quickly from outside. - Reduced the death zone of analogue sensors, but can be changed easily. The instruction have a comment. - I separate all the buttons to make it easier to interpret the code. - You can choose externally the number of controller you want to use. ------------------------------------------------------------------------------------------------------------------------------------ I inserted the code in the template marble game, for a practical example of the operation display. Within the project it is the empty template XBOX controller and inserted into the ballplayer template for a practical example. (I have asked permission to Josh to do this) The empty template XBOX 360 controller is in the "Scrips / objects / XBOX 360 controller" folder. The "ballplayer" script has been modified to insert the sample code. Changed the name to "ballplayer Adapted to XBOX 360 controller." I'm using the Leadwerks version 3.5 Beta. ------------------------------------------------------------------------------------------------------------------------- HOW INSTALL: Very simple. 1. Unzip the .rar file. 2. Copy the "XBOX360controllertemplate" folder in your Leadwerks project folder. 3. Open leadwerks, go to "project manager" Push "import" enter to "XBOX360controllertemplate" folder and select the "XBOX 360 controller template.werk" file. 4. Select the project and press "OK". You must disable the sandbox lua libraries to work xbox 360 controller. ----------------------------------------------------------------------------------------------------------------------------------- How analog sensors work: Put the desired maximum values. In this case, when the left stick reaches its peak (up direction), the analog value which will be 15. Decreasing this value progressively until it reaches 0, when you reach the death zone. Don't touch the formula. ------------------------------------------------------------------------------------------------------------------ A bit of theory: The Analog converted formula. (Don't worry, you don't have to create, it is already written in the template code.) ENJOY!!! Future upgrades: - Add left and right vibration. - Linux support. Note: If you want put the code in you proyect, copy and paste the "LuaGamePad.dll" and "SDL2.dll" in your project folder.
  2. The lua example script used for Camera:GetProjectionMode() and Camera:SetProjectionMode() will cause an error since the variables 'Camera.Perspective' and 'Camera.Orthographic' are nil.
  3. Here's a new lib that i just finished that will allow game controller support for Lua fans! EDIT: Source: https://onedrive.live.com/redir?resid=1653f4923c37f970!278&authkey=!ABW8a3PdvzR_8cE&ithint=file%2czip Binaries (dll & so): https://onedrive.live.com/redir?resid=1653f4923c37f970!284&authkey=!AM0p2lTBH1mMSzk&ithint=file%2czip A lua example is provided, you can simply overwrite your existing App.lua with mine on a new test project. * Note: Lua sandbox must be disabled to use libs. Unfortunately i don't have linux installed so i couldn't compile it for that platform and I was able to compile it under Linux but i didn't get the chance to test it as i don't have the sdl2 binary libs. I included the full source should anyone want to re-compile it. Those that don't want to, simply copy LuaGamePad.dll file where your game executable is. You'll need to copy SDL2.DLL there as well, it's included. Tested with: - Logitech Rumblepad - Xbox 360 controller (XInput) Cheers!
  4. Hello, guys. I'm coming from Unity and having played around with the Steam demo of Leadwerks 3, I'm very curious about how you normally go about composing your game objects. In Unity, you create components (scripts) where each component adds some kind of functionality to any game object you add it to. I read on a blog about how the devs of Leadwerks want to compatrmentalize logic in small chunks (much like Unity does it I guess), but in the example maps I see no such thing. You have an object (say, a CSG primitive) and you can add a single Lua script to it. So how do I add multiple scripts to a single object where each script adds some functionality? From what I've seen, both FPSPlayer and AIMonster had their own movement, health, and damage handling implementations. A lot of the same (or very similar) code copied over. I find this worrying. Is there a modular way to do this? Note: I'd prefer to work in Lua. Coz Lua rocks!
  5. I'm looking to see if there is a way to detect if the game is running in the lua sandbox (example: in the game player) or as a standalone game? I would like to detect this so I can use IO to read and write settings in standalone and load the defaults with the sandbox enabled.
  6. Hi! So, I have been looking around for a way to make a controller or gamepad work in Leadwerks, but most of the posts here seems to be outdated... Have anyone actually got this working right? Thanks! Regards, KraXarN
  7. When you create a Lua project, there are two C++ files listed under the Source folder. Suppose I want to recompile these. Does anyone know how I would go about doing this with VS 2013 (like step-by-step)? (I'm new to C++ for Windows, I primarily worked with C++ on Linux )
  8. The thing is: how can I use a variable in one script stated on other script in lua? On example: I have 2 scripts: fps_gun.lua with a variable of ammo_count and a script App.lua with a variable named ammo_ammount. How can I use a ammo_count in App.lua(4example ammo_ammount=ammo_count) Thanks beforehand!
  9. While programming it became an increasing hassle to key track of what variable was a mouse button and what command was from the keyboard. So I wrote a function that will treat the mouse and the keyboard as the same input. -- This creates a function that is capable of handeling both keyboard and mouse input function InputHit(keycode) local window = Window:GetCurrent() local context=Context:GetCurrent() if keycode == Key.LButton then return window:MouseHit(Key.LButton) end if keycode == Key.RButton then return window:MouseHit(Key.RButton) end if keycode == Key.MButton then return window:MouseHit(Key.MButton) end return window:KeyHit(keycode) end function InputDown(keycode) local window = Window:GetCurrent() local context=Context:GetCurrent() if keycode == Key.LButton then return window:MouseDown(Key.LButton) end if keycode == Key.RButton then return window:MouseDown(Key.RButton) end if keycode == Key.MButton then return window:MouseDown(Key.MButton) end return window:KeyDown(keycode) end I'm still trying to figure out how to get the mouse wheel without interrupting anything
  10. This is my code: DeathTrigger.lua (attached to a box) Script.respawnPoint = "" --Entity "respawn point" function Script:Collision(entity, position, normal, speed) if(entity:GetKeyValue("name") == "Player") then spawnPos = self.respawnPoint:GetPosition() --entity:SetPosition(spawnPos) entity:Respawn(spawnPos) end end and FPSPlayer.lua (attached to the player) function Script:Respawn(spawnPos) self.entity:SetPosition(spawnPos) end When they collision I get this error: I have a Pivot indicating the respawn point: Line 65 is this from DeathTrigger.lua: entity:Respawn(spawnPos) From my point of view it should work. Any help? Edit: I just found it out. Turns out that this works: entity.script:Respawn(spawnPos) A little explanation would be welcome
  11. Hai! I have a function for changing the music track in my game and it works fine and all, but I also want it to get the total length of the track... Here is my function I'm currently using: function App:SwitchMusic(name) App.source:Stop() local sound = Sound:Load("Sound/BGM/" .. name .. ".wav") App.source:SetSound(sound) App.source:Play() end I tried adding something like App.tracklength = Math:Round(self.name:GetLength()) But it only returns in an error, since I guess it's trying to find a loaded sound with the name "name" and not from the variable. Do anyone have any idea how I can solve this? Thanks! KraXarN
  12. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/context/contextsetscale-r728 I wanted to scale my GUI using the setscale command and found some of the drawing commands do not function correctly. The drawrect command works properly. The plot command does not scale at all. The line command does not work properly in straight lines horizontally or vertically, but it does diagonally. Hear is code to test and explain: --This function will be called once when the program starts function App:Start() --Initialize Steamworks (optional) --Steamworks:Initialize() --Set the application title self.title="MyGame" --Create a window local windowstyle = window.Titlebar if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end self.window=Window:Create(self.title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle) --Create the graphics context self.context=Context:Create(self.window,0) if self.context==nil then return false end return true end --This is our main program loop and will be called continuously until the program ends function App:Loop() --If window has been closed, end the program if self.window:Closed() or self.window:KeyDown(Key.Escape) then return false end --Update the app timing Time:Update() self.context:SetScale(2,2) -- everything should be twice as big self.context:SetColor(self:rgbatovec4scalar({255,255,255},255)) self.context:DrawRect(0,0,200,200) -- This is the size the line squares should be at self.context:SetColor(self:rgbatovec4scalar({100,100,100},255)) for y = 1 , 200 do -- this should make a solid square, not rectangle self.context:DrawLine(5, y , 205, y ) -- draw square at an offset so you can see its dimensions in a relative manner end self.context:SetColor(self:rgbatovec4scalar({80,100,100},10)) for x = 5 , 205 do -- this should make a solid square also self.context:DrawLine(x, 5 , x, 205 ) -- draw square at an offset so you can see its dimensions in a relative manner end self.context:SetColor(self:rgbatovec4scalar({255,0,0},255)) self.context:DrawLine(0,0,200,200) -- the line is off from actuall 0,0 by a few pixels but it is the size self.context:SetColor(self:rgbatovec4scalar({0,255,0},255)) self.context:Plot(200,200) -- this should actually be at the edge of the white box but its at real cordinates 100,100 --Refresh the screen self.context:Sync(true) --Returning true tells the main program to keep looping return true end function App:rgbatovec4scalar(rgb,a) return Vec4(rgb[1]/256,rgb[2]/256,rgb[3]/256,a/256) end As long as this is does not function as intended, my gui will have to be put on the backburner.
  13. Hello everyone, I am trying to get a count of how many crates i have but am having a hard time figuring out how to refer to them directly to get a proper count. I want to do this to be able to track crates as i get rid of them and to add in new ones as they are generated. Thanks for any help!
  14. I'm creating a FPS game but I've run into a problem with the Pistol prefab. I have a health bar for the player ( from Aggrors video tutorials) and every time I fire the pistol the health bar flashes simultaneously with the muzzle flash. Any help would be appriciated.
  15. Hello! I wanted to make some sort of message box to pop up for the player if for example an error occurred and I wanted it to show a popup box instead of just logging it into a console. Is this possible? If not, is there a module or something to add the ability to do this? Thanks, KraXarN
  16. A simple example of a multiple text. function App:Start() self.maxTextWidth = 128 self.sourceText = "Text" self.tempText = "" self.text={} self.lineCount = 0 for w in string.gmatch(self.sourceText, "[%p%a%d]+") do if defaultfont:GetTextWidth(self.tempText) < self.maxTextWidth then self.tempText = self.tempText.." "..w else --We need to find the last word, learn length, and delete it. local temp1 = string.reverse(self.tempText) local temp2 = string.sub(temp1, 1, string.find(temp1," ")) temp2 = string.reverse(temp2) local temp3 = string.sub(self.tempText, 1, string.len(self.tempText)-string.len(temp2)) --Add new line to list. self.text[self.lineCount] = temp3 self.lineCount = self.lineCount + 1 self.tempText = "" --Now we can add the last word to new line. self.tempText = self.tempText..temp2.." "..w end end self.text[self.lineCount] = self.tempText self.lineCount = self.lineCount + 1 self.tempText = "" return true end function App:Loop() --Test text self.context:SetBlendMode(Blend.Alpha) self.context:SetColor(1,1,1,1) for i=0,self.lineCount,1 do self.context:DrawText(self.text[i],150,(150)+15*i); end self.context:SetBlendMode(Blend.Solid) self.context:Sync(true) return true end
  17. A post here about theora made me remember the previous LE2.31 implementation done by community member Niosop, who graciously provided a route for us to put *.ogg videos into LE via entity scripts. After updating his scripts to LE3.2 Indie scripts, I was able to get it working. I had planned on posting it via the workshop but I had a number of issues with it. One of the issues was that I couldn't get it to expose the script variables in the properties dialog when you attached the needed workshop script - so no easy way to select the video you wanted to play. In any case until that is sorted, here are the updated LETheora scripts with the example tv model that was created by our dear late community member . LETheora.zip The script is set up to allow you to pick an *.ogg video via the properties dialog after you attach the 'video_entity.lua' script to the mesh you want to view it on. In the case of the 'Old-TV' model, you would attach the script to the child mesh named 'Screen', then pick the *.ogg file you want to play.
  18. Hi! I cannot understand how to use your font for button. And then use a standard font. --Font local context = Context:GetCurrent() button.font = Font:Load("Fonts/Test.ttf",32) --Custom button.defaultfont = context:GetFont() --Arial button.color = Vec4(1.0) Pay attention! I do not release fonts from memory. function Button:Draw() local context = Context:GetCurrent() local window = Window:GetCurrent() if self.enable then if self.visible then context:SetBlendMode(Blend.Alpha) --Set user font if self.font then context:SetFont(self.font) else self.font = self.defaultfont end context:DrawText(self.title,25,25) --Set default font context:SetFont(self.defaultfont) context:SetBlendMode(Blend.Solid) end end end Log: Maybe I'm doing something wrong?
  19. I have standard edition of Leadwerks and I'm working in beta branch now (Leadwerks 3.5). After last update I have noticed a problem with flowgraph editor. My function: function Script:EnterType()--arg return self.collidedEntityType end is not reflected in the flowgraph and therefore I cannot trasmit this agrument to the input function (with --in) Only output and input methods are showed in the graph. Arguments are not. (Windows 8.1, GeForce GTX 460)
  20. Hello! So I had an old post and find the real problem, so I made another post... Whenever I publish my game from the project manager Steamworks always fails to load, even with Sandboxing enabled or disabled. The code I used to load Steamworks is: if not Steamworks:Initialize() then Debug:Error("Failed to load Steam") end Whenever I have sandboxing enabled or not, it always works when in the editor and when just running the .exe file from the folder, Steamworks loads and everything is fine. It really feels like I'm missing something :/ Thanks, KraXarN EDIT: Forgot to add a steam_appid.txt, oops... It all works fine now
  21. Line 10 Script.playerHeight = 1.8 --float "Player Height" Line 86 --local playerTempHeight = ((self:IsCrouched() == 1) and crouchHeight or playerHeight)
  22. Playing around with a script that allows the user to pick a color from the object panel to be used with a shader. Setting the initial value of the color works as expected and fills out the property panel correctly: Script.MyColor = Vec4(1,0,0,1)--Color "MyColor" But if the color property is modified via the panel, then it will return a number based on the 0-255 scale which will fail in the shader. In an attempt to work around this, I changed my initial value to: Script.MyColor = Vec4(255,0,0,255)--Color "MyColor" which results in this: which gives weird property panel results and still would be unuseable in my shader without dividing each component by 255. Since I have no viable method to determine if the color is being set by default or by the color picker, the returned color needs to be on a 0-1 scale to work properly. example script: Script.MyColor = Vec4(1,0,0,1)--Color "MyColor" function Script:Start() local color = self.MyColor System:Print(color.r..", "..color.g..", "..color.b..", "..color.a) self.entity:SetColor(color) end
  23. This script will crash the editor (EXCEPTION_ACCESS_VIOLATION) if attached to a pivot and dragged into the Flowgraph. TriggerDelayMapLoad.lua
  24. Hello, can anyone give me a hint or a link that explains how to create Lua classes similar to those built into Leadwerks? For example, Leadwerks has a Model class, and you can do a Model:Create() in order to create a new model. I would like to have my custom classes, eg. Block, with a method Block:Create(). I know that Lua classes are, in fact, made in C++ and disposed via Lua interface. I have a Leadwerks standard edition, but would prefer not to fiddle at this point with C++ (which I've, BTW, learned, so I can use it). But if it's necessary, I would gladly ask for some hint/advice where to start. Thanks in advance!
  25. can someone please help me i made a inventory for my game but when you place items in the inventory the image does not show i have gone over and over cant cant find the error. can anyone do me a working inventory script please :-) would appreciate it.
  • Create New...