Jump to content

tipforeveryone

Members
  • Posts

    382
  • Joined

  • Last visited

Posts posted by tipforeveryone

  1. Hello,

     

    I have a militarybag.mdl and want to apply 2 different camoflage materials on it

    I put 2 instances of that bag into my scene then attach a lua file to one of them, here is my script:

     

    function Script:Start()
    local mat = Material:Load("testmaterial.mat")
    self.entity:SetMaterial(mat)
    end
    

     

    The result is both of bags change material. Does it mean I can not change material for each of bag instance ?

    Is there anyway to do my need ? smile.png

  2. If those aren't moving objects I would set your light to Static only. Also you can adjust your light quality within your app.lua. I'm not to sure if this has changed but the command SetLightQuality(2) should help.

     

    Thanks for your reply but it is no use smile.png

     

    What is weird about the shadow?

     

    Hi Josh,

    Look at the shadow of that cocacola can, it makes the can look like it is flying even it was placed right on top of the cartonbox

    I expected something like attachment 2 (drawn with gimp)

    post-16833-0-33654800-1471452352_thumb.jpg

    post-16833-0-28416800-1471452359_thumb.jpg

  3. Thank you, I realized that the combination of Camera:Project() and DrawImage() is good for display a health bar above character or something like that

     

    But it does not really solve my need, as the image below, there are 4 cases

    (1): Camera is outside of Spotlight's cone, Spotlight is inside Camera View.

    ~~> Player can see the lens effect but it is weak, player is not blinded

    (2): Camera is inside of Spotlight's cone, Spotlight is inside Camera View too.

    ~~> Player can see the lend effect and be blinded

    (3): Camera is outside Spotlight's cone and behind of Camera Angle Limit (I am not sure is it right to call it like this)

    ~~> No effect, player even does not see the lens

    (4): Camera is inside of Spotlight's cone but Spotlight is not inside Camera View

    ~~> No effect, of course

     

    How can I solve all of these smile.png ?

    post-16833-0-54923400-1470701374_thumb.png

    • Upvote 1
  4. I want to make an one-time Animation for my model when pressing a Key,

     

    I refered MonsterAI.lua to learn how AnimationManager works then try applying to my script, but it does not work. Here were my steps, did I miss something smile.png ?

     

    --Step1
    import("Scripts/AnimationManager.lua")
    
    --Step2
    function Script:Start()
    self.model = Model:Load("mymodel.mdl")
    self.animMan = AnimationManager:Create(self.model)
    end
    
    --Step3
    function Script:UpdateWorld()
    if window:KeyHit(Key.A) then
    self.animMan:SetAnimationSequence("attack",0.5,0.5)
    end
    end

     

     

    Maybe I did not really understand the process smile.png show me please

  5. As the title, I wanna pass a variable value to an entity right after apply SetScript() to it

     

    This is my code in CreateBox.lua

     

    box = Model:Box()
    box:SetScript("myscript.lua")
    box.script.height = 10

     

    And this is code in myscript.lua

     

    function Script:Start()
    System:Print(self.height)
    end

     

    When I run the game, it shows me that self.height has nil value

    Then I found a solution in myscript.lua

     

    Script.codeActivated = false
    function Script:UpdateWorld()
    if self.codeActivated == false then
    self.codeActivated = true
    System:Print(self.height)
    end
    end

     

    This solution can bring me the value passed from createbox.lua but it is not really effective for my project

    How can I pass variable value in the proper way ? smile.png Please show me

  6. I have a character with hand bone (name "right hand") and a gun

     

    npc.model = Model:Load("character.mdl")

    npc.hand = npc.model:FindChild("right hand")

    npc.weapon = Model:Load("weapon.mdl")

    npc.model:SetShadowMode(2)

    npc.weapon:SetShadowMode(2)

     

    There is a direction light can cast shadow on entities. If I use: npc.weapon:SetParent(npc.hand)

    then the shadow of the weapon disappears on the ground but shadow of character.

    If I don't use SetParent(npc.hand) for npc.weapon, both of shadow appear

     

    I tried npc.hand:SetShadowMode(2) combine with npc.weapon:SetParent(npc,hand) but weapon's shadow still disappear.

     

    How can I make weapon's shadow appear when it has parent entity ? smile.png

×
×
  • Create New...