Post: Halloween Event
11-21-2015, 07:11 PM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
How to add a neat Halloween event to your server for your players to enjoy Winky Winky

Note: this uses 474 NPC's.

This is the tutorial to add the Halloween event currently used on my server

Step 1 - Spawning Objects
Go into objectManager and search for
    public void loadCustomSpawns(Client c) {

Add this in there
    c.getPA().object(6951, 2583, 9896, 2, 10);
c.getPA().object(6951, 2578, 9899, 2, 10);
c.getPA().object(6951, 2572, 9895, 2, 10);
c.getPA().object(6951, 2577, 9894, 2, 10);
c.getPA().object(6951, 2580, 9894, 2, 10);
c.getPA().object(6951, 2577, 9893, 2, 10);
c.getPA().object(6951, 2578, 9893, 2, 10);
c.getPA().object(6951, 2579, 9893, 2, 10);
c.getPA().object(6951, 2580, 9893, 2, 10);
c.getPA().object(6951, 2585, 9895, 2, 10);
c.getPA().checkObjectSpawn(27254, 3214, 3212, 2, 10); //score
//c.getPA().checkObjectSpawn(27256, 2861, 3547, 2, 10); //block
c.getPA().checkObjectSpawn(16152, 2861, 3546, 1, 10); //block

This spawns everything for grims room, and the dark portal at lumbridge.

Step 2 - Spawning NPC's
Go into your spawn config and add this in there
    spawn = 6390	2873	3545	0	0	0	0	0	Grim
spawn = 5247 2576 9893 0 2 30 850 0 Penance


Step 3 - Adding dialogue
Go into the dialoguehandler class and search for
    switch(dialogue) {

Add this under that
    case 90:
sendNpcChat1("Hello mortal.", c.talkingNpc, "Grim Reaper");
c.nextChat = 91;
break;
case 91:
sendPlayerChat1("Alright mate.");
c.nextChat = 92;
break;
case 92:
sendNpcChat1("Fine thanks, and you?", c.talkingNpc, "Grim Reaper");
c.nextChat = 93;
break;
case 93:
sendOption3("Pretty good yeah.", "Why are you here?", "I want halloween gear!");
c.dialogueAction = 666;
break;
case 94:
sendNpcChat1("Cool.", c.talkingNpc, "Grim Reaper");
c.nextChat = 0;
break;
case 95:
sendNpcChat1("I need something dead.", c.talkingNpc, "Grim Reaper");
c.nextChat = 96;
break;
case 96:
sendPlayerChat1("But your the Grim Reaper...");
c.nextChat = 97;
break;
case 97:
sendNpcChat1("Do you want some gear or not?", c.talkingNpc, "Grim Reaper");
c.nextChat = 98;
break;
case 98:
sendPlayerChat1("Fine, what do you want me to kill.");
c.nextChat = 99;
break;
case 99:
sendNpcChat1("See that portal over there?", c.talkingNpc, "Grim Reaper");
c.nextChat = 100;
break;
case 100:
sendNpcChat1("Go in it, kill whatevers inside then talk to me again.", c.talkingNpc, "Grim Reaper");
c.nextChat = 0;
c.grimPrize = 1;
break;
case 101:
sendNpcChat1("Well done. You killed it.", c.talkingNpc, "Grim Reaper");
c.nextChat = 102;
break;
case 102:
sendPlayerChat1("Thanks, wheres my free stuff.");
c.nextChat = 104;
break;
case 104:
if(c.grimPrize == 2) {
int giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
giveGear = Misc.random(6);
if(giveGear == 0) {
c.getItems().addItem(10723,1);
} else if (giveGear == 1) {
c.getItems().addItem(10724,1);
} else if (giveGear == 2) {
c.getItems().addItem(10725,1);
} else if (giveGear == 3) {
c.getItems().addItem(10726,1);
} else if (giveGear == 4) {
c.getItems().addItem(10727,1);
} else if (giveGear == 5) {
c.getItems().addItem(10728,1);
} else if (giveGear == 6) {
c.getItems().addItem(10735,1);
}
} else {
c.sendMessage("Grim is unimpressed with your attempt to gain extra gear.");
c.getPA().startTeleport(3222, 3219, 0, "modern");
return;
}
sendNpcChat1("In your pack. 7 Random pieces of gear.", c.talkingNpc, "Grim Reaper");
c.nextChat = 105;
c.grimPrize = 3;
break;
case 105:
sendNpcChat1("Try trading with other players if you want a full set.", c.talkingNpc, "Grim Reaper");
c.nextChat = 106;
break;
case 106:
c.getPA().startTeleport(3222, 3219, 0, "modern");
c.sendMessage("Grim teleports you back to home");
break;
case 107:
sendNpcChat1("By the way, its dangerous in there. Still want to go?", c.talkingNpc, "Grim Reaper");
c.nextChat = 108;
break;
case 108:
sendOption2("Yes.", "No.");
c.dialogueAction = 667;
break;

This pretty much controls all rewards, grim actions, etc

Step 4 - Making objects/npcs complete actions
Go into your actionHandler, search for this
    public void firstClickObject(int objectType, int obX, int obY) {

Add this under it
    case 27254:
if(c.grimPrize < 2) {
c.getPA().startTeleport(2868, 3546, 0, "modern");
} else {
c.sendMessage("You have already completed the halloween event!");
}
break;
case 13405:
if(c.grimPrize == 1) {
c.getDH().sendDialogues(107, 6390);
} else if (c.grimPrize == 0) {
c.sendMessage("Grim stares at you from across the room.");
} else if (c.grimPrize == 3) {
c.sendMessage("You have already completed the halloween event!");
}
break;

Then search for this
    public void firstClickNpc(int npcType) {

Add this under there
    case 6390:
if(c.grimPrize == 0) {
c.getDH().sendDialogues(90, npcType);
} else if (c.grimPrize == 1) {
c.getDH().sendDialogues(99, npcType);
} else if (c.grimPrize >= 2) {
c.getDH().sendDialogues(101, npcType);
}
break;


Now go into your dialoguehandler and search for
    private void sendNpcChat1(String s, int ChatNpc, String name) {

change it to
    public void sendNpcChat1(String s, int ChatNpc, String name) {


Step 5 - Setting up the penance queen
Go into your combatAssistant, search for this
    public int getBonusAttack(int i) {

Add this under that
    case 5247:
return Misc.random(50) + 30;

Search for this in npcHandler
    public boolean switchesAttackers(int i) {

Add this under that
    case 5247:

Search for this in npcHandler
    public boolean isAggressive(int i) {

Add this under that
    case 5247:

Search for this in npcHandler
    public static int getAttackEmote(int i) {

Add this under that
    			case 5247:
return 5411;

Search for this
    public int getDeadEmote(int i) {

Add this under that
    case 5247:
Client c = (Client)Server.playerHandler.players[npcs[i].killedBy];
c.getPA().startTeleport(2868, 3546, 0, "modern");
c.sendMessage("Congratulations, you have defeated the penance queen!");
c.grimPrize = 2;
c.getDH().sendNpcChat1("Talk to me again.", 6390, "Grim Reaper");
c.nextChat = 0;
return 5412;

That teleports them etc when the penance queen dies
Search for this
    public int getHitDelay(int i) {

Add this under it
    case 5247:
return 3;

Search for this
    public int distanceRequired(int i) {

Add this under that
    case 5247:
return 8;

Search for this
    public int followDistance(int i) {

Add this under that
    case 5247:
return 8;

Search for this
    if (special)
loadSpell2(i);
else
loadSpell(i);

Add this under it
    if(npcs[i].npcType == 5247) {
c.getPA().appendPoison(12);
}

Now finally go into npc.cfg and add this
    npc = 5247	Penance	209	250


Step 6 - Saving The Event
Head into the player class, add this in there
    public int grimPrize = 0;

Then go into the playerSave class and add this
     else if (token.equals("grimPrize")) {
p.grimPrize = Integer.parseInt(token2);
}

And this
    			characterfile.write("grimPrize = ", 0, 12);
characterfile.write(Integer.toString(p.grimPrize), 0, Integer.toString(p.grimPrize).length());
characterfile.newLine();

With the rest of them

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo