I'm having an issue with one of the script functions.
Specifically, navigateTo()
As shown in the Javadock,
navigateTo(double x, double y, double z, double speed)
I'm attempting to make the NPC move to a specific location upon their spawn, and the following works (called in Init):
npc.navigateTo(npc.x+10, npc.y, npc.z, 0.7);
This causes my npc to move 10 blocks in the X direction, attempting to maintain the name y and z coordinates. The code works fine, but I want my NPC to go somewhere specific. So the following code should, in theory, move the NPC to x of 0, and z of 0, while maintaining their y coordinate:
npc.navigateTo(0, npc.y, 0, 0.7);
However, when the NPC spawns with this code block, they do not move. I have tried using a number of coordinate combinations, some negative and others with decimal places, but I cannot get the NPC to navigate to specific preset coordinates. Am I doing something wrong here?
No that seems fine. It might just be that it's too far away from its current point making it impossible to navigate that far.. You could try npc.setHome(0, npc.getBlockY(),0)
Noppes, you mentioned in your update video that it is possible to make npcs give tours of areas and such. How would one script this? (Cause i am utterly clueless) Also, how do you make an npc a follower after just normal dialogue, without having to pay them anything, or that not possible as of yet? And can you give items to npcs after they become your followers? Sorry for alot of questions lol, but I'm having a birthday soon and I'm making a huge adventure map highliting your mod, and am wanting to show my friends the cool stuff you can do with it.
I also really appreciate you being here on the forums with your fans, and helping us out:) Your truly awesome, and thanks again!
This is one of the scripts I use:
Init:
npc.size = 3;
npc.setTempData("ticks", 0);
Interact:
var x = npc.blockX;
var z = npc.blockZ;
if(x == -319 && z == -1357){
npc.say("Don't touch me");
npc.setHome(-309, 35, -1366);
}
else if(x == -309 && z == -1366){
npc.say("No stop it!");
npc.setHome(-323, 35, -1362);
}
else if(x == -323 && z == -1362){
npc.say("Arg go away!!");
npc.setHome(-316, 35, -1372);
}
else if(x == -316 && z == -1372){
npc.say("Leave me alone already");
npc.setHome(-308, 35, -1357);
}
else if(x == -308 && z == -1357){
npc.size = 7;
npc.say("ENOUGH!");
player.knockback(20, player.rotation);
}
No that seems fine. It might just be that it's too far away from its current point making it impossible to navigate that far.. You could try npc.setHome(0, npc.getBlockY(),0)
Yea it must have been too far away. Changed coordinates to a closer place, and that worked. What's the maximum range on a command like this?
Yea it must have been too far away. Changed coordinates to a closer place, and that worked. What's the maximum range on a command like this?
Pathfinding has a hardcoded limit of 16 by default. I increased this to 32. You can increase it further in the Customnpcs.cfg, but I dont recommend it. Pathfinding is a heavy process and increase exponentially the further it needs to navigate.
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
I know that you need to make a .json file in order to add sounds, but I have absolutely no idea what that is or how to do it. Could someone direct me to an instructional video or webpage?
I don't like your idea of "Companions".
Seriously,as for Companions I was hoping something like in Dragon Age,where you had all those characters and you could talk with them,equip them or even train them...
But you think of Companions like they are Digimons!
Come on!
I've read it with more attention, and I understand you wanted to make "sons".
But Sons and Companions are two different things!
How about making "Son" as a role and "Companion" as another?
My idea of Companion is:
-You can set all the things as for normal Npc's except for the Inventory,as they gain advantage by the stuff you give to them.
-You can give them orders to attack only certain factions,monsters or Custom Npc's.
-You have to feed them,but you can set their food.
-Maybe...Level Up? Give them certain statistics for each Level Up,and setting the Experience they need to do so...
So please,don't mix Companions with Pets/Sons.
But I like your idea too! Someone could make a Digimon story out of it or a Monster Pet game! =D
Actually Im making them like the original digimon world, so nicely caught on. I dont see how the things you want are any different from what I have planned though. Ofcourse you will be able to disable the evolution/maturing of the companion. With that disabled its almost exactly what you want.
Though I wont set them to require a specific type of food. They'll eat any kind of food. It also wont really level up, but you can level up individual stats like sword fighting and armor skills.
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
How would I freeze an NPC in place, and make it so it has no movement animations?
I thought the feature "Has Living Animation" would accomplish this (or at least, would remove the movements), but it doesn't seem to do anything.
EDIT: While I'm here... is there a script command to spawn an NPC?
Has no living animation should remove the 'breathing effect'. To make it stop moving around go the the movement options and set the rotation to manual.
You can spawn server sided clones with world.spawnClone(x,y,z,tab,clonename)
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
The Meaning of Life, the Universe, and Everything.
Location:
Phoenix
Join Date:
2/19/2013
Posts:
338
Minecraft:
GreatOrator
Member Details
Have a quick idea if this is possible.
Could you add an item that could be used by mapmakers that would make it possible to create an NPC then turn it into a spawn egg of some kind so they could be given out for things like a portable shop or bank they could carry around or buy and place at their base?
Could you add an item that could be used by mapmakers that would make it possible to create an NPC then turn it into a spawn egg of some kind so they could be given out for things like a portable shop or bank they could carry around or buy and place at their base?
Yes actually I already made this for the next update. Its a soul stone and can be used to store npcs
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
Attempting to declare variables in the Init section, so I can use them in other sections.
Example:
int variableOne = 0;
This returns the error "identifier is a reserved word". Can I not declare variables, or am I doing it wrong?
Im no javascript expert, but Im pretty sure it only uses var. You cant use int. Also yes you are doing it wrong you can use variables like that accros the other scripts. You have to store the variable and get it again with npc.setTempData and setStoreData. If you are using and int dont forget to var i = parseInt(npc.getTempData("VariableOne"));
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
The Meaning of Life, the Universe, and Everything.
Location:
Phoenix
Join Date:
2/19/2013
Posts:
338
Minecraft:
GreatOrator
Member Details
Ok, so one last thing then. I have noticed peculiar interactions between your mod and certain others. It is not a bug on your part whatsoever, but in your next update can you code your npcs in a way so that they cannot be captured by other mobs items? safari net from mfr or the lasso from extra utilities comes to top of mind?
I believe with the EU lasso it just simply check for passive mobs only to determine their capture ability.
Ok, so one last thing then. I have noticed peculiar interactions between your mod and certain others. It is not a bug on your part whatsoever, but in your next update can you code your npcs in a way so that they cannot be captured by other mobs items? safari net from mfr or the lasso from extra utilities comes to top of mind?
I believe with the EU lasso it just simply check for passive mobs only to determine their capture ability.
Nope I cant prevent that Im afraid
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
Okay I was trying to create variables with Java and not Javascript; var is working for declaration of variables. However, I cannot seem to get variables to cross between scripts.
I used the following:
Init Script:
var variableOne = 0; //if I don't include this, I get an error saying "variableOne is not defined" when I use it below
npc.setTempData(variableOne,0);
Interact Script:
var x = npc.getTempData(variableOne);
With this code, I get an error in the interact script saying "variableOne is not defined".
Okay I was trying to create variables with Java and not Javascript; var is working for declaration of variables. However, I cannot seem to get variables to cross between scripts.
I used the following:
Init Script:
var variableOne = 0; //if I don't include this, I get an error saying "variableOne is not defined" when I use it below
npc.setTempData(variableOne,0);
Interact Script:
var x = npc.getTempData(variableOne);
With this code, I get an error in the interact script saying "variableOne is not defined".
Did you read the api? setTempData and getTempData use a string as key. Remove the var variableOne and make a string out of the other two.
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
Hello sir Noppes, I was wondering, with the Soul Stones can you implement a setting so we can designate whether or not an npc can be captured with a soul stone and have it default to no? that way by default random players cant just pick up any old npc and move them? But for quests they can capture certain spawned npcs (say a fairy) and bring them back.
Also is there any progress on the following 2 things - Hovering/flying ai and the ability to make custom NPC pokemon trainers you can battle? Not satisfied with pixelmon's skin system or their trainers and my cries fall on deaf ears lol.
Hello sir Noppes, I was wondering, with the Soul Stones can you implement a setting so we can designate whether or not an npc can be captured with a soul stone and have it default to no? that way by default random players cant just pick up any old npc and move them? But for quests they can capture certain spawned npcs (say a fairy) and bring them back.
Also is there any progress on the following 2 things - Hovering/flying ai and the ability to make custom NPC pokemon trainers you can battle? Not satisfied with pixelmon's skin system or their trainers and my cries fall on deaf ears lol.
Only opped players can use soul stones to capture any entity. Normal players will only be able to use soulstone on companion npcs or animals and the animals part can be disabled in the config.
Hovering/flying ai no progress. Im waiting for 1.8 to come out to see if I can repurpose the new fish swimming ai to work outside of water as well.
Well it is very experimental and very untested, but npcs can start pokemon battles. The way it works is clone a pixelmontrainer, create and npc with the spawner job and set the cloned pixelmontrainer in its first slot. Next set the npc to an aggressive faction and set the npc to do nothing on attack. This should make it start pixelmon battles with anyone it sees in survival. I have asked serveral people to test and give me feedback, but I never got any.
Rollback Post to RevisionRollBack
Those who want to chat or hang out, join me on discord
Want to support me? Become one of my patrons:
No that seems fine. It might just be that it's too far away from its current point making it impossible to navigate that far.. You could try npc.setHome(0, npc.getBlockY(),0)
This is one of the scripts I use:
Init:
Interact:
Update:
No currently you cant set the owner of a npc with scripting. In my next release you will be able to do that though.
Want to support me? Become one of my patrons:
Yea it must have been too far away. Changed coordinates to a closer place, and that worked. What's the maximum range on a command like this?
Pathfinding has a hardcoded limit of 16 by default. I increased this to 32. You can increase it further in the Customnpcs.cfg, but I dont recommend it. Pathfinding is a heavy process and increase exponentially the further it needs to navigate.
Want to support me? Become one of my patrons:
Actually Im making them like the original digimon world, so nicely caught on. I dont see how the things you want are any different from what I have planned though. Ofcourse you will be able to disable the evolution/maturing of the companion. With that disabled its almost exactly what you want.
Though I wont set them to require a specific type of food. They'll eat any kind of food. It also wont really level up, but you can level up individual stats like sword fighting and armor skills.
Want to support me? Become one of my patrons:
I thought the feature "Has Living Animation" would accomplish this (or at least, would remove the movements), but it doesn't seem to do anything.
EDIT: While I'm here... is there a script command to spawn an NPC?
i'm doing a survival thing and i needed it
http://www.youtube.com/watch?v=eFw0V2lhgfU
Here
Has no living animation should remove the 'breathing effect'. To make it stop moving around go the the movement options and set the rotation to manual.
You can spawn server sided clones with world.spawnClone(x,y,z,tab,clonename)
Want to support me? Become one of my patrons:
Could you add an item that could be used by mapmakers that would make it possible to create an NPC then turn it into a spawn egg of some kind so they could be given out for things like a portable shop or bank they could carry around or buy and place at their base?
Facebook Page - http://www.facebook..../Landofdraconis
IRC - http://webchat.esper.net/?channels=TolkienCraftII
Yes actually I already made this for the next update. Its a soul stone and can be used to store npcs
Want to support me? Become one of my patrons:
Attempting to declare variables in the Init section, so I can use them in other sections.
Example:
This returns the error "identifier is a reserved word". Can I not declare variables, or am I doing it wrong?
Im no javascript expert, but Im pretty sure it only uses var. You cant use int. Also yes you are doing it wrong you can use variables like that accros the other scripts. You have to store the variable and get it again with npc.setTempData and setStoreData. If you are using and int dont forget to var i = parseInt(npc.getTempData("VariableOne"));
Want to support me? Become one of my patrons:
I believe with the EU lasso it just simply check for passive mobs only to determine their capture ability.
Facebook Page - http://www.facebook..../Landofdraconis
IRC - http://webchat.esper.net/?channels=TolkienCraftII
Nope I cant prevent that Im afraid
Want to support me? Become one of my patrons:
I used the following:
With this code, I get an error in the interact script saying "variableOne is not defined".
Did you read the api? setTempData and getTempData use a string as key. Remove the var variableOne and make a string out of the other two.
Want to support me? Become one of my patrons:
All figured out and working like I want it to now. Didn't realize the need for quotes regarding making it a string.
Thanks for all the help!
Also is there any progress on the following 2 things - Hovering/flying ai and the ability to make custom NPC pokemon trainers you can battle? Not satisfied with pixelmon's skin system or their trainers and my cries fall on deaf ears lol.
Only opped players can use soul stones to capture any entity. Normal players will only be able to use soulstone on companion npcs or animals and the animals part can be disabled in the config.
Hovering/flying ai no progress. Im waiting for 1.8 to come out to see if I can repurpose the new fish swimming ai to work outside of water as well.
Well it is very experimental and very untested, but npcs can start pokemon battles. The way it works is clone a pixelmontrainer, create and npc with the spawner job and set the cloned pixelmontrainer in its first slot. Next set the npc to an aggressive faction and set the npc to do nothing on attack. This should make it start pixelmon battles with anyone it sees in survival. I have asked serveral people to test and give me feedback, but I never got any.
Want to support me? Become one of my patrons:
will there ever be horse-ish mounts for npcs?((cant find my other post))
or shields easier to use for players?
thanks