• 0

    posted a message on Custom NPCs Scripting Basics

    Hmm. That makes sense. I had originally put NPCInventory in that spot but it was of course undefined.

    What is the difference between a method being under the itemstack interface (like getDisplayName) and simply having Itemstack as a modifier (like createItem)? I thought that all IItemstack methods would be under that interface, so I didn't initially look for createItem in IWorld.

    Posted in: Mods Discussion
  • 0

    posted a message on Custom NPCs Scripting Basics

    Awesome vid! I'm assuming that was a quick skin change script with time parameters. I imagine it's a little time-consuming to do that even on a small scale.


    Anyway, I'm back with what I thought was a simple script.



    function init(event) {
    event.npc.world.getTempdata().put("WepSwi",1);
    }

    function damaged(event) {
    if (event.npc.world.getTempdata().put("WepSwi") == 1) {
    event.npc.setLeftHand(getDisplayName("Iron Sword"));
    event.npc.say("You’ll pay for that!");
    event.npc.world.getTempdata().put("WepSwi",0);
    }
    }

    function tick(event) {
    if (event.npc.getHealth() == event.npc.getMaxHealth()) {
    event.npc.setLeftHand(getDisplayName("Book"));
    event.npc.world.getTempdata().put("WepSwi",1);
    }
    }



    I am having trouble with definitions though. After troubleshooting it for a while, I couldn't manage to get past this error:



    Wed Sep 07 11:46:32 PDT 2016 tab 1:
    javax.script.ScriptException: TypeError: [email protected] has no such function "setLeftHand" in <eval> at line number 15
    at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:389)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
    at noppes.npcs.controllers.ScriptContainer.run(ScriptContainer.java:100)
    at noppes.npcs.entity.data.DataScript.runScript(DataScript.java:62)
    at noppes.npcs.EventHooks.onNPCTick(EventHooks.java:93)
    at noppes.npcs.entity.EntityNPCInterface.func_70071_h_(EntityNPCInterface.java:258)
    at noppes.npcs.entity.EntityCustomNpc.func_70071_h_(EntityCustomNpc.java:35)
    at net.minecraft.world.World.func_72866_a(World.java:1860)
    at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:699)
    at net.minecraft.world.World.func_72870_g(World.java:1829)
    at net.minecraft.world.World.func_72939_s(World.java:1661)
    at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:544)
    at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:701)
    at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:605)
    at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:152)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:481)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: <eval>:15 TypeError: [email protected] has no such function "setLeftHand"
    at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:213)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:185)
    at jdk.nashorn.internal.runtime.ECMAErrors.typeError(ECMAErrors.java:172)
    at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.linkBean(NashornBottomLinker.java:106)
    at jdk.nashorn.internal.runtime.linker.NashornBottomLinker.getGuardedInvocation(NashornBottomLinker.java:71)
    at jdk.internal.dynalink.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:124)
    at jdk.internal.dynalink.support.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:154)
    at jdk.internal.dynalink.DynamicLinker.relink(DynamicLinker.java:253)
    at jdk.nashorn.internal.scripts.Script$Recompilation$161$320A$\^eval\_.tick(<eval>:15)
    at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:642)
    at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:228)
    at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
    at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
    at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383)
    ... 16 more


    The script is supposed to have the npc draw a weapon in its right hand and make a threatening statement if attacked. It is supposed to sheath the weapon and reset the script once its health returns to full. It's meant to work if the npc has health regen, but no combat regen. There are probably other problems with the script too.

    Posted in: Mods Discussion
  • 1

    posted a message on Custom NPCs Scripting Basics

    I hadn't thought of using tempdata to reset scripts. That makes things much more streamlined. I appreciate you posting these scripts. Not only are they useful for what I had in mind, but they also provide a good example as to how the new API works. I will be trying more complex scripts as needed, and keeping up with this thread.

    Posted in: Mods Discussion
  • 0

    posted a message on Custom NPCs Scripting Basics

    Thank you, I appreciate it, and that will certainly work!

    In all honesty, I would like to make it so a certain sequence of places need to be visited during the quest before the script will work, but I think I could use command blocks to do this. The second-to-last place would spawn a block near the script block that it could test for, in addition to a player being nearby. I'll probably try to figure that script out on my own first, though (will post it if I succeed.)


    It does seem that 1.8 scripting is very different. I haven't succeeded in converting any of my old ones yet. Normally to spawn an npc I would use /noppes clone spawn, but that command seems to have vanished for now =).

    Posted in: Mods Discussion
  • 0

    posted a message on Custom NPCs Scripting Basics

    Hey daottoad. Love your work. I've been following the npcs thread for a while and you've given me some useful advice.

    I am currently working with 1.8.9. I have some complicated things I would like to do with scripting, but I am still very new and could use a little help with the simple stuff. For my first script, I would like to spawn a cloned npc into the world (presumably using spawnClone), by standing in a certain spot while a quest is active. What would be the simplest kind of script I could write to accomplish this? I've been educating myself on classes and modifiers, but I am still a little confused on how to write everything out properly using the customnpcs API.

    Posted in: Mods Discussion
  • 0

    posted a message on Invisible Chunks and Frozen Mobs (Problem is not RAM)

    So, I'm back. The video drivers have been fixed, and the memory allocation errors also seem to have been dealt with, although the process has never shown signs of overuse. However, the problem, having gone away for a while, is now occuring again. Now, though, it appears to be associated with a particular area. Once I enter this area (part of a deep hole mined out by me, near a waterfall, but otherwise unremarkable), the problem immediately occurs.

    Further Description: Blocks can still be broken, but yield no drops. XP orbs just sort of fly around my head, but are never allocated to me. And any drops existing at the time the error first started may not be picked up. Attempting to exit to the main menu causes it to be stuck on the Disconnecting from Server screen (I'm still playing Single Player here, just to clarify), until the game is shut down via other means. Once restarted, the game takes me back to a minute or so before the error occurred. There is no crash report.


    Could this be due to a player ticking error? I've found similar symptoms related to this elsewhere, although they've always resulted in a crash, while mine doesn't.

    Posted in: Java Edition Support
  • 0

    posted a message on Invisible Chunks and Frozen Mobs (Problem is not RAM)

    Hello everyone.


    I have recently encountered a problem whenever I load a world, which appears to be independent of versions, as I have loaded Minecraft in 1.7 and 1.8 with the same results. After playing Minecraft for anywhere from 1 to 10 minutes, chunks suddenly refuse to load beyond what has already been loaded. In the case of previously unloaded chunks, I will fall slowly through the blank space, but in the case of chunks that were previously loaded then unloaded, the terrain still seems to be there, but is completely invisible. Mobs are frozen in place (but still affected by gravity), and cannot be interacted with or spawned. Blocks can be placed from the inventory, but commands do not affect the world once entered. TNT will simply vanish once lit.


    The disk space was only at 62%, there does not seem to be any actual lag, and there is still plenty of available RAM.


    I should mention that I do occasionally run Minecraft Forge, but was not using it here.


    I'm sure that this problem has been dealt with before, but I can't seem to find any info dealing with it. I would greatly appreciate the help.

    Posted in: Java Edition Support
  • 0

    posted a message on JustAnotherWorld Mod - adds a whole new dimension, overworld style! - many more dimensions in the future! - v0.1.1

    Hi! I see that no one who has actually used this mod has responded yet, so I would like to say that this is pretty cool. Your mod may be just the thing I need for the adventure map I am working on. I would certainly like to see this mod expand and get new dimensions added. I haven't looked around all that much in the dimension yet, but I'll post more on this thread once I do.


    One question... probably idiotic, but all the same...


    Is there any difference between the created dimension and the original Overworld in the way things work? I'm assuming there isn't, but there isn't all that much information in the original post yet.

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from daottoad»

    There is still a lot I have to learn about this mod! I did try the map - TES-Gates to the End ENHANCED a while back it was not that advanced. I really doubt there is and 1.8 maps out being still in beta. I am trying to get all my pigs in a row and work towards some sort of real map or small adventure but it will be a while - I have a few ideas for a mini adventure murder mystery map. But been kind of busy lately - will have more time this winter.

    I have been helping to do scripts with the server
    should be real cool when its done - has
    great architecture and stories and is taking advantage of the range of abilities of this mod - really trying to create a extensive game play with NPC's.

    Thanks anyway! I have been messing around with this mod since the 1.7.4 release, but I wanted to see what other people have done with it before I began my own larger project.

    What I have discovered is that most npc maps, even those made before 1.7, transfer to 1.8 beta with little trouble. Most of the glitches that occur simply involve models being displayed improperly, such as wing appendages and the npcgolem, (although I haven't seen what it does to the banner mechanic and a few other things). There are some good older maps out there, but they usually require other mods that haven't been updated to 1.8 yet.

    I'll be happy to play and test any adventures you come up with, and, if noppes permits this, will post with any (quality) custom npc maps I find.
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from daottoad»

    world.thunderStrike(48,77,-115);

    Look at:

    http://www.kodevelopment.nl/minecraft/customnpcs/scripting

    http://www.kodevelopment.nl/customnpcs/

    all 5,000,000 lines are required reading - but they do make things easier.


    Thank you! The script works beautifully.
    One more thing: You have a lot of knowledge about this mod, so could you recommend any high-quality custom npcs adventure maps? Particularly those that work with 1.8 (i.e. don't use a lot of other mods)? The only (good) one I have played so far is Third Mountain, and it still doesn't use many of the best features of the mod.
    I'm not sure if you yourself have any completed maps you would like to share...
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from daottoad»

    2) Could I use one of these tools to cause an npc to alter the environment (for ex. cause lightning to strike randomly around it) when certain parameters are met?

    yes.


    Thanks, daottoad! One more question regarding this lightning example:
    Do you know any of the functions or methods that can be used in javascript to spawn entities (such as lightning bolts) into the world? I have been looking around in the MCPBot methods spreadsheet, but it is a huge amount to go through, and I have been unsuccessful in finding it so far.

    I think the script would be fairly simple to make if I had this.

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs

    I am very new to scripting, and I am not sure how to use some of the tools provided in this mod.


    1) Specifically, how do the Scripter and npc door tools work?


    2) Could I use one of these tools to cause an npc to alter the environment (for ex. cause lightning to strike randomly around it) when certain parameters are met?


    3) Also, is there is a place that explains how to use all the new features in the 1.8 version?

    Posted in: Minecraft Mods
  • To post a comment, please .