Meltable materials in Lua.

  • Nobody905
    31st Aug 2013 Member 0 Permalink

    Is it possible to make low/high temperature transformations in Lua?

    I tried this, but it doesn't seem to work:

     

    elements.property(elements.NOBODY_PT_PLAS, "HighTemperature", 400.0)
    elements.property(elements.NOBODY_PT_PLAS, "HighTemperatureTransition", NOBODY_PT_MPLA)

  • Luezma
    15th Sep 2013 Member 0 Permalink

    Please check your code, NOBODY_PT_MPLA is actually a nil value, try replacing it by an element ID, also you can just put element.NOBODY_PT_MPLA

  • boxmein
    15th Sep 2013 Former Staff 0 Permalink
    @Nobody905 (View Post)
    You have to use an actual value in specifying a transition.
    A complete example would be:
    local notmolten = elements.allocate("boxbox", "AWES")
    -- copy some element just for ease
    elements.element(notmolten, elements.element(elements.DEFAULT_PT_SAND))

    local molten = elements.allocate("boxbox", "SEWA")
    elements.element(molten, elements.element(elements.DEFAULT_PT_GLOW))

    elements.property(notmolten, "HighTemperature", 400.0)
    elements.property(notmolten, "HighTemperatureTransition", molten)

    -- :{)
    Edited 2 times by boxmein. Last: 15th Sep 2013
  • Nobody905
    15th Sep 2013 Member 0 Permalink

    @Luezma (View Post)

     It is another element in my code. I'm not a bloody idiot.

    @boxmein (View Post)

     Thanks.

    EDIT: Well, the transition to MPLA to PLAS does work, but PLAS does not melt.

    Edited 4 times by Nobody905. Last: 15th Sep 2013
  • Michael238
    16th Sep 2013 Member 0 Permalink

    @Nobody905 (View Post)

    Your transition code should look like this: 

    elements.property(elements.NOBODY_PT_PLAS, "HighTemperatureTransition", elements.NOBODY_PT_MPLA)

  • Nobody905
    16th Sep 2013 Member 0 Permalink

    @Michael238 (View Post)

     Well, still the same. MPLA hardens, but PLAS does not melt. Here is my code:

    local plastic = elements.allocate("NOBODY", "PLAS")
    elements.element(elements.NOBODY_PT_PLAS, elements.element(elements.DEFAULT_PT_COAL))
    (All the other properties, not important...)
    elements.property(elements.NOBODY_PT_PLAS, "HighTemperature", 400.0)
    elements.property(elements.NOBODY_PT_PLAS, "HighTemperatureTransition", elements.NOBODY_PT_MPLA)
    local molten = elements.allocate("NOBODY", "MPLA")
    elements.element(elements.NOBODY_PT_MPLA, elements.element(elements.DEFAULT_PT_MWAX))
    (All the other properties, not important...)
    elements.property(elements.NOBODY_PT_MPLA, "LowTemperature", 380.0)
    elements.property(elements.NOBODY_PT_MPLA, "LowTemperatureTransition", elements.NOBODY_PT_PLAS)
    I'm making PLAS like COAL and MPLA like MWAX to make things easier, I tweak almost every property. The point is, if I set PLAS to WAX,it does melt, but it just keeps melting into bloody MWAX!

    Edited 2 times by Nobody905. Last: 15th Sep 2013
  • Michael238
    16th Sep 2013 Member 0 Permalink

    The freezing point for MPLA is lower than the melting point for PLAS.

     

    EDIT: Also, try changing the property line from MWAX to something else. Also, change it from WAX to something else.

    Edited once by Michael238. Last: 16th Sep 2013
  • Nobody905
    16th Sep 2013 Member 0 Permalink

    @Michael238 (View Post)

     I thought it should be like that. whatever. I'll try.

  • Michael238
    16th Sep 2013 Member 0 Permalink

    Interestingly, I just did some testing, and it turns out that you might have to not define it using properties from an existing element. The problem is that if you were to change the property definition to METL for example, it will melt at the temperature that you specified, but it will NOT melt into the element that you specified. In the example of using METL's properties, your element will melt into the LAVA element at whatever temperature you specified.

  • jacksonmj
    16th Sep 2013 Developer 0 Permalink

    elements.property(elements.NOBODY_PT_PLAS, "HighTemperatureTransition", elements.NOBODY_PT_MPLA)
    local molten = elements.allocate("NOBODY", "MPLA")

     

    Try allocating all elements before using them in element property values. For example:

    local plastic = elements.allocate("NOBODY", "PLAS")
    local molten = elements.allocate("NOBODY", "MPLA")
    elements.element(elements.NOBODY_PT_PLAS, elements.element(elements.DEFAULT_PT_COAL))
    elements.property(elements.NOBODY_PT_PLAS, "Name", "PLAS")
    elements.property(elements.NOBODY_PT_PLAS, "HighTemperature", 400.0)
    elements.property(elements.NOBODY_PT_PLAS, "HighTemperatureTransition", elements.NOBODY_PT_MPLA)
    elements.element(elements.NOBODY_PT_MPLA, elements.element(elements.DEFAULT_PT_MWAX))
    elements.property(elements.NOBODY_PT_MPLA, "Name", "MPLA")
    elements.property(elements.NOBODY_PT_MPLA, "LowTemperature", 380.0)
    elements.property(elements.NOBODY_PT_MPLA, "LowTemperatureTransition", elements.NOBODY_PT_PLAS)

     

    Some sort of error message in situations like this would be helpful though.

    Edited once by jacksonmj. Last: 16th Sep 2013