1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

What are the Holiday Scripts in Rules/CommonScripts?

Discussion in 'Modding Help' started by Blubahub, Jun 21, 2018.

  1. As a beginning modder also helping other newbies (or making them for people who don't know how), I was wondering: What is Holiday.as, HolidayCommon.as, and the Christmas/Halloween/Birthday.as scripts intended to be used for? Are they actually doing something (besides checking if it is a designated "holiday" - I noticed that in the server batch file), and if so, what? Also, know that I'm on the topic, what can they be used for (and how do you add a holiday..?

    Please note that I'll be out of town for a week, so my replies may come late! Thanks in advance..!
     
  2. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    They got disabled because of crashing issues, related to RemoveScript IIRC.
     
  3. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,914
    I've wanted holidays to be fixed for so long, I will probably make a bounty for it next month.
     
    enderzilla747 likes this.
  4. @Asu but if fixed what would it do? Also, what basically needs to be fixed..? Maybe I can figure out how (if I do @Mazey I'd send you the script somehow probably)..!

    Oh and Mazey congrats on getting your Quarry made official! Really useful :D EDIT: Oh lol they credited me... Nice! First year in and already making an impact on the base game :eek: XD at first I forgot what I helped with (reported a bug where it wouldn't take Gold when held)..!
     
    Last edited: Jun 24, 2018
  5. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    On some days special events are played, e.g. gregs in Halloween.
    There were crashes when the holiday was over, causing mayhem because of RemoveScript, apparently.
     
  6. *Knew I should have named this "Blubahub's Questions"*

    ... Now that I have a thread opened, does anyone know how I can make modify the WARMusic "entity" so it will play music when it is daytime, night, et cetera?
     
  7. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Code:
    getMap().getDayTime()
    Returns a float, range 0.0 .. 1.0. 0.0 and 1.0 are midnight, 0.5 is noon.
     
  8. @Asu Okay. So, if I wanted to make a variable that shows the time, would it look something like this (is this correct?):
    Code:
    daytime = getMap().getDayTime()
    Now, what if I wanted to make it so if it is night, play xyz music, and if it is not night, then abc music. Do I literally have to write ...
    Code:
    if daytime = 0.0 or 1.0 {
              /* code here */
    } else if daytime = 0.5 {
              /* code here */
    }
    ... or is there a general way to reference "midnight" and noon? Lastly, isn't there a morning time/float? Are there other numbers (is it just that those three are the standard ones)? I'll try this out later on and will reply to you in this post. @Asu
    --- Double Post Merged, Jun 26, 2018, Original Post Date: Jun 25, 2018 ---
    Another question @Asu - how would one make it so the keg explodes in a circular shape?
     
  9. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Code:
    float daytime = getMap().getDayTime();
    That's because declarations can be in the following forms:
    Code:
    type var_name; // declaration + default initialization
    type var_name = expression; // combined declaration + initialization
    Once the variable is declared you can assign it just like that:
    Code:
    var_name = expression; // assignment
    The getDayTime() is basically looping from 0 to 1, something like that:
    [​IMG]

    If you want to determine whether it's the morning right now you can do:
    Code:
    if (daytime >= 0.3 && daytime <= 0.5) // i didn't check the values
    {
        // do stuff
    }
    However you cannot really do if (daytime == 0.0) or if (daytime == 0.5) because it's possible that the daytime simply doesn't go by those values when you're checking, e.g. it could go from 0.49 to 0.51.
    If you can call a function multiple times in a row without it being a problem you can just check for the range. If you cannot you'll have to do some extra work to make it call that only once a day.

    Check Keg.as - I suspect this.set_f32("map_bomberman_width", 24.0f); to be what deals the + shaped explosion damage. You would have to change some other values to change the circle-shaped damage larger.
     
  10. @Asu okay thank you. I tried removing the bomberman tag (which says for it to explode, at least visually, in a plus + sign), but that just did a few tiny explosion here and there when the new keg exploded (but still acted like it was before - so it must only be visual). I amped the map_bomberman_width up to 200.0f which made it thicker, and that was good, though it wasn't a circle like I wanted originally (I may ask about that again later on). But for now, I'm satisfied.

    You mention early that holidays were "supposedly" broken because of RemoveScript - what is that? I cannot find it in the Base folder. What exactly is wrong with the holidays system???

    Finally, where is the code for water? I figure that I can just copy that and modify it so the HOTHOTHOT.as script is used (or has parts of it in the new Lava)..? As before I can neither find a config or AngelScript file.
     
  11. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    Not sure about the keg, try experimenting with the tags/comparing with bombs to see where's the difference.

    RemoveScript is a method for CRules, CBlob and some other classes. It was called by holidays to remove the payload script (i.e. halloween script, etc) when it was over.

    Water as in water tiles is handled in engine. You can't modify it.
     
  12. @Asu Okay, but how would one create lava, referencing the water script? There must be a script that calls the in-house engine action. I need to know of a way to reference in a config file! Also, I think I didn't mean HOTHOTHOT.as.

    Here's what I'm trying to do: Make lava. How? Find the code the water uses for 1) auto filling like water does, 2) creates the water physics, so I can reference it in the lava's config. After that all I'd have to do is say that the object burns stuff (by grabbing some script).
     
  13. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    You can't create custom types of fluids using the built-in water implementation, it's not very flexible as it is.
    If you implemented fluids a custom way you can surely do it, which @GoldenGuy and @Geti has done, but neither of them have released the code (yet).
     
  14. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Re: "there must be a script" - theres a fair bit (not a lot, but like, some 10-30% of the "total game logic" probably) that lives engine-side in the compiled c++ code that you cannot read or modify.

    Re: "so give water script!!!" - well, here's the unreleased water demo mod, without instructions or completion. It's a lot more complicated than the "simple" implementation would be, with chunked rendering and updating, sync etc. Add it to your mods folder and Water to your mods config. Requires some setup but you'll have to figure that out yourself.

    There's bugs, but it shows how to use the new script rendering stuff to render a continuously updated tilemap without too much strain. For a boolean "kag water alike" lava it could be much simpler+faster.
     

    Attached Files:

    jonipro and Blubahub like this.