Graphics help!

  • gast
    22nd Dec 2013 Member 0 Permalink

    I have a problem! I will an element likes molten gold.

    I have an code but i'm getting an element graphics likes water!

    Here is the code:

    <code>

    local myNewElement = elements.allocate("MOD", "MLGL")

    elements.element(elements.MOD_PT_MLGL, elements.element(elements.DEFAULT_PT_LAVA))
    elements.property(elements.MOD_PT_MLGL, "Name", "MLGL")
    elements.property(elements.MOD_PT_MLGL, "Description", "Molten Gold")
    elements.property(elements.MOD_PT_MLGL, "Temperature", 2500)
    elements.property(elements.MOD_PT_MLGL, "LowTemperature", 1500)
    elements.property(elements.MOD_PT_MLGL, "LowTemperatureTransition", DEFAULT_PT_GOLD)
    elements.property(elements.MOD_PT_MLGL, "MenuVisible", 1)

    </code>

    Can someone help me?

    Sorry for my bad english i'm dutch!

    Edited 10 times by gast. Last: 22nd Dec 2013
  • Millions
    22nd Dec 2013 Member 2 Permalink

    Ahhh. Simple.

     

    local function glow_like_lava(i, colr, colg, colb)
    return 1,0x00010000,255,255,69,0,255,255,69,0
    end
    tpt.graphics_func(glow_like_lava,myNewElement)

     

    You have to use RGB values for ",255,255,69,0,255,255,69,0"

     

    The first 255 is for "i" I always make this 255.

    The second is the color red, then the third is green, then the fourth is blue.

    Then its firea which is always 255, and then red, green, blue again.

     

    so heres a better example; 1,0x00010000,i,red,green,blue,firea,red,green,blue

     

    Now the return 1,0x00010000 is the important part.

    Thanks to boxmein I can show you these

     

    #define PMODE 0x00000FFF
    #define PMODE_NONE 0x00000000 // Particle is invisible
    #define PMODE_FLAT 0x00000001 // Particle is visible, nothing view
    #define PMODE_BLOB 0x00000002 // Blob Display-like
    #define PMODE_BLUR 0x00000004 // Like WTRV, blurry around a small radius.
    #define PMODE_GLOW 0x00000008 // Glowing.
    #define PMODE_SPARK 0x00000010 // Like EMBR (Small). Proved by mrsalit0s
    #define PMODE_FLARE 0x00000020 // Like EMBR (Medium).
    #define PMODE_LFLARE 0x00000040 // Like DEST agitated. (Huge)
    #define PMODE_ADD 0x00000080 // Adds to similar particle effect
    #define PMODE_BLEND 0x00000100 // Blends multiple similar particle effects together

     

    Since your making a lava type substance you would want to use

    0x00010000 - Lava type

    0x00020000 - Glows alot more. Brighter.

     

    Hope this helped.

     

  • jacob1
    22nd Dec 2013 Developer 1 Permalink
    @Millions (View Post)
    great post, for some further clarification on the first two arguments, the "1" means that the result is cached and this function is only ever called once. If everything is constant and what it looks like does not depend on variables like life or tmp, always use this so your element doesn't become laggy. Use "0" to not cache the return values.

    Also you need to bit.bor the second arguments to add them all together. Like this: bit.bor(ren.PMODE_BLUR, ren.FIRE_ADD). And more arguments if you want more render modes. You can also just add them up like ren.PMODE_BLUR + ren.FIRE_ADD, that would work too. I recommend not using the numbers because those could change, the constants will always be correct though.

    http://boxmein.x10.mx/tptelements/lua-reference.html#renderer <- best reference of the entire lua api, better than the wiki which is bad.
  • gast
    23rd Dec 2013 Member 0 Permalink

    yes it works! but it likes falling fire!

    its good now thx for helping

  • boxmein
    23rd Dec 2013 Former Staff 0 Permalink
    @jacob1 (View Post)
    Thanks!
    (also relatedly, fixed the lua-reference page being italic and bork)
    Edited once by boxmein. Last: 23rd Dec 2013
  • FeynmanLogomaker
    23rd Dec 2013 Member 0 Permalink

    Looks like this is about closed up already, but...

    You seem to be doing your code tags a bit wrong, you are supposed to do it in the HTML editor.