The only way I've seen this in RSPS is kqueen which is the npc dying and spawning another, but I don't think thats what your looking for. The easiest thing to do is put a timer on the sheep after sheering it until the wool grows back.
|
Ok so I'm doing sheep shearing.. and I need to know how to change a clothed sheep into a naked sheep.
This is what I have under firstClickNPC in actionhandler:
But it doesn't do anything. whats the correct method for doing this? Will Rep++ for correct answer. thanks!Code:case 43: npcType = 42; break;
EDIT:
Tried this:
Got this error:Code:case 43: if(c.getItems().playerHasItem(1735, 1)) { if(System.currentTimeMillis() - c.buryDelay > 2000) { c.getItems().addItem(1737, 1); c.sendMessage("You shear the sheep and get some wool."); c.startAnimation(893); c.buryDelay = System.currentTimeMillis(); int x = Server.npcHandler.npcs[].makeX; int y = Server.npcHandler.npcs[].makeY; Server.npcHandler.npcs.newNPC(42, x, y, 0, 1, 0, 0, 0, 0); } }
Code:src\server\model\players\ActionHandler.java:996: class expected int x = Server.npcHandler.npcs[].makeX; ^ src\server\model\players\ActionHandler.java:997: class expected int y = Server.npcHandler.npcs[].makeY; ^ 2 errors Press any key to continue . . .
The only way I've seen this in RSPS is kqueen which is the npc dying and spawning another, but I don't think thats what your looking for. The easiest thing to do is put a timer on the sheep after sheering it until the wool grows back.
Transformation mask in npc updating.
doubt you can use that though p;Code:public class Sheep extends NPC { public Sheep(int slot, int type, Location spawn) { super(slot, type, spawn); super.maxHP = 0; } public void process() { if (getType() == 42 && System.currentTimeMillis() - sheared > 60000) { transform(43); } super.process(); } public void handleShear(final Client c) { if (!c.getItems().playerHasItem(1735)) { c.sendMessage("I need shears to do that!"); return; } c.faceEntity(this); if (getType() == 43) { c.startAnimation(893); World.getWorld().submit(new Tick(2) { @Override public void execute() { if (c != null) { if (Misc.random(9) == 1) { WALK_TYPES walk = WALK_TYPES.getRandom(); if (walk != null) getMove().walk(walk); forceChat("BAAAAA!!"); } else { c.getItems().addItem(1737, 1); c.sendMessage("You shear the sheep and get some wool."); forceChat("Baaaa!"); sheared = System.currentTimeMillis(); transform(42); } c.resetFacing(); } this.stop(); } }); } else { c.sendMessage("This sheep is already sheered."); } } long sheared; }
ot; use the npc transform mask
Code:public void transform(int Id) { transformId = Id; transformUpdateRequired = true; updateRequired = true; }
The transform method won't do anything unless you include the transformId and everything in npc updating block
like so:
then in npcupdatingblockCode:public void appendTransformUpdate(Stream str) { str.writeWordBigEndianA(transformId); }
Code:if (transformUpdateRequired) appendTransformUpdate(str);
Say in itemonobject.java, how could we use this?
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |