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
  • Direct Macro

Forums

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

Categories

  • 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. Spent ages trying to figure out why a certain line of code keep breaking the program. After deciding to restart Leadwerks I reopened the script file and suddenly there was a break-point at that line. I did remove it before hand, but it obviously just removed the icon, not the actual break-point. Hope this can be resolved soon.
  2. Welcome to the Forth Monthly Script Challenge. Each Month I will set a challenge for gifted Leadwerkers to solve. Once you have perfected your script post your map to this thread. At the end of the month I will go through all the entries and judge the winner. I will then place the winning map on the Workshop so others can learn from them. Rules. Entries must be your own work. Entries must be submitted before the end of the month ( April ). Any assets you use must be your own or Royalty free. The map that you submit can be used by others for commercial use. Have fun. April Challenge This month I thought the challenge should be a weapon. Leadwerks already comes with a pistol and you can get a shotgun and automatic weapons by buying the DLC. So whats another iconic gaming weapon? A Zero Point Energy Field Manipulator. Aka Gravity Gun. Made famous in Half life 2 it was originally designed for handling hazardous materials. But with its ability to "fire" objects it becomes very handy as a weapon for knocking down barriers or enemies. Your script should replicate the functions of the Half Life gravity gun. That is the secondary fire button to attract and hold an object and the primary fire button to shoot the object. How you implement your script is up to you. Remember the winning script should not only solve the problem but should also have comprehensive comments within the script so that new users can learn from your script. Prize As announced last month we now have a sponsor. Yeah. Damien Defranco and his company Vixeemo are now the proud sponsors of the Leadwerks community monthly script challenge. Vixeemo (http://vixeemo.com) is an all-in-one business solutions brand for your start-up or project needs. The winner will receive a free web & graphic design package provided by Vixeemo that includes a 3-page professional website design (Home, About, Contact), logo design and integration, banner/slider design, a blog section, and an additional gallery page to showcase images/video or projects. Vixeemo will work with the winner to fully customize everything to bring the vision to fruition. This prize is perfect for any Leadwerks user who wants to get their project or brand onto the internet. The winner will need to provide the domain ( TomsHardware Guide ), and Vixeemo will do the rest. This design package is valued at over $400 USD. A great prize for your hard work and a great way to give your game project that professional look to make it stand out from the crowd. If you have any ideas or thoughts on the Challenge please feel free to comment. Gordon Freeman and I are looking forward to your submissions. PS Josh could you kindly pin this thread please. Members 627 posts Welcome to the Third Monthly Script Challenge. Each Month I will set a challenge for gifted Leadwerkers to solve. Once you have perfected your script post your map to this thread. At the end of the month I will go through all the entries and judge the winner. I will then place the winning map on the Workshop so others can learn from them. Rules. Entries must be your own work. Entries must be submitted before the end of the month ( March ). Any assets you use must be your own or Royalty free. The map that you submit can be used by others for commercial use. Have fun. March Challenge Weather plays a big part in any game. Be it a horror game with a scary house with the wind blowing. A survival game where you need to find shelter to get out of the snow or a racing game where the road becomes slippery when its raining. Weather provides a passive obstacle for the player. Just as a zombie or a locked door can inhibit the player so can weather. Using weather in a game can provide an add level of interest to the player and add depth to your game.. So your challenge this month is to create a Weather system. Your map should include rain, snow and wind. You are free to do this anyway you like. You could use shaders or emitters its up to you. I decided not to provide a map this month. Most entries in previous challenges make their own maps anyway. I have provided a small collection of sound effects for you to use. Weather Sounds How you implement your script is up to you. Remember the winning script should not only solve the problem but should also have comprehensive comments within the script so that new users can learn from your script. Prize Currently I have no prize to give. Your reward will be admiration of your fellow Leadwerkers and being the third winner of the Monthly Script Challenge. Your name will join the previous winners Garlic Waffle and Genebris in the Leadwerks Hall Of Fame. If any person or company would like to donate or sponsor the Challenge you can contact me on this forum. If you have any ideas or thoughts on the Challenge please feel free to comment. This is the first time I've run anything like this and I want it to be successful and useful to the community. Looking forward to your submissions. PS Josh could you kindly pin this thread please.
  3. Title says it all If answer is YES I'm disappointed as it shouldn't in my humble opinion
  4. If have an entity in my scene with a script attached that holds some parameter, something like this Script.param = 10--int and then in my LUA program at some point picks that entity. Is is possible to access the script.param then (at this stage I have only the entity) I made a temporary solution for this that works by using the Get/SetKeyValue like this Script.param = 10--int function Script:Start() self.entity:SetKeyValue("param", self.param) end which allows me to get that param event though I only have the entity local value = entity:GetKeyValue("param") However this feels a bit odd. Maybe there is some better way ? Note: In C++ I could do this using my LuaBridge class, but this project is pure LUA
  5. Hi guys, I searched the forum a bit and found out that other people had the same issue as I have now. You maybe know that if you have a key check (like window:KeyHit() or window:MouseHit()) in multiple scripts then only ONE of the works as expected. I read that its because Leadwerks sets the hit check value to false right after you checked it. However I tried to find a solution for this, by making a "class" where I call all keychecks, unfortunately the problem remains, maybe you can help me? What have you come up with? Thats my attempt: Thats the class script: function KeyCheck(script) local key = {} function key:MouseClicked(command) if command == "Left" then return window:MouseHit(1) elseif command == "Right" then return window:MouseHit(2) end end return key end These are two test scripts: import "Scripts/+Morra Scripts/System/KeyCheck.lua" local keyCheck function Script:Start() self.loadClass = KeyCheck keyCheck = self:loadClass() end function Script:UpdateWorld() if keyCheck:MouseClicked("Left") then System:Print("Test1") end end import "Scripts/+Morra Scripts/System/KeyCheck.lua" local keyCheck function Script:Start() self.loadClass = KeyCheck keyCheck = self:loadClass() end function Script:UpdateWorld() if keyCheck:MouseClicked("Left") then System:Print("Test2") end end I only get printed "Test1", due to this script seems to be called faster than the second one.
  6. Hi, any idea haw can i change mode Chase player (Monster ai) to run away from player. thank y
  7. Hi there, I have a problem, maybe you guys can help me. I will make it quick. Following is what I have (just an example): function Script:Start() FileSystem:CreateFile("Data/Save Data/someData.lua") self.stream = FileSystem:WriteFile("Data/Save Data/someData.lua") end function Script:UpdateWorld() --I created this to find the error and to test it out if window:KeyHit(Key.K) then self.stream:WriteLine("Some text goes here") System:Print("It should work!") end end So I get printed "It should work!" AND the file gets created, but I can click "K" as often as I want, the text which should be written does not show up in the file. I need this to save data for my game. Whats the mistake. I noticed, that sometimes it gets written, after I close the application, but sometimes is has also been written while "ingame", but mostly it doesnt, especially with the scenario you can see above. Anyways this stream:WriteLine() seams to behave very akward. Further then solving my problem, what are your solutions for saving massive, or not so massive data (object positions, player position, npc states etc)? Thanks for your answers! EDIT: Just checked the data file again, and now the data is written a hundred times??? But I triple check if it gets written after I pressed "K". The problem is I need the file to be written immediately, because I grab the file again with dofile (I normally write code into the file that gets called (a simple "return" and some data))
  8. Welcome to the Second Monthly Script Challenge. Each Month I will set a challenge for gifted Leadwerkers to solve. I will provide a map as a starting point. Once you have perfected your script you re-post your map to this thread. At the end of the month I will go through all the entries and judge the winner. I will then place the winning map on the Workshop so others can learn from them. Rules. Entries must be your own work. Entries must be submitted before the end of the month ( February). Any assets you use must be your own or Royalty free. The map that you submit can be used by others for commercial use. Have fun and educate. February Challenge Leadwerks is very good at getting the budding game developer to create their very own FPS. One of the problems with this is that the players footsteps sound like they are walking on concrete regardless of the surface they are actually on. The player runs across grass, sounds like concrete. Runs thru water, sounds like concrete. We need a way for the player footsteps sounds to be altered depending on the surface that they are on. So your challenge for this month is to create a script that plays different sound effects for different surfaces. The map I have provided is very simple. A player with the FPSplayer script attached on a single platform with 5 different surfaces. The first is concrete, then foliage/leaves, metal, water and grass. Your script should play a different sound for each surface. The February Map. The map has various textures from Wild Textures. These are free to use in your own projects even if you don't submit an entry. I had some sound effects but I can't remember whether they are royalty free or not. So I wont post them until I can confirm. In the meantime you will need to find your own sound effects. How you implement your script is up to you. You can alter the FPS player script or add a separate script it is entirely up to you.Remember the winning script should not only solve the problem but should also have comprehensive comments within the script so that new users can learn from your script. The last challenge had 3 fantastic entries and the only way I could split them was on the documentation. So keep that in mind when submitting. Prize I still don't have a prize to give away. So your reward will be admiration of your fellow Leadwerkers and being the second winner of the Monthly Script Challenge. You will join Garficwaffle on the Leadwerks Hall of Fame (OK I just made that up). If any person or company would like to donate or sponsor the Challenge you can contact me on this forum. The last Script challenge had almost 1000 views so sponsoring this challenge would expose your product to many potential customers If you have any ideas or thoughts on the Challenge please feel free to comment. The first challenge was very well received and I have had lots of positive comments. Looking forward to your submissions.
  9. Currently to expose settings to the editor users have to use the format: Script.variable = value --Type "Label" I propose a breaking change to the way editor properties function. First the syntax/method would need to change. Script would become a table: Script = {} All entries would be become named variables holding tables: Script = { --variable = {value, "type as string","label as string"} ground_height = {100, "uinteger","Ground Height" }, jump_height = {4,"uinteger", "Jump Height"}, player_name = {"","string", "Player Name"} } What this would mean is the editor would need to actually load the script itself, which brings a few drawbacks. 1. the entire script would need to be able to load without any errors. 2. if the script fails there is a chance that the properties will fail to load. 3. if the script property section is malformed or wrong it will not show up. or just grab it from the debug info (i would assume it's rather hard) A solution for this would be: 1. To hold a copy of the properties in memory/cache and restore them when the properties returns. 2. add a small reset button to reset the value to default. (since the editor will always be remembering the last value). If this is implemented there is an additional benefit: function Script:test1() return {"Good","Neutral","Bad"} end Script = { --variable = {value, "type as string","label as string"} ground_height = {100, "uinteger","Ground Height" }, jump_height = {4,"uinteger", "Jump Height"}, player_name = {"","string", "Player Name"}, dynamic_list = {self:test1() ,"choice","Team"} } You can now dynamically populate lists!! 1 draw back is you would either need to forward declare functions or put the functions above the script declaration. Even if this is not implemented, it could be useful if editor plugins are ever added.
  10. I recently had a bad go around with a project in leadwerks. I nearly had an entire map finished and ready to play and then alluva sudden, the script editor decided it didn't want to work anymore, as in clicked on it and nothing happened no matter how many times I tried. I started a new project to see if it was something wrong with my project files. Same thing happened. After realizing it wasn't going to work, I deleted all of my local content and reinstalled Leadwerks. After getting another map going, I attempted to play what I have, for debugging and it says that the Animation Manager Lua is missing. It only ever asks for it when I have an active enemy on the map. I went into steam and verified local files and tried again. The Animation Manager Lua is still missing. I've scoured template files and all of my scripts and nothing. I don't know how I'd ever manage anything without these forums...
  11. I have got this Astar script, that I want to use again. https://github.com/lattejed/a-star-lua/blob/master/a-star.lua But I dont know how I managed to do it, the import itself works with import"Scripts/Astar.lua" but I get an error at the line 7 of the Astar script, : module ( "astar", package.seeall ) I dont know what I did to do to make this work, can anyone help ?
  12. If I create a prefab of decal with "Paint models" option disabled and load this prefab in code, this decal will still be visible on models and GetRenderMode(Object.ModelClass) will return true. Though, loading this prefab in editor will work correctly, Paint models will be off.
  13. Does anybody have good experience using a lua lib for calling webservices/making http requests? Currently looking at Luasockets but tinkering about whether this is even possible when you are making a game using the Leadwerks game player.
  14. I was looking for a way to avoid having to make time variables manually and a more inline way when I wanted to do something on an interval. I came up with the function below. The idea is that it's something that's in an Update function so it's called every frame (normally what you would do anyway if you were tracking it manually). First it's usage: -- this will play an attack animation every 2 seconds. the false variable tells if it should call the function you are passing in right away the first time or wait until the interval is up for the first time only. after that it'll do it at the interval DoEvery(2000, false, function() self.animMgr:SetAnimationSequence("Attack"..tostring(1 + task.actor.attackmode), 0.05, 300, 1, self, self.EndAttack) end) This should be slap in ready. Just copy it to your project and use away. function DoEvery(interval, doRightAway, method) local info = debug.getinfo(method, "S") local id = info.linedefined..string.gsub(string.gsub(info.source, "/", "_"), ":", "") -- if this is the first time every calling this then create the global class that will hold all instances of these if DoEveryInstances == nil then DoEveryInstances = {} end -- if this is the first time trying to do this specific function then create it's entry if DoEveryInstances[id] == nil then DoEveryInstances[id] = {} if doRightAway == true then DoEveryInstances[id].lastUpdateTime = interval * -1 else DoEveryInstances[id].lastUpdateTime = Time:GetCurrent() end end -- handle the do every function for a specific instance if Time:GetCurrent() >= DoEveryInstances[id].lastUpdateTime + interval then DoEveryInstances[id].lastUpdateTime = Time:GetCurrent() method() end end
  15. Hello, currently I am working on my AI system, but I have a problem setting up multiple NPCs. What you need to know: - My AI is able to randomly move around in the world using waypoints. - I coded an own animation manager "class" The Problem: I set one NPC to not move around and the other to do so. It works fine. One is moving, one is standing still, BUT the one moving is not playing an animation. So he is kind of floating around. The one who is standing is playing the walk animation. So I printed some values to find the error. By the way if I just have on NPC active everything works fine without any trouble. This is the code of my animation manager class: function AnimationManager(script) local model = {} function model:StartAnimation(animation, speed, objects, playOnce, reset, blendMultiplier) --some code self.objects = objects local printIt = self.objects[1]:GetKeyValue("name") System:Print(printIt) end function model:DrawAnimation() --some code end return model end The scripts are called like this: function Script:Start() --Load Classes self.loadClass = AnimationManager self.animManager = self:loadClass() --Start Animation self.animManager:StartAnimation(argument1, argument2, ...) end function Script:Draw() --To play an animation self.animManager:DrawAnimation() end I only put the nessecary information in the code block, that you understand what I am talking about. My NPCs have diffrent names in the editor. The moving one is named "Fox" the standing one "Jacob". The class works, that is not the problem. In the AI code I printed the name of the NPC who is calling the StartAnimation() function. It prints "Fox", so the correct NPC is calling StartAnimation(). The NPC called "Jacob" is NOT calling StartAnimation(). The NPC is sending his entity (self.entity) so the animation manager knows on which model to perform the animation. In the animation manager if I print the name of the entity to play the Animation on it prints "Jacob". o.O Why does this happen how is it possible that the two NPC scripts seems to communicate with each other. Why does the AI script of "Jacob" send its information? I am really, really confused. I am pretty sure I am doing something wrong. I watched this behavior before, but now it was the time to ask you guys for help, because I dont find the error. P.S.: In function Script:Start() of the AI script I set self.npcModel[1] = self.entity to be able to play the animation on multiple models at once. self.npcModel is then sent to the animation manager.
  16. FPS Nightmare is my first ever submitted game and my entry into the Summer games 2016. FPS Nightmare is a first person shooter ( hint is in the title ) where you face increasing number of enemies. New weapons spawn as you progress but ammunition is limited so don't waste it. Controls: WASD - movement R - Reload Implemented a Hi-score Table so there is an incentive to keep playing. Known problems: Game doesn't start with the main menu. For some reason it skips it and starts the game straight away. It comes back to the menu once you die thou. The credits tab in the main menu doesn't work. I just ran out of time. Hopefully I can fix this in the near future. The people I need to credit are: -Jorn Theunissen for FlowGui - Johan Ekelove aka Introspectral for his samples from "Samples of Tenalach" which I used in the music - Fellow Leadwerkers including but not limited to Josh, Rick, Shadmar, TJ, Macklebee, Beo6, Reepblue, Roland, Bluhornet, Imchassingyou and many more. Your posts and answers have made it possible for someone with no scripting or artistic knowledge to produce a game which IS ON STEAM. Link to game. Enjoy.
  17. These guys are not documented
  18. Hey guys, Besides the YouTube videos from the Leadwerks Channel, anyone know of some good LUA tutorials for Leadwerks? Any help appreciated! Thanks
  19. CorzaX24

    Shaders

    Hey guys, Yet another issue I'm faced with, and is probably real simple to accomplish but I can't seem to understand how to do it. How do I add a Post-Processing shader to my work? Not a single model, but to the entire level? Thanks in advance!
  20. I am not 100% sure if this is a bug, but the Transform:Point() function has a weird behavior for me. If it is my mistake then I am sorry and would also be glad if it can be sovled easily. This is the code I have: local direction = Transform:Point(0, 0, 10, self.entity:FindChild(0), nil) I use it for an NPC, that he is able to pick objects in the world. But my code didnt work so I tried to find the problem. After placing a small box at the "direction" vector I found out that it isnt at the transformed point, other than this it remains at the entity it should be transformed to (the "self.entity:FindChild(0)"). After that I tired to make the "Transform" function work seperatly from my npc, for testing purpose. I created a pivot and an other pivot attached to the first one. The parent pivot has the following script: function Script:Start() local direction = Transform:Point(0, 0, 10, self.entity:GetChild(0), nil) local model = Model:Box(0.05,0.05, 0.05) model:SetPosition(direction) end The direction seems to be the same as the entitys position, no matter what Vector I set in the "Transform" function (for example: local direction = Transform:Point(964, 0, 66, self.entity:GetChild(0), nil)). It does not move, but if I put the exact same code, and pivots into another project it works?? And the raycasting of my player, which is in the same scene and project, works as well. However, I also tried it creating a new map in my project but doesnt seem to work. The player has the following code for the direction: local direction = Transform:Point(0, 0, self.useDistance, self.entity:GetChild(0), nil) --self.entity:GetChild(0) is the "player eye" a pivot infront of the player Sorry if it is my fault, but I just dont know why it doesnt work, without reason??? EDIT: After some more testing I found out that setting the Transform option to the following: Transform:Point(Vec3(0, 0, 999999), self.entity:GetChild(0), nil) just works. The local space of the object seems to be extemley "sensitive". But why is this? EDIT2 (Solution): After like hours of finding the error I found it -.- I was because my npc models scale was 0.001 and not 1.0, I didnt collapsed the model in the model editor. And the Eye pivots scale was 0.001 as well. I am not sure if this is a bug or not? But I guess the local position of an object should not change, depending of its scale or am I wrong???
  21. Hey there, Just wondering if there is a place to find scripts made by others that are ready to use? I know Leadwerks comes with some, but I'd like to play around with some others too. I've had a quick look around, can't seem to find any or maybe I just missed them all completely. Thanks
  22. Hi community, I would like to talk about how to create a minimap. I made myself some thoughts latley how to realise a minimap. And I would like to collect some useful toughts here. I actually found a solution, so tell me what you think of it. It currently just works as a normal map, not as a minimap... Maybe it is very complicated what I do but thats why I created this post. Ok so I will start explaining. First of all I took a screenshot from the topview of my map. Out of this I made a simple Map, by exporting the shot to gimp or something similar. The important thing is that the map has the same propotions than the real map size. The main idea is to grab the players 3D Position and convert it to a 2D position fitting to the map size and displaying a rect at the converted 2D Position. The conversion works like this: I tell my script the real map size (you can find it out in the viewports) and the pixel size of my map. Because my map and the real map size are propotional, I can calculate a "minimap multiplier" by doing this calculation: real map size X / map size X = multiplier. Thats the first part of the puzzle I need. Second I would like to know where to draw the player start position on the minimap. Because I have nothing I can relate to, I create a "minimap origin" pivot in the scene setting it to the zero-point of our map (not the origin of the viewport!!). To convert the player start position to a 2D Vector we do the following trick explained by this code: self.playerPos = self.entity:GetPosition() local myPos = self.mapOrigin:GetPosition() self.mapOrigin:SetPosition(myPos.x, self.playerPos.y, self.playerPos.z) self.playerStartPos.x = self.mapOrigin:GetDistance(self.entity:GetParent()) self.mapOrigin:SetPosition(self.playerPos.x, self.playerPos.y, myPos.z) self.playerStartPos.y = self.mapOrigin:GetDistance(self.entity:GetParent()) self.mapOrigin:SetPosition(myPos) As you can see I move the map Origin to get the correct X and Y values for the needed 2D Vector. If you didnt forget to also tell the script where the map origin of the 2D Map is in screen space, then you can now draw the player start position correctly on your map. To calculate the movement of the player, better said his current position I do the following: self.playerOffset = Vec2((playerStartPos.x - currentPlayerPos.x) * self.minimapMultiplier, (currentPlayerPos.z - playerStartPos.z) * self.minimapMultiplier) Now you can correctly draw a rect on your map on the correct player position: local minimapOriginX = context:GetWidth() * 0.5 - (self.mapSize.x / 2) + 50 local minimapOriginY = context:GetHeight() * 0.5 + (self.mapSize.y / 2) - 10 local playerX = (minimapOriginX + (playerStartPos.x * self.minimapMultiplier) + self.playerOffset.x) local playerY = (minimapOriginY - (playerStartPos.y * self.minimapMultiplier) + self.playerOffset.y) context:SetColor(Vec4(0,0,0,255)) context:DrawRect(playerX, playerY, 10, 10) Tell me what you think of this method? If you have ideas how to improve my script just let me know. After I was recieving some help from the community I wanted to give something back. However I you think this is a very bad solution, I would be glad to know what other methods there are, I am just an amateur coder
  23. Goodday everyone! I have this random question which i have been wondering for a while now. Considering next week is my exams which i'll proudly show my created small game made with leadwerks Now the question, i noticed as soon as it gets standalone exported, it opens a console screen with the game. Now this isn't a huge problem.. But i think it'll look neater without I have tried to follow up this post a bit: http://www.leadwerks.com/werkspace/topic/6445-le3-hide-dos-screen/ However, i got a bit confused and it doesn't seem to work (Perhaps because it was le3 and not le4?) Anyone got any suggestion / tip / method for me to solve this? Thanks in advance!
  24. Hi there, I was wondering how I can do animated sprite sheets for explosions, fx effecs and waterfalls? Have searched around the forums and haven't found anything. Thanks in common. Dennis
  25. I'm having a problem getting the Cos of an angle. My code is local tum = Cos(Angle) And I get the error "attempt to call global 'Cos' (a nil value)" Things I have tried: - Lower case c for cos - Brackets around Cos(Angle) - Same error occurs if I use Sin or Tan etc - Used a script variable ie Self.tum instead of local What am I doing wrong?
×
×
  • Create New...