Lua Element Script

  • Sylvi
    1st Aug 2012 Moderator 0 Permalink

    Does anyone have an example for one element to transition to something else if it comes in contact with another element? It would be really helpful for me,

    Thanks!

  • mrsalit0s
    1st Aug 2012 Member 1 Permalink

    here is a very simple script from the forum (cant remember who posted this)

    function growth(i,x,y,s,n)
    type=tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
    if type==tpt.el.watr.id then
    tpt.parts[i].type=tpt.el.plnt.id
    end
    end

    tpt.element_func(growth,tpt.el.wood.id)

     

  • Sylvi
    1st Aug 2012 Moderator 0 Permalink

    @mrsalit0s (View Post)

     Will it for example be able to be used in lava and weater turns to obsidian? Because I'm not fully understanding the piece you just posted.

     

    EDIT:

    For example: Iron comes in contact with 400* salt and turns to Iron, but with more heat resistance.

  • mrsalit0s
    1st Aug 2012 Member 1 Permalink

    if i understood you right, yes. try this in your autorun.lua

    function growth(i,x,y,s,n)
    type=tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
    if type==tpt.el.watr.id then
    tpt.parts[i].type=tpt.el.glas.id
    end
    end

    tpt.element_func(growth,tpt.el.lava.id)

     

     EDIT: okay i've tried the script but there is no visible effect because lava is changing to stne anyway if cooled down.. changed STNE to GLAS, now it has a visible effect

     

  • Sylvi
    1st Aug 2012 Moderator 1 Permalink

    Alright I'll give it a try, thanks!

  • mrsalit0s
    1st Aug 2012 Member 0 Permalink

    no problem ;) look at my second post again. it should work now

  • Pilihp64
    1st Aug 2012 Developer 1 Permalink

    Here is something a little more clear and functional.  You should be able to figure out how to modify it to how you want it.

    http://pastebin.com/SnTT2twy