Jump to content

[Elvarg/OSRS Pk] Fixed regular magic projectiles aswell as trident base.

Featured Replies

Posted
comment_13273

Noticed that when I redid projectiles on Elvarg, the magic ones were messed up. 

To fix it, simply replace CombatSpells.java with mine.
It's quite a big class so I'll use pastebin. Click here to get it.

Now, some people wanted help with adding tridents so I'll give you a proper base below.

Let's make it so when we equip a trident, it will update our autocast spell.
To do this, open EquipPacketListener.java and find "void resetWeapon(Player player)"
At the bottom of this method, you should find:

if(player.getCombat().getAutocastSpell() != null) {
	Autocasting.setAutocast(player, null);
	player.getPacketSender().sendMessage("Autocast spell cleared.");
}

If you examine the current code, you will see that it's currently reseting autocast everytime when switching weapon.
Replace it with this:

Item weapon = player.getEquipment().getItems()[Equipment.WEAPON_SLOT];

//Check if player is using a trident. If so, set autocast to respective spell..
if(weapon.getId() == 11905) {
	Autocasting.setAutocast(player, CombatSpells.TRIDENT_OF_THE_SEAS.getSpell());
} else if(weapon.getId() == 12899) {
	Autocasting.setAutocast(player, CombatSpells.TRIDENT_OF_THE_SWAMP.getSpell());
} else {
	//Otherwise always reset autocast when switching weapon
	if(player.getCombat().getAutocastSpell() != null) {
		Autocasting.setAutocast(player, null);
		player.getPacketSender().sendMessage("Autocast spell cleared.");
	}
}

Now, we're updating autocast if switching to a trident, and reseting autocast if not.

Finally we need to make it so players can't choose a different autocast spell when using a trident, just like osrs.
Simply open Autocasting.java, and find this code:

		if(cbSpell.levelRequired() > player.getSkillManager().getCurrentLevel(Skill.MAGIC)) {
			player.getPacketSender().sendMessage("You need a Magic level of at least "+cbSpell.levelRequired()+" to cast this spell.");
			setAutocast(player, null);
			return true;
		}

Under it, add:

		Item weapon = player.getEquipment().getItems()[Equipment.WEAPON_SLOT];

		//Check if player is using a trident. If so, do not allow player to change autocast spell.
		if(weapon.getId() == 11905 || weapon.getId() == 12899) {
			player.getPacketSender().sendMessage("You cannot change your autocast spell since you're wearing a trident.");
			return false;
		}

And you're done! 

Magic projectiles:

3d737613162af493fc111cc19e15e341.gif

Tridents:
(Fix the projectile for these two yourself by playing around with the start/end heights etc. For some reason same values as other projectiles didn't work.)

b5ad94d48a5f5f419ebff0e1876b4601.gif

41dee72673f9d860bf277c0364c3afb2.gif

  • 2 years later...
  • 1 year later...

Create an account or sign in to comment