Jump to content

Phodex Games

Members
  • Posts

    275
  • Joined

  • Last visited

Posts posted by Phodex Games

  1. 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?

  2. 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 smile.png

     

    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

  3. 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.

  4. 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.

    • Upvote 1
  5. 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.

  6. That was really informative, thank you for the very detailed description smile.png. 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 ^^

  7. Re-read the sentence from Josh that you quoted and you have the answer to your question:

    "If you sell items in the Workshop Store, Valve will take 30% and Leadwerks will take 20%."

     

    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 :)

    • Upvote 1
  8. Hi,

     

    I have a small problem. I am currently working on a spellsystem. For this I created a "Spell Effects Library.lua" file, which contains any possible effect that a spell could cast to easily access the effects. I have two types of spells. Spells on target and on self.

     

    The "on self" spells get casted in the player script:

    import "Scripts/Spell Effects Library.lua"
    .
    .
    .
    if KeyHit then self:CastSpell(something) end
    

     

    The script for the Library looks like this:

    function Script:CastSpell(something)
    .
    .
    .
    end
    

     

    So far so good. For the "on target" kind of spells the shooten projectile casts the effect on hit. Those code is just for visualization:

     

    import "Scripts/Spell Effects Library.lua"
    .
    .
    .
    if hit then self:CastSpell(something) end
    

     

    So If I shoot a projectile now and it hits its target it says "attempt to call method 'CastEffect' (a nil value)". BUT if I delete the import line at the player script it works just fine. It does not seem to be possible to import the same script into two other scripts? So could you help me please? How to manage this?

  9. You can make and sell your games royalty-free. If you sell items in the Workshop Store, Valve will take 30% and Leadwerks will take 20%.

     

    Is this only for the Steam Workshop or is there also any Royalty (the 20% taken by Leadwerks), if you offer items on diffrent platforms then the Workshop. For example a model pack for Leadwerks on itch.io?

  10. I faced the same kind of problem with my project. So far I didnt found a perfect solution, but its fair enough.

     

    1. After you rigged and modeled your character, export it without any clothing.

     

    2. Now if depends on what type of clothing you have. I will cover both types:

     

    2.1 Full/Half Body Clothing: Models covering a larger area of your character (trousers, pullovers, tshirts, armors) need to have an own rig. Now export the affiliated cloth model and attach the nessecary skeleton parts to it (for a t-shirt just the bones for the Arms/Hands/Shoulders for instance). In Leadwerks I prefer to add a body and legs slot to my character(s) in form of a pivot. Then I parent the cloth parts to the affiliated pivots. My script plays animations for every model parented to the leg and body pivots as well as for the character body. The cool thing first: You dont need to extra export animations for your clothing, because you can use the "Load Animations" function in Leadwerk's model editor, so if you add new animations you dont have to export all the clothing again. The bad thing is if you want to change your rig than you have to do the same for every clothing part by manual, BUT you normally have finished your skeleton before creating serious armor/clothing asset so its a good deal.

     

    2.2 Thats the cooler thing. If you have just clothing parts like arm protection, leg protection, gloves, weapons etc you can simply parent them to the affiliated body rig bone. So if you have an arm protection like this (http://www.andracor.com/out/pictures/z1/sol_armschienen-warlord-braun_1_z1.jpg) then you can attach it to your arm bone and the clothing will follow this bone and 100% works with any animation played by its parent. So no rigging, no animation loading. I really like it :)

     

    3. Dont forget to tell you script to play the animations for each cloth part.

     

    Note: I tried to add the bodies skeleton scriptwise to equipped clothings, but leadwerks struggles when accessing bones in the editor or with coding.

     

    I hope this helped :)

    • Upvote 2
  11. Hi,

     

    Since i installed Windows 10 my leadwerks window is cut off on the right hand side. I have to active monitores, but that did'nt made any trouble when I had Windows 7 installed. Anyone having the same problem, I would really appreciate if you could help me out, its pretty annoying because its hard to grab the scroll bar or click little icons on the right. If I open the script window for lua the first time I start Leadwerks it snaps to the top of the screen, even futher so that I can't click the Close/Maximize/Minimize buttons. I have to resize it a bit to bring it back. Disabling my second monitore didnt help. My main monitore has a resolution of 1920 x 1080 and the problem just occures with Leadwerks.

     

    Thanks if you are able to help me smile.png

     

    Thats how it looks like:

     

    https://www.dropbox.com/s/locsgzhubl3lbe0/Leadwerks%20Window%20Problem.PNG?dl=0

    • Haha 1
  12. First of all, thank you for the answer smile.png

     

    [...]are you running this code under your main loop?

     

    I think with main loop you mean the Script:UpdateWorld() function, if so yes it is running there.

     

    Keep in mind that FileSystem::WriteFile creates a NEW file and writes to it, or OVERWRITES existing files[...]

     

    Yes I know I want to overwrite the savefiles every time I save, because otherwise the savedata begins to stack in the file.

     

     

    [...]unless you're writing code to this file it really doesn't have to be a Lua file.

     

    That is exactly what I am doing smile.png and even then it doesnt have to be a lua file, you can call the extension whatever you want, Leadwerks can read it back in.

     

    P.S.: Just tried your code and it works! Well I made a very stupid mistake, but I didnt know that it is needed, I am not very common with the stream operations. Yes I needed the stream to be open, BUT I forgot to release it at the end ^^ thats why it only writes my text after I quit the programm. However thank you very much smile.png

    • Upvote 1
  13. Hi Leadwerks fellows,

     

    I run into some trouble creating an save system. I noticed that when I saved I couldnt immediatly reload my save, to load it I had to restart the "game".

     

    I will make it simple. To exclude other errors, I wrote this short line of code:

     

    if window:KeyHit(Key.F1) then
    self.test = FileSystem:WriteFile("test.lua")
    self.test:WriteLine("Test")
    System:Print("executing")
    end
    

     

    And again I noticed that while I am executing the programm and hit F1 (put a print function there to double check) and alt+tab the game and check the file, its empty. I use notepad++ to watch the file, and if I hit F1 it detectes a change and after reloading the file still nothing. Even if I close the application now, still empty. I need to close the whole file and open it again then I can see the text, but its not only a matter of visibility, I also tried to read the written text after saving it in the same session, doesnt work. So I guess the stream:WriteLine() operation gets executed on exit?

     

    Is there any way of how to work around this or am I missing something. Maybe its possible to refresh the scene/word/app etc? I dont know, but I remember loading and saving in the same session was possible once...

     

    However I would be very glad if someone would help me out smile.png

     

    P.S.: Lua sandbox is DISABLED!

  14. What do you mean with "full physics", I guess you want your AI to move on organic terrain like Mountains etc? Do you? Well other than using the Navigation commands, you can create your own kind of movement, using 100 % accurate physics. This works by setting your AI's model (Body) physics to prop for example and handle the movement with force commands. I woudnt recommend this. I actually used a technique featuring this, for a former project, because the engine I was using didn't support any navmeshing or similar tools.

     

    Because I havent tried AI/Navmesh behavior for organic landscapes I cant tell you how it works or behaves...

  15. Hi aldoz,

     

    Maybe you give us some more information, maybe part of the code or something. My tip is you start creating your own AI, search the web, gather information needed from the API Reference. Why? Well thats the best way learing how to fix problems on your own and to understand unfamiliar code and the community is still here to help you if you need it.

     

    Now lets come to your problem. In Leadwerks it is very easy to make an entity follow your player or go to a point.

     

    You can read more about this features here:

     

    Follow: http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entityfollow-r697

    Go To Point: http://www.leadwerks.com/werkspace/page/api-reference/_/entity/entitygotopoint-r700

     

    This functions uses navigation mesh, so dont forget to build a NavMesh for your map!! I guess that may be your fault? Because if you use the original MonsterAI.lua there isn't much you can do wrong.

    • Upvote 1
  16. Well, I think I didnt 100% get what you explained, but the problem is how to just draw part of the map. So I have my whole map as an image file. But Leadwerks just offer the "DrawImage" function, how should I hide some part of the map?

     

    Then you get some points of your actual map ( top right and bottom left for ex.) and from their x and y coordinates you calculate the values where the player is on the minimap

     

    With this I should apply the "scrolling" of the minimap, that the map knows where the player currently is?

  17. Yes, but I think you dont have that much of drawn objects at the same time, this could maybe appear on a super huge open world map, and for a minimap you can just show nearby object. That question is how to make my map look like a minimap, and how to just show a part of the map. I dont know how this should be possible...

  18. 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???

    • Upvote 1
×
×
  • Create New...