• 1

    posted a message on Custom NPCs
    Quote from xscythe12345»

    Please somebody help me with the script in Interact Hook :


    try changing:

    var k_sp = new java.awt.event.KeyEvent{source:fr_eve, int:k_prs, long:k_sys, int:k_mod, int:k_spc};

    to

    var k_sp = new java.awt.event.KeyEvent(fr_eve, k_prs, k_sys, k_mod, k_spc);
    Posted in: Minecraft Mods
  • 1

    posted a message on Custom NPCs

    The basic steps i use are as follows:


    1) create a hidden NPC somewhere within the spawn chunk (so it's always loaded)

    Open the script editor for this npc an in"Init" put:


    var globals = {

    game:{

    chapter: 0,

    scene: 0,

    step: 0

    }

    };


    world.setTempData("globals", globals);


    2) Create the NPC I want the player to interact with:

    Open the editor for this NPC and in the "update" tab:


    if(world.hasTempData("globals")){ //the world init has been run successfully

    var globals = world.getTempData("globals");

    if(globals.game.chapter==-1){ //something somewhere has called for a "reset"

    //do whatever you need to do here to reset the NPC

    }


    if(globals.game.chapter==1 && globals.game.scene==0){

    //something, somewhere has called for the game to "start"

    //so do any NPC setup we need

    }

    }


    Then in the dialog_closed tab, for example:


    var myStartTheGameDialogID=5;

    if(world.hasTempData("globals") && dialog==myStartTheGameDialogID){

    var globals = world.getTempData("globals");

    globals.game.chapter=1;

    }


    So now we should have 2 NPCs, one hidden, and one the player talks to. Upon finishing the dialog's and closing, in our case dialog #5, the chapter in the globals object is set to 1. The update hook for the NPC is then fired, and the if statement checking for the start of game is run.


    And then somewhere else in your world you could have another NPC, that when spoken to, sets the globals.game.chapter to "-1". This would then cause the "reset" if statement in our npc to be run.


    -- Edit --

    You could also do your time calculations within the "update" tab of the hidden NPC, and update your game chapter and scene flags accordingly. For example, you could have the game switch to chapter 2, 1 Minecraft day after the game was first started.


    Hope that makes sense.

    Posted in: Minecraft Mods
  • 2

    posted a message on Custom NPCs
    Quote from daottoad»

    I know I must be missing something obvious but just can;'t figure this out. I am trying to make a delay in the interact scripting tab but it just does not advance.

    I have this in the init tab


    world.setTempData("time_start",world.getTotalTime());

    and this in the interact tab


    var time_start1,k;
    time_start1 = world.getTempData("time_start");
    for (k = 0; k <= 30; k = world.getTotalTime() - time_start1) {
    npc.say(k);
    }


    I've found the best way to deal with delays is to use the update hook.


    Something like:


    var currentStep=npc.getTempData("ActionStep");

    switch(currentStep){

    case 0:

    npc.say("No Delay");

    break;

    case 1:

    npc.say("~0.5 Second Delay");

    break;

    case 2:

    npc.say("~1 second delay");

    break;

    case 10:

    npc.say("~5 Second delay");

    break;

    }

    npc.setTempData("ActionStep", currentStep+1);


    I was able to use this technique to create and NPC Tour guide, that could pause at checkpoints and speak before continuing. You just need to keep a track of where in the sequence you are.

    Posted in: Minecraft Mods
  • 1

    posted a message on Custom NPCs
    Quote from a5992369»
    beacuse i online and offline npc is clone! clone~clone~clone sever will crash!!!

    i need new updata~~ ˊˇˋMY GOD!!


    You have yet to actually explain your problem. Including a crash report may help...

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from Stouty2112»

    I am trying to accomplish making a NPC move to a location using the Coordinates at a certain time. I've seen people do it using the

    npc.navigateTo() function and putting the coordinates in the brackets like 54,21,120


    I have it set up as "npc.navigateTo(515,70,-1152);"


    npc.navigateTo needs a speed supplied as the 4th parameter so for example:


    npc.navigateTo(515, 70, -1152, 5)


    (i think the default speed for an Npc is 5)


    After consulting the Javadoc the correct call would be:


    npc.navigateTo(515, 70, -1152, 0.7)


    From the Javadoc:

    Walking speed of the entity 0.7 is default

    Posted in: Minecraft Mods
  • 0

    posted a message on Belgian Inspired Chateau

    Belgian Inspired Chateau

    Inspired by Chateau De Noisy, in Belgium, this Castle is perfect as a base for Adventure Map builders.


    Chateau for 1.8

    After entering the estate through a private Gatehouse, you will be immediately awed by the Grand Tower of this beautiful Chateau. The hard lines of the Main building are eased by softened tones of local rock and accentuated by the many smaller towers.


    Spanning 2 main floors with an additional attic floor, this spacious abode boasts over 20 rooms with separate Family and Guest wings, a Grand Ballroom and it's own Chapel. Ample outdoor entertaining spaces include sculpted gardens and an exotic swimming area with naturally shaded gazebos.


    The curious among you can find many hidden walkways and storage rooms, that were once used by staff to move quickly and unseen throughout the home.


    The walled grounds of the Manor are expansive and include a self contained stables with attached Stable-hand quarters. With crops already growing in the private farm, this exclusive home is ready to move your belongings in.


    Hey, This is my first submission, be nice :)


    The world save can be downloaded from here: http://chromecide.com/index.php/minecraft/minecraft-maps/chateau-for-minecraft-1-8/

    Posted in: Maps
  • 2

    posted a message on Custom NPCs
    Quote from daottoad»

    well for some reason you can pass the player in TempData but not StoredData. I would love to know why/what kind of data type this is?


    Temp data can store entire objects. Stored data can only store Numbers and Strings.

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs

    I'm using the 1.8beta for a map and have had very few issues that weren't because of my own silliness(not backing up my world before updating). As long as you're willing to update when new builds are released, you should be fine.


    --Edit--

    The only other mod i'm using it with is NEI

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from RtYyU36 jump

    Also a question; what's the easiest way to make some NPCs act like the vanilla villagers in the sense that they wonder around and then retreat to their homes at night. (also if they must be stationary during the day)

    Wander: Go to the AI Tab. Edit "Movement". Set the "Moving Type" to "Wandering".
    Hide at night: I think about the closest thing for this would be to set the "Shelters From" setting on the AI Tab to "Darkness"

    alternatively you can set the npc to have different settings between day and night, and you can use the Pather tool to change the locations for day and night as well. so you could set the npc to be wandering during the day, with the position set to outside and standing at night, with the position set to inside their house.
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from TheWithz»
    I was looking around in the API and i couldn't find a function that would set the npcs' (Door interact) action. is there a way to change this via scripting?

    Edit: also there didnt seem to be a way to change an NPC's movement type through scripting

    Both of these have been added in the latest 1.8.0alpha
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from Bricrue»
    Where is the link to the 1.8 version. And when was it last updated?

    http://minecraft.curseforge.com/mc-mods/221826-custom-npcs/files

    Updated Feb 8th
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from obsidiancow»
    idk
    but can i use your mod for my server and mod pack

    As noted in the first post of this thread.


      Licensed under the Creative Commons BY-NC

      If you want to use it for a modpack, include a link to this thread

    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Quote from SentientXIII»
    How do we use the setBlock method in world.

    Just as a test I'm trying to get an npc to place a block of stone when damaged.

    This will set the block the NPC is standing on to Stone (In Javascript/ECMAScript):

    //First you need to create the block itself
    var stone = world.createItem('minecraft:stone', 0, 1);//create the block

    //then you can use that in your call to SetBlock
    world.setBlock(npc.getBlockX(), npc.getBlockY()-1, npc.getBlockZ(), stone);
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Model Suggestion: A Block. The uses for a block that can have interactions and dialogs like an NPC would be endless. You could skin it like an ATM and give it the bank role. Or you could skin it like a Lucky Block and add a script to give it similar functionality to the Lucky Block Mod.

    Alternatively, add support for being able to select any block texture for a slime?
    Posted in: Minecraft Mods
  • 0

    posted a message on Custom NPCs
    Where and how do I find the .minecraft folder? I use Windows 8.1.

    I've found the easiest way is to launch minecraft. Then go to Options => Resource Packs => Open Resource Pack folder. That will get you into one of the subfolders of your minecraft directory, and you can just go up from there.
    Posted in: Minecraft Mods
  • To post a comment, please .