1. Stuck, Having problems with creating your mod? Let us help you: Mod Support

Solved Drag Tree Lighting - Wow that's a special trick!

Discussion in 'Mod Support' started by krallopian, Feb 14, 2019.

  1. krallopian

    krallopian
    Expand Collapse

    Joined:
    Dec 5, 2013
    Messages:
    446
    So I've finally dived into figuring out how the christmas tree works at the drag strip in WCUSA.

    What a cool trick!

    Basically it says, "if you enter this small area, play an animation of an object that is emissive and glowing moving into view that represents "staged" then if you enter the next trigger slightly ahead of it, play the following animations "staged ready, 1, 2, 3, 4" and when leaving both trigger zones, play the end animation of all of these, which basically moves the emissive/glow object out of view.

    It's triggered animations of an object coming into view and leaving view based on the car's position.

    I always thought it would be something like, "if enter this trigger, turn on light 1, count to 10, turn on light 2, count to 3, turn on light 3 cound to 3" etc.. but it's so much more elegant than that!

    So I figure the designer just animated some lights moving into position, then in game tagged those animations to all play at once, and they are simply offset based on the original animation. Very cool! VERY cool.

    All kinds of lights are going off in my head now =D
    --- Post updated ---
    Makes me wonder though, why so many individual items? Why not just one animated tree, surely would reduce object count AND coding! More modular their way though.
    --- Post updated ---
    If someone could chime in here, the part that got me at first was the FALSE boolean on the playAnim, but I think it means "loop the animation? Nope!" for instance:

    Code:
      if greenLight then
        if data.event == 'enter' then
          greenLight:playAnim('tree_start', false)
        elseif data.event == 'exit' then
          greenLight:playAnim('tree_end', false)
        end
      end
     
  2. thomatoes50

    thomatoes50
    Expand Collapse
    Staff Member

    Joined:
    Jan 31, 2013
    Messages:
    585
    Yes the second parameter is a boolean to loop the animation.
    At that moment the artist use animation as the hidden property was broken ( even when activated some mesh would still be visible)

    At some point we wanted to redo the drag chrismas tree in one animation (so it could be reused in other map) but we never had time.
    If you are doing something similar use instance colors or the hidden property.
    It will be much simpler in the code and this way you do know when the light is on or not (one of the reason we wanted to redo is that we could not know for sure which light was on)
     
    • Informative Informative x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice