Jump to content

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Blogs

  • Development Blog
  • Canardian's Blog
  • Beyond Civilization Blog Ext
  • Tyler's Blog
  • macklebee's Blog
  • B-Byrnes' Blog
  • Marleys Ghost's Blog
  • omid3098's Blog
  • Richardsimpo123456's Blog
  • DJDD's Blog
  • Rick's Blog
  • --
  • xtreampb's Blog
  • Economically Disadvantaged
  • klepto2's Blog
  • Old Blog
  • Chris Paulson's Blog
  • Davaris' Blog
  • nil
  • Rekindled Phoenix's Blog
  • Flexman's Blog
  • Kattemaksu Online
  • Marcousik's Creations Blog
  • EVE LBS Studio
  • Rendering puzzles
  • Screen Size Utility
  • Niosop's Blog
  • 1299 RTS Game Project
  • Blitzbat's Blog
  • gordonramp's Blog
  • Andy Gilbert's Blog
  • Marcus' Blog
  • JornAggror Blog
  • diedir's Blog
  • wayneg's Blog
  • Masterxilo's Blog
  • Dave Lee's Blog
  • peubuy's blog
  • OD Arts -Leadwerks Blog
  • The progression......
  • Ultra Software Company Blog
  • The Progression
  • Pancake's Blog
  • Test Blog
  • BLaBZ Blog
  • Pure³d's Blog
  • dreamhead Blog
  • RVL's Blog
  • DB's Blog
  • Toxin Games Development Blog
  • CombatHelo Blog (RSS Import)
  • Foolish's Blog
  • ZioRed's Corner
  • Toxin Games Twitter
  • Shard - Third Initiative
  • Shard's Blog
  • Soamp's Blog
  • Soamp's Blog
  • Laurens' Blog
  • JT`s warehouse district
  • Kennar's Blog
  • KiteFuchs' Blog
  • KiteFuchs' Blog
  • Rachel's Dev-Blog
  • Eagle's Blog
  • zaphos' Blog
  • please delete this blog
  • Afke's Blog
  • Richard Simpson
  • knowledgegranted's Blog
  • EdzUp(GD)'s Blog
  • aGameLife's Kelasel MMORPG Blog
  • tournamentdan's Blog
  • Beyond Civilization Blog
  • smashthewindow
  • AnniXa's Blog
  • AnniXa's Blog
  • Elemental Development
  • DigitalHax Blog
  • Aria's Blog
  • Strogg76's Blog
  • Clackdor's Blog
  • Leadwerks Project Status
  • simpleprogrammer's Blog
  • Pathfinding in LE.2.x
  • Naughty Alien's Blog
  • smashthewindow's Blog
  • Ali Salehi's Blog
  • Jardar's Blog
  • Chris Vossen's Development Blog
  • Scarlet Thread Studios' Blog
  • Kronos' Blog
  • Benton's Blog
  • ChrisV's Blog
  • tjheldna's Blog
  • shadmar's Blog
  • 3D Masons, LLC
  • Andy Gilbert's Enviro Models
  • ParaToxic's Blog
  • NarkLord's Blog
  • ChrisMAN's Blog
  • ChrisMAN's Blog
  • CGMan's Blog
  • The Game
  • Chris Tutorials
  • Leadwerks 3 Experience
  • An Alien Saga
  • klepto2 & Leadwerks 3
  • Inside the mind of eternal insomniac
  • josk's Blog
  • Shader Development in Leadwerks 3.1
  • 3D Coat : Column game making of
  • Einlander's Blog
  • Ginger George's Blog
  • I have a problem
  • Michael_J's Blog
  • nasamydifol's Blog
  • Digman's Blog
  • noesisGUI
  • SavageDogg38's Blog
  • Built from Ruins
  • Remaining Days
  • test_external_blog
  • The Hunt For Food Blog
  • Crazy Minnow Studio
  • CrazyMinnowStudio
  • Guppy's Blog
  • Playing Online
  • Evayr's Blog
  • DerRidda's Blog
  • Karl's Blog
  • whiterabbit's Blog
  • Tinyboss Games
  • abendkleider's Blog
  • sacguccireplica's Blog
  • Arena
  • Imchasinyou's Blog
  • xtom's Blog
  • Lua is better than you think.
  • mdgunn's Blog
  • Crime Closer
  • lxFirebal69xl's Blog
  • Wedmer's Blog
  • Lockdown, going forward.
  • Pump-Action Captain
  • Igor's Blog
  • Dead Anyway
  • Runenrise and more
  • reepblue's Blog
  • Slippy's Corner
  • LUA Musings
  • severjack's Blog
  • mikeporter's Blog
  • miko93's Blog
  • Megalocerous' Blog
  • lxFirebal69xl's Blog
  • aiaf's Blog
  • Lostghbear's Blog
  • echo $BLOG_NAME > blog_title.tmpl
  • johnadam111's Blog
  • Dwarf Beard
  • burgelkat's Blog
  • Charrua's Blog
  • peterpaul's Blog
  • joshmathews' Blog
  • Martin Kearl's Blog
  • Brutile's blog
  • tipforeveryone's Blog
  • Glushchenko Blog
  • Express Lab Games Blog
  • Blueapples' Blog
  • DooMAGE's Blog
  • Structura devblog
  • UltraEngine - Experiences, add-ons and other Stuff
  • martyj's Blog
  • Dragonfreak's Blog
  • Brutile's Blog
  • assigmenthelp
  • Case Study Assignment Help
  • How to deal with bad grade ?
  • How to deal with bad grade ?
  • GameDev Blog
  • devcjohnson's Blog
  • devcjohnson's Blog
  • THE WHAT? Blog
  • The Demurian Scribe
  • GUI Editor
  • GUI Tutorial
  • noob_shaders
  • The Seventh World
  • Phodex Games Blog
  • Leadwerks VS Source 2
  • Work in Progress - Scifi PBR Media
  • [C++] First Player game start
  • The Blog of Yue
  • Snowboarding Development Blog
  • Ocean: Rendering in Leadwerks 4
  • Game Ready Maps
  • Ultra App Kit (Advanced Custom Widgets)
  • Poking around
  • SALVATIONLAND
  • Blender tutorials
  • Usefull Scripts & Components
  • Thirsty Panther
  • Ultimate Action Game Controller

Forums

  • Software
    • General Discussion
    • Programming
    • Game Artwork
    • Showcase
    • Suggestion Box
    • Bug Reports
  • Addons
    • Extensions & Plugins
    • Components
    • Addon Development
  • Platforms
    • Windows
    • Linux
    • macOS

Categories

  • Streams and Events
  • Tutorials
  • Games
  • Work in Progress

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location

  1. SpEcIeS

    MonsterAI

    This morning I started up a fresh "Advanced First-Person Shooter" project. After the "07-AI and Events.map" was loaded and then ran, immediately an error was generated: Script Error error in function 'SetCollisionType'. argument #3 is 'boolean'; '[no object]' expected. Line 90 Is anyone else producing this error?
  2. I've been staring at this code for way too long and now I need different brains to look at it. This is the beginnings of a 3rd person character controller. I am now working at adding mouse look features but there seems to be a bug when the camera is at specific angles, notable y45 and y270. At those specific locations the camera glitches out. I will give it another try tomorrow, and no I don't want to create a pivot and anchor the camera to it and spin that --[[ Title: Third Person Controller Author: Einlander Start Date: 1-30-2016 Version: .01 Description: Script to control Player in 3rd person with keyboard and mouse Notes: This script is designed to mimic classical 3rd person game controls: *Look with mouse *Move with WASD *Follow Player as they move ]]-- Script.Cam =nil --entity "Camera" Script.moveSpeed = 2.5 --float "Move Speed" Script.speedMultiplier = 1.5 --float "Run Multiplier" Script.strafeSpeed = 4 --float "Strafe Speed" Script.jumpForce = 8 --float "Jump Force" function Script:Start() self.input={} self.unitangle = Vec3() self.anglemagnitude = nil end --[[ function Script:UpdateWorld() end --]] function Script:UpdatePhysics() local movex=0 local movez=0 self.input[0]=0 self.input[1]=0 local playerMovement = Vec3() -- I learned the boolean shortcuts from my years programming on a Casio Graphing Calculator self.input[1] = self.input[1] + ((window:KeyDown(Key.W) and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0)) self.input[0] = self.input[0] - ((window:KeyDown(Key.A) and 1 or 0) - (window:KeyDown(Key.D) and 1 or 0)) playerMovement.z = self.input[1] * self.moveSpeed -- Strafing playerMovement.x = self.input[0] * self.moveSpeed if self.carryingEntity == nil and window:KeyDown(Key.Shift) then playerMovement.z = playerMovement.z * self.speedMultiplier -- Run while Strafed -- playerMovement.x = playerMovement.x * self.speedMultiplier end local jump = 0 if window:KeyHit(Key.Space) and self:IsAirborne() == 0 then jump = self.jumpForce playerMovement = playerMovement * 1.6 end self.entity:SetInput(0, playerMovement.z, playerMovement.x, jump , false, 1.0, 0.5, true) local startpos = Vec3( self.entity:GetPosition(true).x, self.entity:GetPosition(true).y + 5 , self.entity:GetPosition(true).z -5 ) -- y distance to get above players head, z - distance we want from player local endpos = Vec3() -- rotate the starting position (where the camera is at) around the player position if self.rot == nil then self.rot = 0 end self.rot = self.rot+.5 local finalpos = Vec3() finalpos = self:rotateX3D({startpos},self.entity:GetPosition(true) , 0)[1] finalpos = self:rotatePointY({finalpos},self.entity:GetPosition(true) , self.rot)[1] -- when self.rot ~ 45 or 270 it flips just for that 1 angle -- set camera at the final rotated positon self.Cam:SetPosition(finalpos) -- make camera look at player local lookAt = self:LookAt(self.entity:GetPosition(true)) lookAt.z = 0 -- THIS LINE IS IMPORTANT. DO NOT REMOVE IT, IF YOU DO IT WILL CAUSE A JUMP WHEN THE Z ANGLE CHANGES FROM NEGATIVE TO POSITIVE OR VICE VERSA self.Cam:SetRotation(lookAt,true) end function Script:IsAirborne() return self.entity:GetAirborne() and 1 or 0 end function Script:LookAt(lookAt) --http://www.leadwerks.com/werkspace/topic/10191-short-example-of-mathatan2/page__hl__lookat --http://stackoverflow.com/questions/1251828/calculate-rotations-to-look-at-a-3d-point --http://leadwerks.wikidot.com/wiki:face-entity --// Calculate angle from point A towards point B local tv = lookAt - self.Cam:GetPosition(true) local tRoty = Math:ATan2(tv.x, tv.z) local tRotx = 0 if lookAt.z >= self.Cam:GetPosition(true).z then tRotx = -Math:ATan2(tv.y* Math:Cos(tRoty), tv.z) else tRotx = Math:ATan2(tv.y* Math:Cos(tRoty), -tv.z) end tRotz = Math:ATan2( Math:Cos(tRotx), Math:Sin(tRotx) * Math:Sin(tRoty) ) return Vec3(tRotx,tRoty,tRotz-90) end function Script:Get3dDistance(pointa --[[as vec3--]], pointb--[[as vec3--]]) --[[as float--]] return math.sqrt((pointb.x - pointa.x)^2+ (pointb.y - pointa.y)^2+ (pointb.z - pointa.z)^2) end function Script:Get3dMagnitude(pointa --[[as vec3--]]) --[[as float--]] --http://www.fundza.com/vectors/normalize/ return math.abs(math.sqrt((pointa.x * pointa.x)+ (pointa.y * pointa.y)+ (pointa.z * pointa.z))) end function Script:NormalizeVector(pointa--[[as vec3--]], length--[[as float--]])--[[as vec3--]] --Yes I know leadwerks has these functions built in somewhere, but sometimes you just need to learn what it is you are exactly doing --http://www.fundza.com/vectors/normalize/ pointa.x = pointa.x / math.abs(length) pointa.y = pointa.y / math.abs(length) pointa.z = pointa.z / math.abs(length) return pointa end toRadians = function(degrees) return degrees / 180 * math.pi end function Script:rotatePointY(points, origin, degrees) local pointsout = {} for i = 1, #points do local point = Vec3(points.x,points.y,points.z) local x = origin.x + ( math.cos(toRadians(degrees)) * (point.x - origin.x) - math.sin(toRadians(degrees)) * (point.z - origin.z) ) local z = origin.z + ( math.sin(toRadians(degrees)) * (point.x - origin.x) + math.cos(toRadians(degrees)) * (point.z - origin.z) ) point.x = x point.z = z table.insert(pointsout, point) end return pointsout end function Script:rotatePointZ(points, origin, degrees) local pointsout = {} for i = 1, #points do local point = Vec3(points.x,points.y,points.z) local x = origin.x + ( math.cos(toRadians(degrees)) * (point.x - origin.x) - math.sin(toRadians(degrees)) * (point.y - origin.y) ) local y = origin.y + ( math.sin(toRadians(degrees)) * (point.x - origin.x) + math.cos(toRadians(degrees)) * (point.y - origin.y) ) point.x = x point.y = y table.insert(pointsout, point) end return pointsout end function Script:rotatePointX(points, origin, degrees) local pointsout = {} for i = 1, #points do local point = Vec3(points.x,points.y,points.z) local y = origin.y + ( math.cos(toRadians(degrees)) * (point.y - origin.y) - math.sin(toRadians(degrees)) * (point.z - origin.z) ) local z = origin.z + ( math.sin(toRadians(degrees)) * (point.y - origin.y) + math.cos(toRadians(degrees)) * (point.z - origin.z) ) point.y = y point.z = z table.insert(pointsout, point) end return pointsout end function Script:rotateX3D (points, origin, degrees) local pointsout = {} for i = 1, #points do local point = Vec3(points.x,points.y,points.z) local y = point.y; local z = point.z; point.y = origin.y + (y- origin.y) * math.cos(toRadians(degrees)) - (z - origin.z) * math.sin(toRadians(degrees)); point.z = origin.z + (z- origin.z) * math.cos(toRadians(degrees)) + (y - origin.y) * math.sin(toRadians(degrees)); table.insert(pointsout, point) end return pointsout end function Script:WrapAngle(angle) local currentrotation = angle if currentrotation.x < 0 then currentrotation.x = 359 - math.mod(currentrotation.x , 359) end if currentrotation.y < 0 then currentrotation.y = math.mod(currentrotation.y , 359) currentrotation.y = 359 - math.abs(currentrotation.y) end if currentrotation.z < 0 then currentrotation.z = 359 - math.mod(currentrotation.z , 359) end currentrotation.x = math.mod(currentrotation.x , 359) currentrotation.y = math.mod(currentrotation.y , 359) currentrotation.z = math.mod(currentrotation.z , 359) return currentrotation end --[[ function Script:Collision(entity, position, normal, speed) end --]] --[[ function Script:Draw() end --]] --[[ function Script:DrawEach(camera) end --]] --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) local pos = self.Cam:GetRotation(true) local outText = "Actual angle" .. pos.x .. "|" ..pos.y .."|" ..pos.z --local outText = self:FaceEntity(self.Cam:GetPosition(true),self.entity:GetPosition(true)).x .."|" .. --self:FaceEntity(self.Cam:GetPosition(true),self.entity:GetPosition(true)).y .."|" .. --self:FaceEntity(self.Cam:GetPosition(true),self.entity:GetPosition(true)).z context:DrawText(outText,0,150) context:DrawText("Distance:" .. self:Get3dDistance(self.Cam:GetPosition(true) , self.entity:GetPosition(true)),0,165) pos = self.unitangle local outText = "unit angle" .. pos.x .. "|" ..pos.y .."|" ..pos.z context:DrawText(outText,0,180) pos = self.Cam:GetPosition(true) local outText = "Cam Position" .. pos.x .. "|" ..pos.y .."|" ..pos.z context:DrawText(outText,0,195) pos = self.entity:GetPosition(true) local outText = "Player Position" .. pos.x .. "|" ..pos.y .."|" ..pos.z context:DrawText(outText,0,210) end --[[ --This function will be called when the entity is deleted. function Script:Detach() end --]] --[[ --This function will be called when the last instance of this script is deleted. function Script:Cleanup() end --]]
  3. I'm inflicting damage the player and I find the "Hurt" script in the fpsplayer script. The first variable is "Damage" which will reduced the players health by that amount. The second is called "distributorOfPain". Does anyone know what this does? Also whats the difference between the "Hurt Script" and the "Take Damage Script". I know that using the "Take Damage Script" doesn't enact the dying script but I don't know why. If you use the take Damage Script the game continues but the player can no longer move.
  4. When I use Leadwerks I normally have my game run at desktop resolution windowed. Sometimes I want to see the performance difference in full screen (it's always better). To do this I would normally need to edit main.lua. After a bit of thinking and experimenting I made a short 'hack' that will allow you to hold f5 of f6 to run in full screen instead of windowed. tempwindow=Window:Create("key capture",0,0,1,1,1) context=Context:Create(tempwindow,0) if (tempwindow:KeyDown(Key.F5) or tempwindow:KeyDown(Key.F6))== true then windowstyle=windowstyle+window.FullScreen end Place this after if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end and before window=Window:Create(title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
  5. I highly encourage some one who wants to make a bit of extra money on the side to spend some time creating a course for Leadwerks on www.udemy.com I am sure that every single one of the people who buy this engine would love a full blown course for the engine as well, to make sure they get the most out of their learning experience. I know I would. So please consider it, I would be the first one to purchase it. Teach LUA scripting and the over all API of Leadwerks in general in the course, that would be fantastic!
  6. I cannot find a way to 'autoscroll' the debug window text. It would be nice if it was possible to set it to 'autoscroll on ouput', so that you can easily see the latest messages that get's printed out. (Running on ubuntu, guessing it's the same on windows, but I have not tested on windows because I do not have that). It's not easy to debug when you debug 'blind' and then have to scroll down and read the output afterwards. Makes it very tricky. Also - the output window on the main editor screen - would be nice if that one also could show the same text as what the output\debug window in the script editor shows. That would make it easier\faster to debug.
  7. I'm in the process of debugging a loop which is supposed to vertically scroll some text contained in a table. My loop is verified as looping over the keys in order (ipairs(array) vs pairs(array)) but in the debugger (pictured) the keys appear out of order once we get to "k=10", where it appears after the first index. It's a small thing, but it confused me for a minute before I double-checked the loop again and verified that it is in fact iterating in the correct order. This is literally just a display issue in the debugger. Here's the screenshot of what I'm talking about (nevermind my improperly incremented values): Expected behavior: Keys in "txt_y" table are displayed in order Current behavior: Keys in "txt_y" table are displayed out of order once there are more than 9 keys.
  8. It looks like DrawText doesn't like multi-line string literals, it's reading them in as one long line that ends up mostly off of the screen and doesn't respond to escape characters (such as "\n") embedded in the multi-line string in order to try and simulate "wrapping". Either I'm missing some undocumented param or DrawText was only meant to draw a single line of text at a time. Of course, I can write a loop for this, but that incurs a performance penalty, especially with longer bits of text and seems to be a needlessly complex solution. My suggestion is to allow DrawText the ability to handle multi-line strings in LUA or have it renamed to DrawSingleLineText, since that's what it does.
  9. Hello, I would like to take a JSON file and read its content into a normal Lua string. Even better, I would like to put a JSON text into a Lua table directly, if it's possible. So far, I've found this Lua lib for converting a JSON string into a Lua table and vice versa. However, I don't see how to read a whole file as a string. Thank you in advance! P.S. I know how to read an individual line with this function.
  10. Is there a way to get the Terrain height in Lua? I don't see any Terrain specific stuff on the API Reference page.
  11. I was messing around one day and wanted to have certain objects be weightless. So I came up with this simple code. function Script:UpdatePhysics() self.entity:AddForce(0,self.entity:GetMass()*-world:GetGravity().y,0,true) end Just wanted to share it. You can can control the amount of weightlessness by controlling the amount (%) of gravity used in the calcualtion
  12. What's the difference between Hide and release. I know you can get a hidden entity back with show and you can get a released entity with instance are there any advantages to using either?
  13. Good evening, As Mentioned in the caption - is there a possibility to link Notepad++ to Leadwerks engine so that if I press F5 it "compiles" ? Would be super Awesome! yours Max Aigner
  14. hi everyone, I have just tried to implement an DLL into lua with the loadlib command. http://www.lua.org/pil/8.2.html#C-packages they say it should work but it does not Main.lua path = "c:\\windows\\system32\\user32.dll" local GetSystemMetrics = assert(loadlib(path, "GetSystemMetrics")) Error: "Script Error: Attempt to call global 'loadlib' (a nil value) Is there a way of enabling this? It would increase the possibilities of Leadwerks and Lua a Lot and it would allow us to make better leadwerks projects so that leadwerks can get more famous and bought more often!!
  15. Hello! So, recently this error has been starting to pop up at random when I change map Possible reference count error for asset "models/crates/crate_small.mdl" And then it just crashes. I have 3 crate_small models on the map, but some maps work and some don't, even if they are just mostly copies of each other. Suggestions? Thanks!
  16. Hello! So something weird have started happening in the later updates. It now instantly crashes on local mousePos = App.window:GetMousePosition() With the error MainMenu.lua" : 2 : attempt to index field 'window' (a nil value) To try, I tried creating the window with self.window = Window:Create("Window", 10, 10, 1280, 720, window.Titlebar) Which results in the same error. Suggestions? Thanks!
  17. Here is how i made it possible to call C++ from LUA. I want to build Multiplayer game in Leadwerks. But i couldn't find networking libraries and threading libraries that would make it usable in Lua. So i build a Networking client in C++ with libcurl and libpthread . But i want to still use the Lua scripting on the prefabs since a lot of work is already done for me here. And also programming in Higher level languages is just faster. I decided to use the libtolua++ libraries, since this is already build into Leadwerks. I work on Ubuntu 15.04. Here the tolua++ libs are installed with: sudo apt-get install libtolua++5.1-dev The tolua++ program needs a pck file which shall contain the c++ like seudo code that is translated into lua classes. My package: $#include "shot.h" class ShotListener { ShotListener(); ~ShotListener(); void shot(Object* oEntity, float damage); float getHealth(Object* oEntity); }; I have made two functions. One to emit shots detected on the Entities from the Lua scripting. Another to get the current health status from C++ side. My actual ShotListener.h class looks like this: #pragma once #include "App.h" #include "Leadwerks.h" using namespace Leadwerks; class ShotListener { private: public: ShotListener(void) { } ~ShotListener(void){} void shot(Object* oEntity, float damage) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; app->entityShot(entity, damage); return; } float getHealth(Object* oEntity) { App *app = App::getInstance(); Entity * entity = (Entity*)oEntity; float value = app->getEntityHealth(entity); return value; } }; As you can see i changed the default App class into a Singleton so that i can get the App object from the instances of ShotListener that is used from Lua. Having placed these two files in the same folder i ran the following function from the terminal: tolua++5.1 -o tolua_shot.cpp -H tolua_shot.h -n Shot shot.pkg This generated two files tolua_shot.cpp and tolua_shot.h that i included in my C++ project along with the shot.h file. This way i can do a self.shotListener = ShotListener:new() In the Script:Start() function in mu Lua objects and a self.shotListener:shot(self.entity, self.hits) When Hurt is called in the Lua object. After this i just had to sort out all the Segmentation error bugs because of multithreading. I forgot to mention that the ShotListener Lua also needs to be initialized in the main.cpp before app->Start() with the following: if (Interpreter::L==NULL) Interpreter::Reset(); tolua_ShotListener_open(Interpreter::L);
  18. Can self.component:CallOutput( "something" ) give a return value ? Means that the in-function returns a value that is passed to the CallOutput return Lua1.lua -------------------------------------------------------------------------------- function Script:func() local retval = self.component:CallOutput( "something" ) System:Print( retval ) -- prints "Hello" ? end Lua2.lua --------------------------------------------------------------------------------- function Script:something()--in return "Hello" end
  19. Where did the scripting documentation for FlowGraph go? I can't remember how to add parameters with In/Out and was going to check that but the documentation is gone.
  20. Maybe a bug or behavior by design? If you have a CGS object with a child object. In the editor the child will rotate along with the parent object when the parent is rotated. That's Ok and expected behavior. However if you rotate the parent object by a script (simple Turn command) the child does not rotate, only the parent. Tested same thing with two mesh objects (fbx) and in that case both rotates as expected when parent is rotated (both by script and in the editor)
  21. Hello, lxFirebal69xl pointed out that the loadfile() function i used in the Notes.lua crashes the application. I tested it and it looks like loadfile can only load files that are placed normally in the game directory and not inside a zip-file. is this a bug or a feature?
  22. Coming from the pure C++ world I have a question for you who used LUA for a while.In C++ I'm quite used to make classes of most things to keep things apart. Now I wonder if this approach will hold in LUA also considering speed. Or in an other way. Is there high speed penalties for accessing external class methods in Lua compared to simple functions or is the difference negligible
  23. Is there anyone using another LUA IDE than the built in. Nothing wrong with that one but its a bit limited. I'm not to familiar with what's out there and what suites Leadwerks nicely. Any suggestions? /Windows/
  24. I was updating a pain trigger and noticed that in the fpsplayer.lua file that the functions: Script:Hurt(damage,distributorOfPain) and Script:TakeDamage(damage) Script:Hurt will lower your health and when dead initiate the death sequence by calling Script:Kill(), BUT it will NOT set the players self.alive to false, call Script:OnHit() or Script:OnDead() Script:TakeDamage will lower your health, set your self.alive to false, call the self:OnHit() and self:OnDead() outputs but will not start the death sequence by calling Script:Kill() Fixed functions: function Script:Hurt(damage,distributorOfPain) if self.health>0 then self.sound.damage[math.random(#self.sound.damage)]:Play() self.health = self.health - damage self.hurtoffset = Vec3(math.random(-1,1),math.random(-1,1),0):Normalize()*30 local blood = {} local n=1 blood.texture=self.image.blood[math.random(1,4)] blood.intensity=1 table.insert(self.bloodoverlay,blood) if self.bloodindex>4 then self.bloodindex=1 end self:OnHit() if self.health<=0 then self.alive = false self:Kill() self:OnDead() end end end function Script:TakeDamage(damage) -- Decrease health self.health = self.health - damage; -- Call OnHit output self:OnHit() -- If health lower or equal to zero, the player is dead if self.health <= 0 then self.alive = false -- Call the OnDead output self:OnDead() self:Kill() end end
×
×
  • Create New...