Jump to content

Phodex Games

Members
  • Posts

    275
  • Joined

  • Last visited

Everything posted by Phodex Games

  1. Thanks I definetly learnt something new about lua . I always wondered if it is possible to get a variable by its name per string. However your solution sounds very good, I will try that out for my save script . The problem I had, was that I needed to also access an element within the table and I struggled figuring out a way to search for a keyword within the file. So for example in the player save table (say there is position, health, rotation, current level etc) I just want to overwrite the healt value. But I have a question. What does string.sub exactly do?
  2. Hi Leadwerkers , Currently I am figuring out what would be the best way to save my game. What options there are for saving a table or varibles in general, and what options have you come up with? What I am working on at the moment was, to write a savedata table into a file like this and call it back with "dofile": return { someData = "Test"; someOtherData = "Tes2t"; } But this method is pretty tricky, not only have do you have to convert the variables into strings to save them, but it also is complicated and I think its no clean and fast solution because you have to work with the stream and filesystem command and "manually" write your data into a lua file. There is the System:SetProperty() command, but there you only can save strings as well. Are there any other commands Leadwerks offers? Another engine I worked before had a save command, where you can save any lua variable in (tables, strings, numbers everything) and then call it back. So tell me your attempt, what have you come up with? I want a system, where I just say: Save that variable and load that variable back on demand. If leadwerks does not offer such function itself I would be very thankful if you can link me tutorials, ideas or anything else which helps me building my own savesystem. Sorry if the english is not perfect Phoenix
  3. Ah okey I will try to release the stream, that could make it ^^. I have sandbox mode disabled, thats not the problem.
  4. 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))
  5. I think there actually is a prefab script for this. Search the project folder and go to Scripts, there should be a third person player controller. Without offending, and it is possible, but if you can't even code a third person controllr in Lua and or C++ I fear you won't be able to create a Tomb Raider game. You can learn but its pretty hard just saying.
  6. Hmm, thanks for your answers, so it seems to be a bug. Thats pretty ugly actually. So I now need to find I way to work around this. @Genebris your solution sound interesting, but as I am no master at coding, I don't understand that line of code you sent me. Whats that "main.system" part at your function? And what does entity.script,a,b,c? I am a little bit confused. However I think I can find my own solution for that. Maybe I write a small class for that I can import, which calls the start function of all of an entites children.
  7. Hi Leadwerkers, I have a problem. I would like to load my player prefab file, when the map loads and put it to a specific position. So I created a script for that. It loads my player prefab on start. The problem is, the Start function of its entities does not get called. I was able to fix it in a way but I still have a porblem. I told my main player script to call the Start functions of every childs script. The problem is some childs have childs aswell, and this child have other childs and so on. So why do the Start functions not work if I load a Prefab of my player which has many childs? Is there any fix? Suggestions? Am I doing something wrong? Or how to access every! child, and the childs of the childs etc of a singel entity, to then call the start function. I could make a ridiculous amount of loops, but thats pretty unefficent and stupid. Thanks for the help, Mad Morra
  8. MorraFramework is the name of my project ^^. What you see is the path to my project folder. What do you mean with VS project? Visual Stuido? If so I own the indie edition and just use lua...
  9. Hi guys, I get some weird behavior with my project. Maybe it was not the best idea to update my project files, but since the 4.2 beta update I get the attached crash screen, when I start my game with debug mode. When I start it normally, then it crashes sometimes and somethimes not, which is very weird. I also had to change some of my code, which worked before the update. Were there any syntax changes or is there any documentation, if the update changes some major stuff, regarding the lua coding? I think this is really annoying and makes Leadwerks not very enjoyable to use . Can you help me? Maybe I am doing something wrong.
  10. Actually, now that you are saying this really would be a cool feature, would make live easier to build levels.
  11. Just start coding and if you have more specific problems, and struggle going on yourself, feel free to ask in the forum, you also can ask me I am always willing to help if I can
  12. Ok thank you always willing to learn something new about game development!
  13. Ah ok cool that was what I am searching for cool thanks both of you!! P.S.: Could somebody quickly explain what AABB is? I am a little confused of it and I would like to know how it works.
  14. What would be the best way to get a specific type of entity in an area? I am currently working on my AI and I want it to search a weapon, if it has no at the moment. So I want it to check its sourrounding for a weapon. Whats the best way to do it. Or I could need it that my AI can check for enemies in its sourrounding. I thought of getting all entities in the scene (world) check their distance to the AI and if it is smaller then the AIs sense radius, then it checks them for the type (for example if it is a weapon or not) and returns to the AI. So whats the best way to get specific entities in a defined area (for example around a NPC)? Any ideas on how to make it better then the concept I have?
  15. hey this looks cool thanks for sharing I will give this a try
  16. If I would have more time I would explain you exactly how to handle your animations problem. Because I dont maybe check out this video it helped me a lot. I know its not for Lua but if you are aware of coding a little bit you will understand what is going up and can do the same for lua (I also am not coding in C#). Video: About the flickering light, isnt there a light flickering script in one of the leadwerks prefab projects?
  17. You can actually. I tried it, but I am not 100% sure if the tool is very good. I could not select the common dimensions Leadwerks (and nearly every other program uses) has. You can only select 300x300 600x600 and values like this. But I cant say for sure havent spent much time with the tool yet. But you can export as an .png file and easily import it to leadwerks. I think this may be a cool tool so quickly create a basic shape for your terrain and fine tune it in leadwerks or other programms, because I does a quiet good job in generating... I would say try it, it doesnt get any cheaper P.S.: I edited the .png file in a graphic programm to make it fit 256 x 256 for example, but I am sure you can change the size in geovox somehow
  18. Hi MadCat, I bought GeoVox just yesterday and I just wanted to let you know that you can get it for 3.19€ including some other stuff from axis game factory. Its really cool, just wanted to let you know, so you don't need to spent that much money Note: The offer ends in 7 days. LINK: https://www.bundlestars.com/en/bundle/axis-game-factory-complete-bundle P.S.: No I am not advertising this product ^^ I was just happy to find this tool for such a low price.
  19. Ok thanks for you answer, but I am still a bit confused. I do not get were exactly the mistake is? I declare my class in the start function as well as the self.playerModel variable, or is the problem the model table I have in my class. So how to fix my issue. Sorry I dont get it completely... EDIT: Oh I had this npcModel variable 2 times at the beginning of the script ^^ well my fault didnt saw that. It works now.
  20. 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.
  21. I am not much into shaders, and I may be completely wrong, but maybe you need to make the leaves always face the player...
  22. That was really informative, thank you for the very detailed description . I always love to learn new stuff to sweeten and shorten my code. And I understand the thing about the two scripts per entity. I know that as a user of a software you often don't think as far as the developers did and for me this feature isnt that kind of a big deal. There are other and also very cool ways to get the same effect. Can't wait to try out the newly learnt method ^^
  23. I think the way Genebris mentioned is very cool. I need to create a globale for the "Animimation Manager-like" classes anyways. As gamecreator says if you keep them organized it should work fine. What other method would you suggest Rick?
  24. Ok thank you guys. Will try that out. @Rick: Yes I always wondered why you cant attach more then one script to an entity? Well you can work around it but sometimes it is really annoying.
  25. The point is it is not mentioned that there are royalties on other platforms, which does not mean there are no, but I guess I got it. Haven't expected royalties on other platforms, but there is no reason for not double check this
×
×
  • Create New...