Jump to content

Genebris

Members
  • Posts

    517
  • Joined

  • Last visited

Posts posted by Genebris

  1. I guess there is nothing wrong with your model. You simply need to apply material with animated shader to it to see the animation. Simply drag for example a crawler material to your model in model editor in leadwerks and you will see the animation.

    This third bone that looks like it's turned in the wrong direction probably just connects armature with the center of the model. I have this extra bone in my arm model even though I don't see it in blender. And I don't know where is actual third bone that should be in ghosts body, it's missing for me too, but I think the animation works properly anyway.

  2. I also have the same problem with your model. I'm using Leadwerks exporter, setting scale, rotation and position via Ctrl+a didn't help. Bit I don't see what can be wrong with your model.

    I didn't have this problem when exporting my own model. I was using default blender skeleton, try using it.

  3. I thought start is called for all entities, but if it's not, you can just call it yourself from player start function for example. Find where weapon prefab is loaded in player script and then call weapon's start.

     

    I have just came across the same problem so I added start call myself:

    w=Prefab:Load("prefabs/weapons/"..self.equipment["weapon"]..".pfb")
    w:GetChild(0).script:Start()
    

  4. Yes, pistol is a child of the camera. And I guess you can get ammo like this:

    "self.weapon.ammo" if you call it from player script or "self.player.script.weapon.ammo" if from something else.

  5. I don't really understand it well myself, but here is my RPG script that I imported into player script and monsterAI script:

     

    RPG={}
    function RPG:Create(entity)
    if entity==nil then Debug:Error("Entity cannot be nil.") end
    local rpg = {}
    rpg.entity = entity
    local k,v
    for k,v in pairs(RPG) do
    rpg[k] = v
    end
    return rpg
    end
    function RPG:IncreaseSkill(skill, progress, calculateProgress)
    local script=self.entity.script --self.entity is an entity I pass to the create function
    script.skills[skill]=script.skills[skill]+progress
    --cleared this function from unnecessary stuff
    end
    

     

    When this script is imported, I call

    self.RPG=RPG:Create(self.entity)
    

    in the Script:Start in the player script. Now I can use IncreaseSkill like this:

    self.RPG:IncreaseSkill("Swords", 0.03)
    

    And I can do the same in monsterAI script and IncreaseSkill function will increase monster's skill variable.

    • Upvote 1
  6. I have a script with a function that prints text to the console:

    function Script:TestFunction()
    System:Print("TEST PRINT")
    end
    

    When I import this script into player script and call this function in Script:Start everything works fine.

    import "Scripts/Player/TestScript.lua"
    ...
    function Script:Start()
    self:TestFunction()
    ...
    

    But when I also import this script into MonsterAI script calling this function from player script gives me error like this function doesn't exist there (attemt to call method 'TestFunction' (a nil value)).

     

    I wanted my RPG related functions to be imported into player script and NPC script and be able to access their variables through these RPG functions. For example:

    function Script:IncreaseSkill(skill, progress)
    self.skills[skill]=self.skills[skill]+progress
    if self.skills[skill]>100 then
    self.skills[skill]=100
    end
    end
    

    I noticed that default scripts like ReleaseTableObjects.lua use global functions and only variables passed to these functions. Do I have to do the same?

    function IncreaseSkill(character, skill, progress)
    character.skills[skill]=character.skills[skill]+progress
    if character.skills[skill]>100 then
    character.skills[skill]=100
    end
    end
    

  7. So I need to take bottom polygon of the first cylinder and move it to the position of the pivot between first and second cylinder? Then I need to set rotation of this polygon to pivot rotation and then I need to do the same with top polygon of the second cylinder?

    Haha, smart!

    I'll try this, thank you guys for helping.

  8. Barrel is just an example of normally working prop without any collision shape. I can't understand why bone doesn't work like the barrel.

    I can't set any shape to the bone. When I press Fit shape on the rope mesh it works and orange parallelepiped appears, when I load a .phy file for this mesh it works as well and orange box appears too. But when I fit shape or load the same shape file for the bone, nothing happens. I can't apply shape to bones from another model I previously created as well.

    It seems like bones can't have shapes.

    Maybe I can use simple meshes instead of bones? Can I attach rope's skin to other meshes instead of bones?

  9. You need to set a mass as well as a shape.

    But when I delete shape of the barrel (set it to none), it still falls down like a normal prop. but it doesn't collide with anything.

    Ok, how can I set a shape to bone? I didn't manage to do this with "Fit shape" button or with .phy file.

  10. I have made a rope model and attached bones to it, I can properly move bones in the editor, but when I add mass for one of the bones, this part of the rope simply disappears. How can I make bones act like props so I could connect them with ball joints?

    post-11962-0-36739700-1407525054_thumb.png

    post-11962-0-50017500-1407525063_thumb.png

  11. self.inventory = {}

     

    self.inventory["sword"] = {}

    self.inventory["sword"].dps = 15

    self.inventory["sword"].cost = 150

    self.inventory["sword"].icon = Texture::Load("")

     

     

    Each element in your inventory table can have a table as well that stores all your stats for that item.

    Is describing all items in the game in a script the only way to do that?

  12. I want to create an inventory. I imagine this as a table that contains names of items that player has in the inventory. When the player opens inventory menu, script loads prefab of the first item in the inventory, display it's icon and values such as damage or price, and the it does it for all other items in the table.

    But Prefab:Load also creates an entity. Of course for icon I can just take a name of the item and open a picture with this name, but how should I get item's stats?

×
×
  • Create New...