Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ASDss: where do u download source and clients now
      August 18, 2017, 10:39:31 PM
    • ASDss: yo
      August 18, 2017, 10:39:20 PM
    • dan v jad: click me 4 da fun ;)[link]
      August 18, 2017, 04:39:58 PM
    • stCky: Palidinho is your OpenGL (was it OpenGL?) stuff open source anywhere?
      August 16, 2017, 09:07:22 PM
    • Travas:BUILD THE WALL
      August 15, 2017, 09:28:49 PM
    • Travas: i have ass cancer
      August 15, 2017, 09:23:29 PM
    • stCky: what are the fudge are you tryna ask?
      August 15, 2017, 08:21:35 PM
    • bader: what are the rsps community alive ?
      August 15, 2017, 05:46:16 PM
    • bader: yo guys
      August 15, 2017, 05:46:08 PM
    • Spacehost:[link] Updated our thread :)
      August 15, 2017, 09:40:34 AM
    • Adaro: The client is in Download section at Homepage
      August 15, 2017, 01:09:20 AM
    • FaTe_Of_GoDs: where do i get the client?????????????
      August 14, 2017, 05:23:14 PM
    • stCky: can anyone help me? I cant login to the shoutbox
      August 13, 2017, 05:45:15 PM
    • drubrkletern: appeal denied
      August 13, 2017, 02:35:27 PM
    • King_Trout:[link]
      August 13, 2017, 11:17:12 AM
    • Cole1497: no sorry
      August 13, 2017, 10:27:14 AM
    • ayz: yo can anyone explain something to me
      August 13, 2017, 08:08:51 AM
    • coolking12: Hi
      August 13, 2017, 04:16:06 AM
    • stCky: n+1
      August 11, 2017, 06:09:24 PM
    • PalidinoDH: How many more pages are going to show errors before this dude gets on and fixes shit
      August 11, 2017, 04:57:00 PM

    Author Topic: animatedArmor warriors guild  (Read 842 times)

    0 Members and 1 Guest are viewing this topic.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    animatedArmor warriors guild
    « on: July 07, 2015, 10:47:22 PM »
    my warrior guild guys are not moving from there spot when they are spawned they just stand in one place, not sure if you guys that are helping will need my warriors guild class or what class it deals with i'm not sure..


    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #1 on: July 08, 2015, 10:46:37 AM »
    This tends to happen when people add in region clipping. For some reason, people don't actually like to "script" npcs, but instead just used the already programmed in methods. Because of this, the NPC is trying to walk to your character (As the npc is aggressive towards you),  but cannot because due to region clipping, there is no valid area for the NPC to walk (All tiles around it are non-walkable tiles).

    There are 2 solutions to this:
    1) In your warriors guild code, make the npc spawn 1 tile closer to your character in the pic.

    2) Actually script the npcs to ignore region clipping in that one section (You know, make it walk in one of the 4 exits) like it should be done.


    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #2 on: July 08, 2015, 01:30:07 PM »
    This tends to happen when people add in region clipping. For some reason, people don't actually like to "script" npcs, but instead just used the already programmed in methods. Because of this, the NPC is trying to walk to your character (As the npc is aggressive towards you),  but cannot because due to region clipping, there is no valid area for the NPC to walk (All tiles around it are non-walkable tiles).

    There are 2 solutions to this:
    1) In your warriors guild code, make the npc spawn 1 tile closer to your character in the pic.

    2) Actually script the npcs to ignore region clipping in that one section (You know, make it walk in one of the 4 exits) like it should be done.

    Maybe this will Help.. need to know if its a tile problem or what.

    Code: [Select]
    package ardi.model.minigames;

    import ardi.model.players.Client;
    import ardi.event.Event;
    import ardi.event.EventManager;
    import ardi.event.EventContainer;
    import ardi.Server;

    /**
     * @author Brandyn
     */
    public class WarriorsGuild {

    public WarriorsGuild() {
    //TO DO
    }

    private int xCoord, yCoord;
    private boolean spawned;

    public void setSpawned(Client c, boolean spawned) {
    c.spawned = spawned;
    }

    private final int[][] ARMORREQUIRED = {{1075, 1117, 1155, 4278, 20, 5, 30, 100}, {1067, 1115, 1153, 4279, 30, 7, 40, 100}, {1069, 1119, 1157, 4280, 40, 10, 60, 100}, {1077, 1125, 1165, 4281, 50, 15, 70, 100},
    {1071, 1121, 1159, 4282, 60, 15, 80, 100}, {1091, 1123, 1161, 4283, 80, 17, 90, 10}, {1079, 1127, 1163, 4284, 100, 20, 100, 100}};

    /**
    * Handles which armor through ItemOnObject
    * @param itemId The item id used
    * @param X The object X-Coordinate
    * @param Y The object Y-Coordinate
    */
    public void handleArmor(Client c, int itemId, int X, int Y) {
    if(!spawned) {
    this.xCoord = X;
    this.yCoord = Y;
    for(int i = 0; i < ARMORREQUIRED.length; i++) {
    for(int f = 0; f < ARMORREQUIRED[0].length; f++) {
    if(itemId == ARMORREQUIRED[i][f]) {
    if(hasItem(c, ARMORREQUIRED[i][0], true) && hasItem(c, ARMORREQUIRED[i][1], true) && hasItem(c, ARMORREQUIRED[i][2], true)) {
    animateArmor(c, new int[] {ARMORREQUIRED[i][0], ARMORREQUIRED[i][1], ARMORREQUIRED[i][2]}, ARMORREQUIRED[i][3], ARMORREQUIRED[i][4], ARMORREQUIRED[i][5], ARMORREQUIRED[i][6], ARMORREQUIRED[i][7]);
    }
    }
    }
    }
    } else {
    c.sendMessage("You already have armor spawned!");
    }
    }

    /**
    * Checks if the player has an item in his inventory and/or equipment.
    * @param itemId The item id needed
    * @param inventory If the item needs to be in inventory, or in equipment
    * @return returns if it has the item.
    */
    private boolean hasItem(Client c, int itemId, boolean inventory) {
    return inventory ? c.getItems().playerHasItem(itemId) : c.getItems().playerHasItem(itemId) || c.playerEquipment[5] == itemId;
    }

    /**
    * Animates the armor, deletes items, and walks 3 steps back.
    *
    */
    private void animateArmor(Client c, int[] usedArmor, int npcId, int hitPoints, int maxHit, int attack, int defence) {
    c.getPA().walkTo(0, 3);
    for(int i = 0; i < 3; i++) {
    c.getItems().deleteItem(usedArmor[i], 1);
    }
    spawned = true;
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    }

    private final String[][] DEFENDER = {{"8850", "Rune"}, {"8849", "Adamant"}, {"8848", "Mithril"}, {"8847", "Black"}, {"8846", "Steel"}, {"8845", "Iron"}, {"8844", "Bronze"}};

    /**
    * Gets the cyclops' drop itemid.
    */
    public int getCyclopsDrop(Client c) {
    if(!c.kamfreenaDone)
    return Integer.parseInt(DEFENDER[6][0]);
    for(int i = 0; i < DEFENDER.length; i++) {
    try {
    if(hasItem(c, Integer.parseInt(DEFENDER[i][0]), false))
    return Integer.parseInt(DEFENDER[i - 1][0]);
    } catch(Exception e) {
    return Integer.parseInt(DEFENDER[0][0]);
    }
    }
    return Integer.parseInt(DEFENDER[6][0]);
    }

    /**
    * @return Returns the defender dropped in text.
    */
    public String getCyclopsDrop126(Client c) {
    for(int i = 0; i < DEFENDER.length; i++) {
    if(Integer.parseInt(DEFENDER[i][0]) == getCyclopsDrop(c)) {
    return DEFENDER[i][1];
    }
    }
    return DEFENDER[0][1];
    }

    /**
    * Handles Kamfreena's Dialogue
    */
    public void handleKamfreena(Client c, boolean door) {
    if(door) {
    if(!c.getItems().playerHasItem(8851, 100)) {
    c.sendMessage("You need 100 tokens to go in!");
    return;
    }
    if(c.absX < 2848) {
    if(!c.kamfreenaDone)
    c.getDH().sendDialogues(45, 4289);
    c.getPA().movePlayer(2848, 3541, 2);
    executeCyclopsTimer(c);
    } else {
    c.inCyclops = false;
    c.getPA().movePlayer(2847, 3541, 2);
    c.kamfreenaDone = false;
    }
    } else {
    c.kamfreenaDone = true;
    c.getDH().sendDialogues(47, 4289);
    }
    }

    /**
    * 60 Second timer removing 20 tokens.
    * @return returns the timer event
    */
    private Event cyclopsTimer(final Client c) {
    return new Event() {
    public void execute(EventContainer e) {
    if(c.getItems().playerHasItem(8851, 20) && c.inCyclops) {
    c.sendMessage("You lose 20 tokens.");
    c.getItems().deleteItem2(8851, 20);
    }
    if(!c.getItems().playerHasItem(8851, 20)) {
    c.inCyclops = false;
    c.sendMessage("You have ran out of tokens!");
    c.getPA().movePlayer(2846, 3541, 2);
    e.stop();
    }
    }
    };
    }

    /**
    * Executes the timed token removal. (60 seconds / 1 minute)
    */
    private void executeCyclopsTimer(Client c) {
    c.inCyclops = true;
    EventManager.getSingleton().addEvent(cyclopsTimer(c), 60000);
    }
    }

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #3 on: July 08, 2015, 02:58:49 PM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #4 on: July 08, 2015, 06:07:37 PM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    That's my warriors guild class...? that's what you simply just said, i was asking what in there needs changed or fixed..

    that's one of your solutions

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #5 on: July 08, 2015, 06:58:35 PM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    That's my warriors guild class...? that's what you simply just said, i was asking what in there needs changed or fixed..

    that's one of your solutions
    You did not ask that, you asked if it was a tile problem.

    I had already stated it was, and that you have two solutions.
    To change the coords.. you change the spawn coords in that file. (Hint: spawnNpc)
    To script the npc you'd have to write some new methods, probably in the npchandler.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #6 on: July 08, 2015, 11:20:32 PM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    That's my warriors guild class...? that's what you simply just said, i was asking what in there needs changed or fixed..

    that's one of your solutions
    You did not ask that, you asked if it was a tile problem.

    I had already stated it was, and that you have two solutions.
    To change the coords.. you change the spawn coords in that file. (Hint: spawnNpc)
    To script the npc you'd have to write some new methods, probably in the npchandler.

    I can't just put animated armour guys in spawn.cfg and put them ina position then they would be like a normal npc and they would not work correctly...  so how does adding them to spawn.cfg make any sense? people would just get free rune drops considering you have to make it like that for them.

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #7 on: July 09, 2015, 07:30:52 AM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    That's my warriors guild class...? that's what you simply just said, i was asking what in there needs changed or fixed..

    that's one of your solutions
    You did not ask that, you asked if it was a tile problem.

    I had already stated it was, and that you have two solutions.
    To change the coords.. you change the spawn coords in that file. (Hint: spawnNpc)
    To script the npc you'd have to write some new methods, probably in the npchandler.

    I can't just put animated armour guys in spawn.cfg and put them ina position then they would be like a normal npc and they would not work correctly...  so how does adding them to spawn.cfg make any sense? people would just get free rune drops considering you have to make it like that for them.
    I never said anything about the spawn.cfg. I'm not seeing where nor why you assumed I did.

    I said hint: spawnNpc.
    There's a method within your NPCHandler called spawnNpc. You use it in the WarriorsGuild class. This method spawns an NPC at the defined X, Y, and Z variables with specific stats...
    Change the position there.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #8 on: July 09, 2015, 02:15:52 PM »
    That code doesn't change anything.
    You still need to do either of the solutions I said.

    That's my warriors guild class...? that's what you simply just said, i was asking what in there needs changed or fixed..

    that's one of your solutions
    You did not ask that, you asked if it was a tile problem.

    I had already stated it was, and that you have two solutions.
    To change the coords.. you change the spawn coords in that file. (Hint: spawnNpc)
    To script the npc you'd have to write some new methods, probably in the npchandler.

    I can't just put animated armour guys in spawn.cfg and put them ina position then they would be like a normal npc and they would not work correctly...  so how does adding them to spawn.cfg make any sense? people would just get free rune drops considering you have to make it like that for them.

    O.K so here is this i tried changing the 0 to a 2 but i'm gonna assume that is not what i'm changing to make them walk?  here is my npchandler spawnwnNpc

    Code: [Select]
    for(int z = 0; z < animatedArmor.length; z++) {
    if (newNPC.npcType == animatedArmor[z]) {
    newNPC.forceAnim(4410);
    newNPC.forceChat("I'M ALIVE!");
    }
    }

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #9 on: July 09, 2015, 02:19:55 PM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #10 on: July 09, 2015, 02:41:54 PM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    So, i'm changing the 2 0's to where they would spawn?

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #11 on: July 09, 2015, 07:05:51 PM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    So, i'm changing the 2 0's to where they would spawn?
    No, you are changing the X coord or the Y coord. The first 0 is the z.

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #12 on: July 09, 2015, 07:52:19 PM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    So, i'm changing the 2 0's to where they would spawn?
    No, you are changing the X coord or the Y coord. The first 0 is the z.

    So i can just delete where is says x coord and put it my coords there?

    Offlinesk8rdude461

    • MOPARSCAPE WAS HACKED
    • Member
    • ****
    • *
    • Posts: 12,471
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #13 on: July 09, 2015, 08:23:40 PM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    So, i'm changing the 2 0's to where they would spawn?
    No, you are changing the X coord or the Y coord. The first 0 is the z.

    So i can just delete where is says x coord and put it my coords there?
    Or you could just change the value of the variable xCoord...
    if you put your own coord there it may spawn the npc for both of the animators in the same spot

    Offlinetank nation

    • Member
    • ****
    • Posts: 483
    • Thanks: +0/-0
      • View Profile
    Re: animatedArmor warriors guild
    « Reply #14 on: July 10, 2015, 12:01:12 AM »
    That is not your npchandler spawnNpc..
    I was talking about this line of code:
    Code: [Select]
    Server.npcHandler.spawnNpc(c, npcId, xCoord, yCoord, 0, 0, hitPoints, maxHit, attack, defence, true, true);
    That is found in your WarriorsGuild class.

    So, i'm changing the 2 0's to where they would spawn?
    No, you are changing the X coord or the Y coord. The first 0 is the z.

    So i can just delete where is says x coord and put it my coords there?
    Or you could just change the value of the variable xCoord...
    if you put your own coord there it may spawn the npc for both of the animators in the same spot

    So right where it says Xcoord i change that to mypos that i want the npc to spawn?

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal