Jump to content

Recommended Posts

Posted

========================Updated=======================================

 

after a replay on l2j form i have realized how newbie i am in programing and changed the script a little:)

 

and if you want to give 200 mana in siege zone or other things change :

 

if (item.getItemId()==728 && item.getCount()>0&& playable.getPvpFlag() == 0)

to:

if (item.getItemId()==728 && item.getCount()>0&& playable.getPvpFlag() == 0&&!playable.isInSiege())

 

you can add whatever you want..

========================How to add it===================================

this works on latest freya revision ...on older packs the manapotion handler is in core and not handled individualy ...you may need to search it

 

if you want to add this custom for mana potion you need to do this:

1) go to your mana potion at skills 10001

2) the "power" will be the ammount of mana given when is flaged

3) go to \data\scripts\handlers\itemhandlers\manapotion.java and replace it with the code below

4) go at line "playable.setCurrentMp(playable.getCurrentMp()+800);" and change it to the bonus for non flaged

 

ex.)i wanted to give 200 mana for flaged players and 1000 for non flaged and i have changed the power of 10001 to 200 and put 800 for bonus

notice: non flaged players will get the the mana from normal mana potion + the number you set !

 

 

========================original post=================================

2 day ago i wanted to make mana potion to give less mana if you are flaged and more if you are not ... and with the last freya revision a lot of things changed , so i can't find anything allready done ... and once again i;ve put my ass to work and after some try's i came up with this:

 

1)go to your 10001 skill and put power=200

 

 

2) go to \data\scripts\handlers\itemhandlers\manapotion.java and replace the code with this

/*

* This program is free software: you can redistribute it and/or modify it under

* the terms of the GNU General Public License as published by the Free Software

* Foundation, either version 3 of the License, or (at your option) any later

* version.

* 

* This program is distributed in the hope that it will be useful, but WITHOUT

* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS

* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more

* details.

* 

* You should have received a copy of the GNU General Public License along with

* this program. If not, see <http://www.gnu.org/licenses/>.

*/

package handlers.itemhandlers;



import com.l2jserver.Config;
import com.l2jserver.gameserver.model.entity.TvTEvent;

import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;

import com.l2jserver.gameserver.model.L2ItemInstance;

import com.l2jserver.gameserver.model.actor.L2Playable;

import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;

import com.l2jserver.gameserver.network.SystemMessageId;

import com.l2jserver.gameserver.network.serverpackets.SystemMessage;



public class ManaPotion extends ItemSkills

{

/**

 * 

 * @see com.l2jserver.gameserver.handler.IItemHandler#useItem(com.l2jserver.gameserver.model.actor.L2Playable, com.l2jserver.gameserver.model.L2ItemInstance, boolean)

 */

@Override

public void useItem(L2Playable playable, L2ItemInstance item, boolean forceUse)

{

	L2PcInstance activeChar=(L2PcInstance) playable;

	boolean isPet = playable instanceof L2PetInstance;

	if (isPet)

		activeChar = ((L2PetInstance) playable).getOwner();

	else if (playable instanceof L2PcInstance)

		activeChar = (L2PcInstance) playable;

	else

		return;

	if (!Config.L2JMOD_ENABLE_MANA_POTIONS_SUPPORT)

	{

		playable.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOTHING_HAPPENED));

		return;

	}

	if(activeChar.isInOlympiadMode()||!TvTEvent.onScrollUse(playable.getObjectId()))

	{return;}
               super.useItem(playable, item, forceUse);

	if (item.getItemId()==728 && item.getCount()>0&& playable.getPvpFlag() == 0)

	{
		double aux  = playable.getCurrentMp();

		playable.setCurrentMp(playable.getCurrentMp()+800);

		playable.sendMessage((playable.getCurrentMp()-aux)+"Mana Bonus restored[Not Flaged]");			

	}



}

}

 

 

In this way if a player is flaged he takes 200 if he is not he takes 1000...

 

 

 

I hope this helps you:)

 

 

edited: Updated   the 1st version gived mana in oly and tvt...:D

 

Posted

Nice one. Thanks. But why don't you add configs(when they use it unflagged), how much more mp to add?

 

Like:

			playable.setCurrentMp(playable.getCurrentMp() + Config.MORE_MP_WHEN_UNFLAGGED);

I believe you can add the config.

 

Once again, thanks.

Posted

he says he did it. we can't be 100% sure, but...

 

its 100% by me

 

Nice one. Thanks. But why don't you add configs(when they use it unflagged), how much more mp to add?

 

Like:

			playable.setCurrentMp(playable.getCurrentMp() + Config.MORE_MP_WHEN_UNFLAGGED);

I believe you can add the config.

 

Once again, thanks.

 

if you want to do this you need to open core... and this is not done in core... i think is better this way... i think

 

 

but still this can be done better ... by modify the manapotion skill to have 2 lvl and when you are flaged to get lvl one and when you are not to get lvl 2... but i didn't manage to do it:):D

 

 

 

 

 

Posted

And if you want enable mana when you are casting just delete this:

\data\scripts\handlers\itemhandlers\itemskilltemplate.java

 

if (!itemSkill.isPotion() && playable.isCastingNow())
				{
					return;
				}

 

I hope this helps you:)

 

 

10001 skill has "isPotion" val="true" (obvisouly, it means its a potion skill)

The condition you are telling us to erase is exactly the restriction for all items except potions,

so i recommend you to test your "suggestions" before advice other ppl about wrong statements

Posted

10001 skill has "isPotion" val="true" (obvisouly, it means its a potion skill)

The condition you are telling us to erase is exactly the restriction for all items except potions,

so i recommend you to test your "suggestions" before advice other ppl about wrong statements

 

sorry...

Posted

i just noticed that, when player isn't flagged, it won't increase him 1k mp, but 800 because you say:

		playable.setCurrentMp(playable.getCurrentMp()+800);

This means that if player isn't flagged, get his current mp and restore it by 800.

 

IF i am not mistaken...

Posted
i just noticed that, when player isn't flagged, it won't increase him 1k mp, but 800 because you say:

Code:

playable.setCurrentMp(playable.getCurrentMp()+800);

This means that if player isn't flagged, get his current mp and restore it by 800.

 

IF i am not mistaken...

 

no man look at this part only:

 

 

if (playable.getPvpFlag() > 0)   //if the player is flaged

 

{

 

super.useItem(playable, item, forceUse);//just use the normal mana potion from skill 10001

 

}

 

else//else if is not flaged

 

{super.useItem(playable, item, forceUse); //use the mana potion

 

playable.setCurrentMp(playable.getCurrentMp()+800);// and add aditional 800 mana bonus

}

i think this will clear your mind

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...