Jump to content

drarem

Members
  • Posts

    234
  • Joined

  • Last visited

Posts posted by drarem

  1. tried adding listener back, am using another mono sample. This is in the start function, but should it get moved to where the entity is instead of at 0,0,0 ?

     

    Thanks.

     

    --Create a listener

    local listener = Listener:Create()

    listener:SetPosition(0,0,0)

  2. I set up the source sound looking at the api, i know my audio is a mono (1 track), but when it plays, it doesn't sound like it's in the distance on the more distant ones. Am i missing something else? Thanks.

    Start:

     

    self.sound={}

    self.sound.glassbreak=Sound:Load(self.glassbreak)

    --Create a self.source

    self.source = Source:Create()

    self.source:SetSound(self.sound.glassbreak)

    self.sound.glassbreak:Release()

    self.source:SetLoopMode(false)

    self.source:SetRange(60.0)

    end

     

    -- play this audio once when the glass breaks

     

    self.source:SetPosition(self.entity:GetPosition())

    self.source:Play()

    self.entity:SetMass(0)

    self.entity:SetCollisionType(0)

    self.entity:Release()

  3. Ok I found this, but the documenation I think lies if i read it right.. loop=false doesn't let it keep playing. once the entity is released, the sound doesn't get a chance to play. It is killed with the entity.

     

    self.entity:EmitSound(self.sound.glassbreak, 40, 1, 1, false)

  4. It's odd, that's what I have but when I access it in another function (after it has been initialized and called), then crashes with a 'nil' like it has gone out of scope. BUT if I hardcode the numbers, it works.

     

     

    myarray[fx][fy] = 0 -- nil error

     

    myarray[3][1] = 0 -- works

  5. After I've initialized the array using a function, I can do this:

     

    globals.myarray[1][1] = 0

     

    and it works, but if I do this:

     

    local fx=globals.reti

    local fy=globals.retj

     

    System:Print(...) ..

    fx, fy are now equal to 1,1

     

    This won't work:

    globals.myarray[fx][fy] = 0

     

    I get this error: 253 : attempt to index a nil value

     

    What is going on?

     

    thanks

  6. Yes, it's set as Rigid Body / Trigger under the Physics tab, with script of CollisionTrigger.lua in the script tab.

     

    I set up the flowgraph, then i right click, save as prefab. Then I deleted the object on the editor and it's loaded at runtime. I brought it back in from the prefab folder, nothing is showing up in the flowgraph editor when i select the objects.

  7. On my own function, using the flowgraph i see a plain line, where when i connect to the Collision() script I see the 'marching' dots along the line, if that makes sense. It gets triggered in the Collision() function of the elevator script, even though I change it to calloutputs("Collidex").. somehow it still triggers in the Collision() function.

     

    Trigger script:
    function Script:Collision(entity, position, normal, speed)
    if self.enabled then
    self.component:CallOutputs("Collision")
    end
    end
    
    elevator script:
    function Script:Collidex()--in
    System:Print("Triggered here.!.")
    end
    
    function Script:Collision(entity, position, normal, speed)--in
    if (self.window==nil) then self:Start() end
    System:Print("Triggered in collision function..!.")
    
     if self.window:KeyDown(Key.E) then
    self.entity:Move(0, 0, -0.001)
    entity:SetGravityMode(false)
    else
    entity:SetGravityMode(true)
    end
    
    end
    

  8. So I must use the flowgraph editor to handle a trigger? The trigger is a child of the box, but it doesn't fire off when i enter the trigger zone as a collision().

     

    function Script:Collision(entity, position, normal, speed)

    if (entity:GetKeyValue("type") == "player") then

    System:Print("In the trigger zone")

    trigzone = true

    else

    System:Print("Outside the trigger zone")

    trigzone = false

    end

    end

  9. Hi,

     

    I have a basic model, the inside of a box like an elevator you can walk into. I find I have to keep pushing against the wall of the box to register a collision. How or what would I do to increase the range of the collision so I don't have to be pushing against it? In other words, if I walk into the box the collision is registering.

     

     

    Thanks.

  10. Does it work for prefabs? I have this code and it works for the model on the map, but I saved as a prefab and spawn it it also, it doesn't display any message or open.

     

     

    function Script:Collide()--in
       if self.animationmanager==nil then self:Start()  end
    System:Print(">>> And this collision is called in turn..")
       if self.opened == false then
           self.animationmanager:SetAnimationSequence("Open",0.04,150,self,self.EndOpen)
           self.opened = true
       end
    end
    

  11. I'm at the point where I think I need to use a flowgraph. I have an invisible trigger box parented to an animated treasure chest. When I run into the trigger I want the animation of the chest to play (by opening)..

     

    I added the CollisionTrigger.lua to the box, added to flowgraph and i see three functions in the flowgraph. So far it looks good.

     

    For the animated box, i have a script to open/close the box, but when i move it to the flowgraph, it has no functions. How would I set it up to receive the input, to trigger the animation?

     

    thanks.

  12. I think in the steam account you set up a number of hard coded 'achievements'.. then you do a SetAchievement('hard coded achievement'), to set it to true to make the achievement 100%. For the increment, dont see how that works yet, but i'm guessing you can go from 0 to 100% for a certain achievement such as number of kills or what not.

    • Upvote 1
×
×
  • Create New...