Jump to content

Phodex Games

Members
  • Posts

    275
  • Joined

  • Last visited

Everything posted by Phodex Games

  1. Does nobody has any idea?
  2. Maybe this helps? debug.sethook should work, but in the offical API you just find this and that. Just tried that, debug.sethook, what you find in the offical LUA API also works in Leadwerks. But I dont know how to use the "AddHook" function. You seem to need any kind of keyword in addition. However Leadwerks does not seem to recognice "AddHook" as a keyword. But I think debug.sethook should do the job.
  3. Hi, I thought about how to realise this aswell. I never actually did it yet, but as far as I know you need to use the thread functions and then run your code/call your animated picture in there. Correct me if I am wrong. But dont ask me how to put a animated Image into Leadwerks...
  4. Hi Simple question, I cannot find a GetAnimation and GetAnimationFrame function in the API. I realised those functions in my own AnimationManager script manually, but since there is the "new" entity:PlayAnimation function how to get access to this functions? Any ideas or suggestion? EDIT: Would also be good to know how to get animation index by name and the other way around. Something like: self.entity:GetAnimationName(0) or self.entity:GetAnimationIndex("Idle"))
  5. Okey after playing around a bit and deleting all animations & armature it worked. Could you tell me how you deleted those animations? I always struggle a bit when deleting animations in blender I dont really know how to do it ^^. Still I dont really know what the animations have to do with that distorted rotation, isnt this a thing which should not be? Well what ever, thank you a lit for you help and time. At least I know now where the mistake was
  6. The exporter does not let you export seperate objects within an amature. You need to completely seperate the object that the exporter plugin recognize it as seperate object. Okey see the changes I made above! Here is the blend file. Sword Test.blend
  7. If it just would be that easy... I tried the exporter of course, but with it, I cannot export the models seperatly somehow. If I select the sword and export with "Export only selected objects" ticked, Blender says "Couln't find any exportable objects." Just tried again. The exporter works even worse. Look what happens after export inside blender BEFORE: :: AFTER USE OF EXPORTER: And no the model doesn't appear like in the first picture, nor does it like in the second picture, after I imported it into Leadwerks. Really annoying if you try to make some precise first person animations!
  8. Hi, I have this annoying problem for pretty a while. I currently was trying to figure out the error, but I am no master at Blender so maybe its my mistake, maybe you have to take care on something in Leadwerks? Look thats the problem: 1. That is how I set it up in Blender: 2. Now I export the hands model and the sword model (in the fbx model format) seperatly and import them into Leadwerks. After I put them into the engine, adjust their scale and zero their position and rotation it looks like this: And yes I did apply the rotation, location and scale in blender. Why the heck doen't this work? I get some trouble with my animations with that, because I put the sword to an bone handling the weapon position within the animation. There is this "Forward" and "Up" setting when exporting the fbx, maybe you need to take care on that? I dont know, I would be very very glad if you could help me because that makes me freak out NOTE: I adjusted the scale of the sword, because it had completely diffrent dimensions, like 100 times bigger, thats why it looks diffrent scale wise. However the biggest problem is that its rotation is wrong.
  9. I personally would not recommend Leadwerks, for 2D game development, altough its a cool software. Maybe go for GameMaker Studio, which I tried and can recommend!
  10. Okey just did this and it kind of is part of the fix, it also seems to be important, if you render the text to keep the following order: 1. Set context blend mode 2. Set context font 3. Set color 4. Draw text EDIT: Ok still found an issue it seems to depend on the font size: Font size 12: Font size 20: Font size 50: The code where it gets drawn is: --I use an renderer class, which renderes all my objects in on script, to handle render priority: --current stands for the current rendering object context:SetBlendMode(current.blend) if current.font ~= nil then context:SetFont(current.font) end context:SetColor(current.color) context:DrawText(current.text, current.pos.x, current.pos.y)
  11. Hi I have a small problem. I think the pictures should explain it pretty good With font size of 12 see the terrible cut on the top?: With font size 20 it is a little bit better but somehow not as sharp as it should be; This is how I would expect it to look like: I am rendering the text with the default arial.ttf font, I render the following color Vec4(0, 0, 0, 255) and with blendmode Blend.Alpha. So whats the problem? I remember the text rendered sharper another time, but I dont know what I am doing wrong atm? Any suggestions?
  12. Hi Jorn, how to check if the entity is initiated? In my case the player gets spawned and then the player "spawns" another entity which then gets loaded by the players loadfunction. By the way the object the player spawns is an prefab. However I worked around the problem by changing the whole spawning process. However the problem still remains. I often have trouble with prefabs the Start function and script variables. Just wanted to gather some experiences etc.
  13. Hi, I pretty often encounter the followning problem: I need something to be called before, or after the Start function of an script. My actual problem is that I have an NPC and his "Load" function (I wrote by myself) is called before the script actually is initiated. The problem is, in the load function some values are set (like npc health) but then the script gets initiated and the script uses the default script value of 100% health and the loading does not work. A workaround I found is to use the first step of the update function but I find this not very smart. Here an example: function Script:UpdateWorld() if self.doOnce ~= true then --do something here self.doOnce = true end end Any ideas how to solve this more elegant? Would be really glad if we could gather some ideas Markus
  14. I did some debugging etc and kind of fixed the Problem better said worked around it like the following: --DOES NOT WORK: self.firstSlotOffset.x = self.firstSlotOffset.x * context:GetWidth() self.firstSlotOffset.y = self.firstSlotOffset.y * context:GetHeight() --WORKS: self.test = nil self.test = self.firstSlotOffset.x * context:GetWidth() self.test = self.firstSlotOffset.y * context:GetHeight() So I think you see the problem. Still I dont understand what the problem actually is. I encountered the same kind of problem for some other scripts as well. Would be glad if somebody could explain this. P.S.: Currently have no working internet at home so it can take a while until I reply
  15. Hi Rick. Yes this is exactly what I meant. I will do some debugging and researching on this, but could this be a Leadwerks bug maybe? Maybe I made some mistake somewhere we will see...
  16. Well maybe I formulated this wrong. I mean variables don't get saved on their own if you change maps. The weird thing is it works the first time, but second time I change the map it doesn't. Even tried diffrent maps. I also tried the Cleanup function & the Detach function to set the variable to nil, but still the problem exists.
  17. Hi, I have a general inventory script attached to every object, which should have an inventory. In the script settings of the inventory script I put an "firstSlotOffset" value, to adjust where the inventory starts to render its slots. In code this looks like that: Script.firstSlotOffset = Vec2(0, 0) --Vec2 "Slot Offs." In the start function I do some calculation: self.firstSlotOffset.x = self.firstSlotOffset.x * context:GetWidth() self.firstSlotOffset.y = self.firstSlotOffset.y * context:GetHeight() The problem is if I load to another map and back to some other map the self.firstSlotOffset value seems corrupted. This happens only after I loaded twice (so changed the map two times). I found that out by printing the self.firstSlotOffset value in the start function. What I mentioned is if you loaded twice the self.firstSlotOffset value is not what is set in the script settings but the result of the above calculation which should not be. If you change a map, all variables should be "nil"-ed shouldn't they? And by the way what do you have to take care on when loading to an new map? Do you need to clean stuff up and if yes which stuff? I guess that could be the problem that I didnt clean up. P.S.: The error only appears for the player inventory, which is the only entity staying the same on both maps I load to.
  18. Hi, I personally use Dropbox and load the project directly out of the Dropbox folder, so I dont have to copy my files everytime. This works pretty good so far. Just download Dropbox for your Desktop, put your project folder into the local Dropbox folder and in the Leadwerks projectmanager import that project, but I had some issues now and then with overlapping files (luckily Dropbox always keeps both files) and Dropbox sometimes seems to block leadwerks from accessing specific files like maps.
  19. EDIT: Just found out that the error was somewhere else ^^. The below code just works fine. Anyway thank you for the help :). Hi there, I faced some weird behavior, testing and debugging my project. The following shows the structure of my code, it would be very kind of you, if you could tell me if you can find any error, because I dont. Maybe I messed around with global/local/script variables, which I know, often cause such errors. Explanation: Of course this script makes no sense, but it should only representate the structure, because it would be way to complicated to explain the issue within the actual script. So what is the problem? When I apply the "Main Script" to one entity, everything works fine and I get printed the data. but if I apply the "Main Script" to more than one, for example two, then the problem occurs. In the output I get the "Send my data!"-message, but now comes the weird thing. It prints the data and then, even if the "Test"-function is just called once it prints "Variable data is nil!" twice. And this happens for both entitys. So this is my output with two entities with the "Main Script": Send my data! Test Variable data is nil! Variable data is nil! Send my data! Test Variable data is nil! Variable data is nil! Main Script: Script.dataToSend = "Test" Script.data = nil import "exampleScript.lua" function Script:Start() self.myLuaClass = testClass(self) end function Script:Test(data) if data ~= nil then System:Print(data) else System:Print("Variable data is nil!") end end The "exampleScript.lua" Script: function testClass(script) local container = {} function container:CallMeFromAnywhereToSendSomething() self:SendSomething(script.dataToSend) end function container:SendSomething(sendData) if sendData ~= nil then script.data = sendData end if script.data ~= nil then System:Print("Sent my data!") script:Test(script.data) end end return container end Addition: I was able to work around this issue by simply checking if the variable is nil, or not (I actually need/do stuff with the "data" variable in my actual script), but still I am confused. Maybe you can help me out. If you find other mistakes, or have improvement suggestions for my "Class" system please tell me. Thanks for reading
  20. Hi Jorn. That sounds like a good idea. But I would appreciate if you could get a little bit more into detail. How to outsource my UI elements, or how to add them to the "list" and where do I actually render all my elements then? I cant get a clear idea how to realise this by my own sorry . I am no expert in lua coding.
  21. Hey guys, I was searching the forums for a releated subject, but I couldnt find one, but I could imagine there is one, if so I am sorry to post the same topic again So I am currently trying to come up with a way to handle diffrent objects rendering in the right order. What solutions have you for this problem. For example: I have a trading menu, but my cursor is rendered behind the inventory slots and buttons rendered by the NPC Trader entity. (elements of my trading menu are rendered by two diffrent entities (Player and NPC Trader)) I was thinking about something where you can set a variable "renderPriority" which indicates in which order objects are rendered. So if render Priority is 1 those objects "PostRender" function is called before all the others, then come entities with priority 2,3 and so on. Thats the point I am stuck . How to make the other PostRender functions "wait" unitl the PostRender function of an specific entity is finished. This I a problem I occured pretty often and havent found a solution yet, I mean that you control the order entities call functions like UpdateWorld() or PostRender(). Would really appreciate if somebody can come up with an idea
  22. Hi, I just found a little, but kind of frustrating bug (was frustrating to find it out ^^). If you load an prefab, its children's "Start" functions were not being called in earlier version of Leadwerks, this is what has been fixed fortunately. BUT the system, or whatever you wanna call it, skips the entities, which are children of an entity which has NO script attached. The fix is to attach an script to every entity of your prefab so it does not skip any of your child's. I hope this helps and gets fixed soon. MadMorra
  23. Thanks to all of you for your help I gues that should get the job done. I really appreciate your numerous suggestions . I am sorry if this topic is solved already, but I couldn't find anything useful in the forum.
  24. 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.
  25. I meant that was the problem with my old attempt, I think there is no problem with your method . Thanks a lot for the help great!
×
×
  • Create New...