Mod Questions

Home Forums Wayward Mod Questions

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #3928
    supernet2
    Member

    Alrighty i noticed all of these mods are done in javascript. So heres my question. Can i have a copy of the variables used ingame? Like i noticed your GiantMonster variable but theirs more than that.

    I wanna make tons of js scripts in attempts to get item drops i need for item creation like say, arrows in this case, im assuming its a chicken as the monster variable but… im not sure how your naming your variable tables, and i prefer to not half to run a logger on my end to pay attention to all the variables as they pass through (or as they appear in the game).

    Would i need to go directly via email to ask you for them or is it safe to ask out in the public?

    Heres what i’ve learned so far.

    Variables i’ve found
    monsterSpawned
    monsterX = 0
    monsterY = 0
    spawnMonster

    Not sure if im missing anything their, i dont think so, but regardless i figure if its that easy to make js scripts i just need a idea of what all the variables are and i can essentially mass create modification files/scripts, if theirs item variables (which i bet their is) i can probably create item generation and user statistical scripts, or make a visual basics app that will just basically generate a script based on what i want my user data and or items to be. Things of that nature.

    var monsterSpawned = 0;
    for (var i = 0; i < 100; i++) {
        var monsterX = 0;
        var monsterY = 0;
        monsterX = Math.floor(Math.random() * 80 + player.x - 40);
        monsterY = Math.floor(Math.random() * 80 + player.y - 40);
        if (tile[monsterX] && tile[monsterX][monsterY] && tiletypes[tile[monsterX][monsterY].type].water) {
            if (spawnmonster("water", monsterX, monsterY)) {
                monsterSpawned++;
            }
        } else if (tile[monsterX] && tile[monsterX][monsterY]) {
            if (spawnmonster("", monsterX, monsterY)) {
                monsterSpawned++;
            }
        }
    }
    message(monsterSpawned + " creatures descended upon your location!");
    render(true);
    rendertiles();
    

    I know im asking alot but i just like to tinker so hopefully you’ll get back to me. Thanks in advance for reading!

    #3929
    JamesIII
    Moderator

    Here’s the mod I use to spawn specific monsters, I’m not sure if its completely right but it seems to work for the most part.

    Selective Spawner Mod:

    $("#optionswindow").on("click", '#chicken', function(e) {spawnmonster("chicken", player.x+2, player.y); e.preventDefault();message("Chicken!");});
    $("#optionswindow").on("click", '#skeleton', function(e) {spawnmonster("skeleton", player.x+2, player.y); e.preventDefault();message("Skeleton!");});
    $("#optionswindow").on("click", '#bogling', function(e) {spawnmonster("bogling", player.x+2, player.y); e.preventDefault();message("Bogling!");});
    $("#optionswindow").on("click", '#zombie', function(e) {spawnmonster("zombie", player.x+2, player.y); e.preventDefault();message("Zombie!");});
    $("#optionswindow").on("click", '#pirateghost', function(e) {spawnmonster("pirateghost", player.x+1, player.y); e.preventDefault();message("Pirate Ghost!");});
    $("#optionswindow").append('<button type="button" id="chicken">Chicken</button>');
    $("#optionswindow").append('<button type="button" id="skeleton">Skeleton</button>');
    $("#optionswindow").append('<button type="button" id="bogling">Bogling</button>');
    $("#optionswindow").append('<button type="button" id="zombie">Zombie</button>');
    $("#optionswindow").append('<button type="button" id="pirateghost">Pirate Ghost</button>');
    #3930
    supernet2
    Member

    Was that used on 1.6 or 1.5? I only tried it on 1.6 and it hasn’t worked code wise. Perhaps its because i simply copy and pasted it and saved it as a .js file?

    #3936

    That may have been the forum formatting converting all quotes in smart quotes. I converted the code shown here so far to output as code/pre tags instead. So you may want to try again @supernet2

    Although in 1.6, spawnmonster is now spawnMonster, so that may have to be changed as well.

    As for all the functions and variables, there really is too many to list. With your 1.6 access, you are able to look through the source to perhaps find what you need though. If you let me know what you want specifically, I can try to help out, but in terms of modding, it’s very early right now as the code changes quite rapidly during this period.

    #3938
    supernet2
    Member

    Just specifically trying to spawn chickens. seems like I never see them anymore and arrows are becoming increasingly hard to craft with out any feathers.

    #3939
    JamesIII
    Moderator

    what would be to easiest way to spawn an item? would it be renderItem or spawnItem? any syntax for this would be appreciated. also how would you change the text color in a message?

    #3948

    Spawning chickens in 1.6:

    spawnMonster("chicken", player.x, player.y+1);

    (just change to spawnmonster for 1.5)

    Give yourself an item (both 1.5/1.6):

    itemGet("arrow");

    Message (1.5):

    message("Here's a message!", "bad");

    “bad” can be changed to the following for different colors:
    skill, attack, good, stat, miss, or removed for just white text.

    #3953
    supernet2
    Member

    Okay thanks Vaughn


    @JamesIII
    so i been trying to tinker with your initial code to make item buttons. Im using the arrow as a example for now.

    This is what i do and i run into errors.

    $("#optionswindow").on("click", '#getarrow’', function(e) itemGet("arrow");
    $("#optionswindow").append('<button type="button" id="getarrow">Get Arrow</button>');

    the argument $(“#optionswindow”).append(‘<button type=”button” id=”getarrow”>Get Arrow</button>’); code is solely to point to the id which is named getarrow and then show the button icon as “Get Arrow”.

    Okay so i know the button works.

    The id points towards the code $(“#optionswindow”).on(“click”, ‘#getarrow’’, function(e) itemGet(“arrow”);

    but it seems im running into errors, so i tried these 4 different versions of the code.
    $(“#optionswindow”).on(“click”, ‘#chicken’, function(e) {itemGet(“arrow”); e.preventDefault();message(“got arrow!”);});
    failed so i tried

    $(“#optionswindow”).on(“click”, ‘#getarrow’’, function(e) itemGet(“arrow”);

    and that failed so i tried

    $(“#optionswindow”).on(“click”, ‘#chicken’, function(e) {itemGet(“arrow”); e.preventDefault();message(“got arrow!”);});

    all variants failed so im unsure where im going wrong here

    #3954
    JamesIII
    Moderator

    Here is the correct code that should work, you dont need the preventdefault since this command goes into your inventory and not a map location. Also double check all your variables, you had chicken listed on the second part you showed. Also, the copy and past won’t work for this as the ” ‘ and other symbols don’t seem to register correctly. Your best bet is to manual retype it all in notepad or whatever you use before you save it as a .js

    $(“#optionswindow”).append(‘<button type=”button” id=”getarrow”>Get Arrow</button>’);
    $(“#optionswindow”).on(“click”, ‘#getarrow’, function(e) {itemGet(“arrow”);message(“got arrow!”);});

    You are better off just typing the command in the js console though, much easier then loading the mod.

    #3957
    supernet2
    Member

    @jamesIII ohh okay so prevent default is only for location variables. Thanks. And yeah I noticed that when I retyped everything via Google doc or with notepad it worked vs copy and paste.

    As for the chicken in the second part.. You mean when I listed the code examples I used that didn’t work? I forgot to include some closing brackets as well. So yeah I see what you ment but for the getarrowgetarrow yeah… Sorta didn’t finish typing in the edit. Was trying a few other type ins before I posted and forgot to change it to arrow. Wasn’t realizing prevent default was strictly for things outside of inventory vs that within inventory.

    @vaughn wanted to ask how do I load files and mods to wayward from android browser? I try to do so with Google browser on my sprint HTC one but the built in file loader will not work. I rooted and use root explorer and other tools on my phone and I cannot seem to load any js directly via the phone browser weather emulating as PC or running mobile version. Think its strictly related to mobile devices or the way files are loaded via mobile browser/emulated PC files?

    #3959

    @supernet2 I don’t really have any experience with phones yet. I was actually surprised to see it actually ran on phones or tablets at all to be honest. Eventually, modifications will be saved to localStorage (and your game save) when loaded (so they never have to loaded again), but that is awhile off I think.

    #3960
    JamesIII
    Moderator

    @vaughn any ideas why the show map mod now only shows half of the normal map but the full cave map?

    #3961
    supernet2
    Member

    @vaughn for android unless you build it as a apk or application install it will most likely fail horribly on the browser due to how zoom functionality works. Not sure you can disable androids native zoom function unless you build it as a application and disable it within the application. On top of that on the web browser on android include web browser of choice usually all cache and temp settings are wiped from android version 4.0+. This is per device reboot. So… Wayward save data would be lost. usually for me it isn’t a issue as I use Google chrome on my phone and it doesn’t seem to have this issue but… It is a major possibility considering how automated cleaner programs I have delete cache. User basis who sent tech savoy will most likely struggle and pass the game up if introduced to it via their phones browser due to its current technicalities.


    @JamesIII
    yeah I have the same issue with 1.6 not 1.5 not sure why though…

    @vaughn speaking of issues… How do I update the XML spreadsheet for but reports? Insert another line? Because theirs an abundance of new issues cropping up. I guess you reoptimized the code OE changes things around because for 1.6 my inventory disappeared (its still their just graphically speaking its not visible) resulting in my weight staying the same but interaction with my inventory, currently equipped weapons/gear and my hot key buttons interaction impossible (beyond pressing the num keys that correspond with what I remember being in the numkey quick slots) also game seems to be sluggish/slow now. Graphics are now glitchy and flicker regardless of browser I use. And no matter what 1.6 save file I load in all of them have this bug now where as it wasn’t so persistent. The bugs began on Oct 21st. So if you changed something it broke some functions of the 1.6 version making it less stable/playable. Oddly this issue can be reproduced by starting a new game on 1.6 saving a file and loading the save or playing for a short while and saving, exiting game and them reloading game through the browser.

    #3963

    @JamesIII I think it’s due to that black hole issue you had with the tiles, it never goes past them. If you want a quick fix for it, north face the black hole and do a:

    rendertiles("dirt", player.x, player.y-1);


    @supernet2
    Yep, it’s a very buggy and early build. Play at your own risk, heh! Post any issues in the “Ideas, Bugs & More” spreadsheet available near the bottom left of the window, we’ll be sure to get on it!

    #3965
    supernet2
    Member

    @Vaughn okay thanks. Will definitely repost what i posted here on the bug to the bugs section. thanks again

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.