Resource pack methods such as what Triliton described will work with everything that has its own custom textures within the mod file, which majority of the furniture doesn't (most furniture takes it's textures from the game files. This means if any resource pack is loaded which has custom wood for example, will apply that wood texture on chairs, benches, tables etc).
The code could possibly be modified to force the furniture to take textures from a custom directory in the mod file (in this case you would have to add it), or could be made to take a different game texture file instead, such as stone as you suggested. Any changes like this you would have to make yourself, and could only be for personal use.
He can copy the altered textures into the jar files texture folder? Thats what i mostly does.
I'm creating a farming modpack with ponies and quests, but I'd like some of them to actually farm.
This mod is best mod, and I'm going to use MineLP (like to find a way to override it's player model with the default)
Yes, anon with farming ponies, but I've barely used javascript in my life.
Really, any scripts would help me learn, but this is mainly what I want.
Make a position as home and hang around or go back to it at night
within a range around home, turn dirt that is near water into farmland
plant seeds on the land from inventory
collect plants and seeds when they are grown and add them to inventory
maybe bonemeal seeds
put said items in chest.
maybe modify some stats based upon dialog choices/items given.
Give items to npc
change dialog choices based upon variable values
maybe even add hunger.
I'd also like to make a calendar and seasons, maybe cause it to snow/rain or even change npc inventories based upon season.
I know it's a lot, but I'd learn scripting easier if I had several examples or tutorials, or a way to get item values. I can't even kill a simple pony just by speaking to her.
nvm, event.npc.setHealth(0) killed Octavia.
Thanks.
There is a farmer job that puts stuff in a chest -- maybe you can work that in and see what you would like as far as additional actions from scripting -- need to break it up in to separate parts.
There is a farmer job that puts stuff in a chest -- maybe you can work that in and see what you would like as far as additional actions from scripting -- need to break it up in to separate parts.
Yeah, I'm looking at your stuff for help, and some of the 1.7.10 scripts to modify them to 1.8.9. Tried the farmer job in the NPC's settings, but it didn't do anything or pick up items. Maybe it's just for scripting porpoises, and NPCs. Used firefox's scrapbook to get an offline copy of the API, so that helps. Tried to get Octavia to die on interact, then say something using the death event, but it didn't work so well. I now know about using event.npc.kill().
Yeah, I'm looking at your stuff for help, and some of the 1.7.10 scripts to modify them to 1.8.9. Tried the farmer job in the NPC's settings, but it didn't do anything or pick up items. Maybe it's just for scripting porpoises, and NPCs. Used firefox's scrapbook to get an offline copy of the API, so that helps. Tried to get Octavia to die on interact, then say something using the death event, but it didn't work so well. I now know about using event.npc.kill().
I know the farmer will work if there is an existing farm in range.
I know the farmer will work if there is an existing farm in range.
Thanks, it works with the wheat (but not harvestcraft plants). Two farmers will sometimes harvest phantom plants if they work the same field. It seems to only work with wheat, but I haven't tried pumpkins/melons yet (still need to grow them). Neither farmer plants anything new, even with seeds in their inventory. This does give me ideas for scripting them though.
Edit: they just harvested a pumpkin, and a whole melon..
My farmer actually crashes for some reason, I've deleted him and recreated, but randomly crashes every time... I set a chest up next to him to put things in, and when i click on the chest it crashes, and when i click on the farmer it crashes, and on top of that he doesn't farm, if anyone can read a crash report i can post it up
He can copy the altered textures into the jar files texture folder? Thats what i mostly does.
Important as you say, for personal use only.
Yeah, .jar texture edits and resource pack edits are carried out in almost an identical way. While they both work, the advantage resource packs have over .jar edits is they can be easily shared (as long as you own the textures its legal) and the edits don't have to be redone for updates to come.
You can easily turn what you got into a resource pack too; just copy the whole assets folder out of the mod file, then delete the "blockstates" , "lang", "models" and "schematic" files in the customnpcs subfolder. You also won't need the assets/moreplayermodels folder either.
Place what you got now into a .zip folder and then look up a quick tutorial for making a "pack.mcmeta" file.
Rollback Post to RevisionRollBack
If you require aid with Custom NPC's give me a shout (In the thread, not PM's). I can read a bit of error reports, know most of the NPC workings (I'm attempting to work on scripting) and have been using it since its 1.0 version. Otherwise I'll help with any questions or problems I can.
No indication of 1.10.2 in there, though. Just for 1.10, most likely. Noppes will get to a later version of 1.10 when he's good and ready. Until then, after the 1.10 version comes out this week (unless there's a delay), just use 1.10 instead of 1.10.. If you must use 1.10.2, then tough. He'll get to it when he gets to it.
Rollback Post to RevisionRollBack
Be friendly to me, & I'll be friendly to you. Sounds easy, right?
I've tried increasing the points for friendly but it just messes it up and aggressive is still default. All i want is for the friendly faction to be default.
function interact(event)
{
var block = event.npc.world.getBlock(10,75,323);
var player = event.player
if(block)
{
event.npc.say(block);
event.npc.say(block.getName());
event.npc.say(event.player.getName());
//event.npc.say(Math.random());
//event.npc.BlockEvent.HarvestedEvent(block.getName());
//block.getName().BlockEvent.HarvestedEvent(block.getName());
//block.BlockEvent.HarvestedEvent(block, player);
block.BlockEvent.BreakEvent(block);
}
else
{
event.npc.say("what?");
}
}
Output:
Fri Sep 16 09:20:39 CDT 2016 tab 1:
javax.script.ScriptException: TypeError: Cannot read property "BreakEvent" from undefined in <eval> at line number 14
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.onNPCInteract(EventHooks.java:61)
at noppes.npcs.entity.EntityNPCInterface.func_70085_c(EntityNPCInterface.java:406)
at net.minecraft.entity.EntityLiving.func_130002_c(EntityLiving.java:980)
at net.minecraft.entity.player.EntityPlayer.func_70998_m(EntityPlayer.java:1163)
at net.minecraft.network.NetHandlerPlayServer.func_147340_a(NetHandlerPlayServer.java:890)
at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:52)
at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:11)
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at net.minecraft.util.Util.func_181617_a(SourceFile:44)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:660)
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>:14 TypeError: Cannot read property "BreakEvent" from undefined
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.Undefined.get(Undefined.java:157)
at jdk.nashorn.internal.scripts.Script$Recompilation$83$25A$\^eval\_.interact(<eval>:14)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:645)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
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)
... 19 more
I'm trying to either beak or harvest a block, but I cannot without an error. Yes, I have tried HarvestedEvent, but I get an error no matter what I do. Please make sure your answer works before telling me to do X, I have found that unverified answers rarely work, are something I have tried before, and tend to annoy me.
I'd like to take a moment and thank both Daottoad and Osimon (youtube) for helping me to get this far with their examples. I'll be trying to pick items up and put them in a treasure chest, and then search for a specific block.
Hey everyone. Just a little request, could someone script something for me, so I can copy it into an NPC i'm making?
I need a script that makes it so %95 of the times someone try's to hit the NPC in question, it jumps to the left, (or right,) doesn't take damage, and text pops up. (i'll be able to change what the text says myself.)
EDIT: I also need to learn how to make an NPC use more than 1 ranged attack.
Thanks ahead of time! I've just started getting into scripting and i'm ready to start learning more about it in CMNPCs.
Oh, and could the update the script is configured for be 1.7.10? Thanks.
Goodbye, Minecraft forums. If any of ya'll future people persons need to contact me for whatever dumb reason, my discord is EnderDude124#8340 as of 6/8/2019. Send me a message, I like a good chat.
I guess you want the player to have a bad time. You might want to look at the api for the version you want. Using the damage event should work with what you want. Maybe set it cancelled, and set the NPC's position to it's left/right based upon its rotation.
I have some problems with defining things like entities and blocks. I always get undefined errors, so I cannot harvest/break/pick them up.
Heh. I think you figured out where i'm going with this :3
Where can I find the API? And how do I use it? I JUST started like, yesterday, so I don't know much.
Rollback Post to RevisionRollBack
Goodbye, Minecraft forums. If any of ya'll future people persons need to contact me for whatever dumb reason, my discord is EnderDude124#8340 as of 6/8/2019. Send me a message, I like a good chat.
The in-game console (settings) says there is no such function "getArmor", is this a bug in the 1.8.9 version?
Sorry have to put it in a code block or it erases the [] stuff ?? -- the get nearby ... is an array so you have to have [#] in there -- this should work
function tick(event) {
var x = event.npc.getX();
var y = event.npc.getBlockY();
var z = event.npc.getBlockZ();
if (event.npc.world.getNearbyEntities(x, y, z, 5, 1).length > 0) {
for (var i = 0; i < event.npc.world.getNearbyEntities(x, y, z, 5, 1).length; i++) {
if (event.npc.world.getNearbyEntities(x, y, z, 5, 1)[i].getArmor(3).name != null) {
if (event.npc.world.getNearbyEntities(x, y, z, 5, 1)[i].getArmor(3).name == "customnpcs:npcFullIronHead") {
event.npc.setFaction(2);
}
}
}
} else {
event.npc.setFaction(0);
}
}
function interact(event)
{
var block = event.npc.world.getBlock(10,75,323);
var player = event.player
if(block)
{
event.npc.say(block);
event.npc.say(block.getName());
event.npc.say(event.player.getName());
//event.npc.say(Math.random());
//event.npc.BlockEvent.HarvestedEvent(block.getName());
//block.getName().BlockEvent.HarvestedEvent(block.getName());
//block.BlockEvent.HarvestedEvent(block, player);
block.BlockEvent.BreakEvent(block);
}
else
{
event.npc.say("what?");
}
}
Output:
Fri Sep 16 09:20:39 CDT 2016 tab 1:
javax.script.ScriptException: TypeError: Cannot read property "BreakEvent" from undefined in at line number 14
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.onNPCInteract(EventHooks.java:61)
at noppes.npcs.entity.EntityNPCInterface.func_70085_c(EntityNPCInterface.java:406)
at net.minecraft.entity.EntityLiving.func_130002_c(EntityLiving.java:980)
at net.minecraft.entity.player.EntityPlayer.func_70998_m(EntityPlayer.java:1163)
at net.minecraft.network.NetHandlerPlayServer.func_147340_a(NetHandlerPlayServer.java:890)
at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:52)
at net.minecraft.network.play.client.C02PacketUseEntity.func_148833_a(SourceFile:11)
at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at net.minecraft.util.Util.func_181617_a(SourceFile:44)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:660)
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: :14 TypeError: Cannot read property "BreakEvent" from undefined
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.Undefined.get(Undefined.java:157)
at jdk.nashorn.internal.scripts.Script$Recompilation$83$25A$\^eval\_.interact(:14)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:645)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
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)
... 19 more
I'm trying to either beak or harvest a block, but I cannot without an error. Yes, I have tried HarvestedEvent, but I get an error no matter what I do. Please make sure your answer works before telling me to do X, I have found that unverified answers rarely work, are something I have tried before, and tend to annoy me.
I'd like to take a moment and thank both Daottoad and Osimon (youtube) for helping me to get this far with their examples. I'll be trying to pick items up and put them in a treasure chest, and then search for a specific block.
Why am I using interact; shouldn't I use tick?
Interact is easiest to control and test with.
Yes your going to have to use tick if its just some block --- harvested is used for scripted blocks and break (which is really function broken(event) )is also for scripted blocks. Use tick to see if the block is still there after the interact -- or do you want the interact to break the block?
I've tried increasing the points for friendly but it just messes it up and aggressive is still default. All i want is for the friendly faction to be default.
Your default npc is aggressive?? when you create them with the wand??
He can copy the altered textures into the jar files texture folder? Thats what i mostly does.
Important as you say, for personal use only.
There is a farmer job that puts stuff in a chest -- maybe you can work that in and see what you would like as far as additional actions from scripting -- need to break it up in to separate parts.
Yeah, I'm looking at your stuff for help, and some of the 1.7.10 scripts to modify them to 1.8.9. Tried the farmer job in the NPC's settings, but it didn't do anything or pick up items. Maybe it's just for scripting porpoises, and NPCs. Used firefox's scrapbook to get an offline copy of the API, so that helps. Tried to get Octavia to die on interact, then say something using the death event, but it didn't work so well. I now know about using event.npc.kill().
I know the farmer will work if there is an existing farm in range.
Thanks so much for the help, guys!! Highly appreciated! Hopefully, I'll figure it out now.
Thanks, it works with the wheat (but not harvestcraft plants). Two farmers will sometimes harvest phantom plants if they work the same field. It seems to only work with wheat, but I haven't tried pumpkins/melons yet (still need to grow them). Neither farmer plants anything new, even with seeds in their inventory. This does give me ideas for scripting them though.
Edit: they just harvested a pumpkin, and a whole melon..
My farmer actually crashes for some reason, I've deleted him and recreated, but randomly crashes every time... I set a chest up next to him to put things in, and when i click on the chest it crashes, and when i click on the farmer it crashes, and on top of that he doesn't farm, if anyone can read a crash report i can post it up
when is there a 1.10.2 update
Yeah, .jar texture edits and resource pack edits are carried out in almost an identical way. While they both work, the advantage resource packs have over .jar edits is they can be easily shared (as long as you own the textures its legal) and the edits don't have to be redone for updates to come.
You can easily turn what you got into a resource pack too; just copy the whole assets folder out of the mod file, then delete the "blockstates" , "lang", "models" and "schematic" files in the customnpcs subfolder. You also won't need the assets/moreplayermodels folder either.
Place what you got now into a .zip folder and then look up a quick tutorial for making a "pack.mcmeta" file.
I'm able to get an NPC to say things when different entities are nearby. Farmers harvest carrots and taters as pumpkins.
Possible farming pseudocode (because Pam's, and reasons)
Search for water block ~1 unit lower/higher than current position
check closeness to home position
navigate to it
turn surrounding dirt/grass to farmland
plant seed/add block atop farmland (yes, plants are blocks too)
check nearby blocks for harvestables
break harvestables
pickup dropped items into inventory
find nearby chest
put items in chest
R&R ad infinitum
Well, according to a post from the previous page:
No indication of 1.10.2 in there, though. Just for 1.10, most likely. Noppes will get to a later version of 1.10 when he's good and ready. Until then, after the 1.10 version comes out this week (unless there's a delay), just use 1.10 instead of 1.10.. If you must use 1.10.2, then tough. He'll get to it when he gets to it.
Be friendly to me, & I'll be friendly to you. Sounds easy, right?
My YouTube channel:
DolphyBlueDrake
Well I heard most of the 1.10 even 1.9.4 mods would work for 1.10.2.
I've tried increasing the points for friendly but it just messes it up and aggressive is still default. All i want is for the friendly faction to be default.
Okay, now I need some help.
Script:
Output:
I'm trying to either beak or harvest a block, but I cannot without an error. Yes, I have tried HarvestedEvent, but I get an error no matter what I do. Please make sure your answer works before telling me to do X, I have found that unverified answers rarely work, are something I have tried before, and tend to annoy me.
I'd like to take a moment and thank both Daottoad and Osimon (youtube) for helping me to get this far with their examples. I'll be trying to pick items up and put them in a treasure chest, and then search for a specific block.
Why am I using interact; shouldn't I use tick?
Interact is easiest to control and test with.
Hey everyone. Just a little request, could someone script something for me, so I can copy it into an NPC i'm making?
I need a script that makes it so %95 of the times someone try's to hit the NPC in question, it jumps to the left, (or right,) doesn't take damage, and text pops up. (i'll be able to change what the text says myself.)
EDIT: I also need to learn how to make an NPC use more than 1 ranged attack.
Thanks ahead of time! I've just started getting into scripting and i'm ready to start learning more about it in CMNPCs.
Oh, and could the update the script is configured for be 1.7.10? Thanks.
Goodbye, Minecraft forums. If any of ya'll future people persons need to contact me for whatever dumb reason, my discord is EnderDude124#8340 as of 6/8/2019. Send me a message, I like a good chat.
I guess you want the player to have a bad time. You might want to look at the api for the version you want. Using the damage event should work with what you want. Maybe set it cancelled, and set the NPC's position to it's left/right based upon its rotation.
I have some problems with defining things like entities and blocks. I always get undefined errors, so I cannot harvest/break/pick them up.
Heh. I think you figured out where i'm going with this :3
Where can I find the API? And how do I use it? I JUST started like, yesterday, so I don't know much.
Goodbye, Minecraft forums. If any of ya'll future people persons need to contact me for whatever dumb reason, my discord is EnderDude124#8340 as of 6/8/2019. Send me a message, I like a good chat.
Sorry have to put it in a code block or it erases the [] stuff ?? -- the get nearby ... is an array so you have to have [#] in there -- this should work
Yes your going to have to use tick if its just some block --- harvested is used for scripted blocks and break (which is really function broken(event) )is also for scripted blocks. Use tick to see if the block is still there after the interact -- or do you want the interact to break the block?
Your default npc is aggressive?? when you create them with the wand??