Jump to content

Healp with steam-powered robot


NikMik

Recommended Posts

I've fixed the issue.

 

As a part of my mod, I'm adding a steam-powered robot as a follower. He does emit steam ever now and then, but I haven't been able to add sound when he emits steam. And it's currently coming out of his foot.

If anyone could tell me how to position the steam and add sounds, I would be very grateful.

 

 

 Here's the coding for the steam:

 

    inst:AddComponent("periodicspawner")
    inst.components.periodicspawner:SetPrefab("poopcloud")
    inst.components.periodicspawner:SetRandomTimes(5, 15)
    inst.components.periodicspawner:SetDensityInRange(20, 2)
    inst.components.periodicspawner:SetMinimumSpacing(0.1)
    inst.components.periodicspawner:Start()

 

I set it to play the sound and emit the smoke when I feed him gears.

http://www.youtube.com/watch?v=YudCvlVAELw&feature=youtu.be

 

Thank you.

I also noticed the typo on the forum title. Didn't notice untill I'd hit post.

Link to comment
Share on other sites

  • Developer

As a part of my mod, I'm adding a steam-powered robot as a follower. He does emit steam ever now and then, but I haven't been able to add sound when he emits steam. And it's currently coming out of his foot.

If anyone could tell me how to position the steam and add sounds, I would be very grateful.

 

 Here's the coding for the steam:

 

    inst:AddComponent("periodicspawner")

    inst.components.periodicspawner:SetPrefab("poopcloud")

    inst.components.periodicspawner:SetRandomTimes(5, 15)

    inst.components.periodicspawner:SetDensityInRange(20, 2)

    inst.components.periodicspawner:SetMinimumSpacing(0.1)

    inst.components.periodicspawner:Start()

 

I set it to play the sound and emit the smoke when I feed him gears.

http://www.youtube.com/watch?v=YudCvlVAELw&feature=youtu.be

 

Thank you.

I also noticed the typo on the forum title. Didn't notice untill I'd hit post.

Could you please upload your mod?  It makes it much easier to help you out :).

Link to comment
Share on other sites

I couldn't exactly make it randomly happen but I could make it so he emits the smoke/sound whenever performing an action with a few simple commands in the Setgraph. I only set it to whenever he triggered the "run_start" state, which works very well; not spamming smoke everywhere, but activating only when he begins running and during the short stops during running.

 

Here's the state with the smoke. The bold/underlined text is the added coding.

 

State{
        name = "run_start",
        tags = {"moving", "running", "canrotate"},
        
        onenter = function(inst)
            inst.components.locomotor:RunForward()
            inst.AnimState:PlayAnimation("run_pre")
            inst.sg.mem.foosteps = 0
        end,

        onupdate = function(inst)
            inst.components.locomotor:RunForward()
        end,

        events=
        {   
            EventHandler("animover", function(inst) inst.sg:GoToState("run") end ),        
        },
        
        timeline=
        {        
            TimeEvent(4*FRAMES, function(inst)
            local pos = Vector3(inst.Transform:GetWorldPosition())
            pos.y = pos.y + 1 + math.random()*1.5
            local cloud = SpawnPrefab("poopcloud")
            cloud.Transform:SetPosition(pos:Get())
                inst.SoundEmitter:PlaySound("dontstarve/creatures/rook/steam")

            end),
        },        
        
    },
 

Not very specific, I know.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...