Change Start Life

  • chimpdroid
    17th Jan 2014 Member 0 Permalink

    I'm working with DMND as a base for a shield that is activated for a second or two, and then disappears.

    tpt.el.dmnd.name= 'PSHD'
    tpt.el.dmnd.description= 'Power shield; short-lasting, but nearly indestructible.'
    elements.property(elements.DEFAULT_PT_DMND, "Properties", elements.PROP_LIFE_DEC)
    elements.property(elements.DEFAULT_PT_DMND, "Properties", elements.PROP_LIFE_KILL)

     

    It would work, however DMND has a life of zero to start with.
    I've looked around quite a bit, but I can't figure out how to change DMND's life.
    Any help would be much appreciated, thanks!

  • Schneumer
    17th Jan 2014 Member 0 Permalink

    Cray. Dlay circuit.

  • chimpdroid
    17th Jan 2014 Member 0 Permalink

    I would do that, but the shield is for a moving, controllable particle.
    I'm doing a large, landscape simulation, and the controllable particle represents a combat mech.
    It works just fine, moves with arrow keys, drops bombs when I press "x", and when I press "c", it generates a small square of diamond around itself. However, since I don't want tiny diamond squares cluttering up my sim, I wanted to make diamond disappear after a couple seconds. If it's possible to add a script to the autorun.lua that does such a thing, that'd be awesome :D

  • jacob1
    17th Jan 2014 Developer 0 Permalink
    There was planned to be a lua function to set default properties, but it hasn't happened yet. I might just sort of give up on doing things myself and merge the pull request that already does this for us.

    In the meantime, you might have to use special methods. Try making an update function (tpt.element_func) that checks if the .tmp is equal to 0, if it is, set the life to the default value and then set tmp to 1. You will also have to use PROP_LIFE_DEC_KILL instead of the two properties you have now if you use this method, since the DMND would die before you can set the life :|

    to set the life in general, it's tpt.set_property("life", "dmnd", 1), or tpt.set_property("life", i, 1)
  • chimpdroid
    17th Jan 2014 Member 1 Permalink

    Thanks so much!

    I'll give it a go tomorrow morning, will post results.

     

    I love your mod, by the way, I use it all the time :D

    Edited once by chimpdroid. Last: 17th Jan 2014
  • Millions
    17th Jan 2014 Member 0 Permalink

    @jacob1

     

    Would I need to learn C++ to be able to make a function that is like this:

     

    elements.property(elements.element_pt_element, "Life", 1)

     

    ?

  • chimpdroid
    17th Jan 2014 Member 0 Permalink

    @jacob1

     

    I tried it out, but I couldn't quite make it work. 

    However, I probably messed something up.

    Any ideas?

  • Schneumer
    17th Jan 2014 Member 0 Permalink

    You could use a bot like china-richways, add filt with the cray, would the filt push with it? Then you could add the dlay circuit...a bit complicated, but you can do it!

    Anyways, when you do the lua, for us to simulate it don't we have to insert the code too?

    Isn't that a little.....inconvenient? Feel free to correct me if I'm wrong.

  • jacob1
    17th Jan 2014 Developer 0 Permalink
    @chimpdroid (View Post)
    I could try it myself tomorrow when I get home from school. I've only seen that done once before but I think it's right. Essentially you just initialize the life in the update function ... Might be a bit slow though.
  • chimpdroid
    17th Jan 2014 Member 0 Permalink

    I ended up just using BRAY as the shield thing.
    It's primarily cosmetic anyway, since I realized that the diamond shields hardly protected it.