Need help with my script

Post Reply
NekoNinja
Posts: 28
Joined: Thu Jun 01, 2017 10:20 am

Need help with my script

Post by NekoNinja » Wed Mar 18, 2020 8:33 pm

Hello, I have been making some great progress in figuring out how to edit scripts and I was wondering if someone could take a look at my modified allied tags lua. I wanted to create a command that buffs the player when playing solo and it has worked so far however I have run into an issue. I added all of the buffs into allied tags status effect so I don't have 30 status icons at the top of the screen when I use my solo command but I don't know how to make it delete all of the effects when the Allied Tags status is removed which in turn allows the player to keep using the command and stacking all of the buffs... that is part 1

part 2 is something I would like to add to the script as well but not sure if it is possible and that is only allow the command to be used when solo and block someone from using it if they are in a party. I am going to paste my command and the allied status effect lua below. I am still learning how to understand the language any help is appreciated.

This is the command:

Code: Select all

cmdprops =
{
    permission = 0,
    parameters = "i"
};

function onTrigger(player)
		player:addStatusEffect(dsp.effect.ALLIED_TAGS,0,0,0);		
	end
This is my Allied_Tags.lua :

Code: Select all

-----------------------------------
-- Allied Tags
-- Effect: For Solo Play  Buffs The Player
-----------------------------------

function onEffectGain(player,effect)
	local LvL = player:getMainLvl();
	
    if (LvL <= 50) then
		player:addMod(dsp.mod.STR, 25)
		player:addMod(dsp.mod.DEX, 25)
		player:addMod(dsp.mod.VIT, 25)
		player:addMod(dsp.mod.AGI, 25)
		player:addMod(dsp.mod.INT, 25)
		player:addMod(dsp.mod.MND, 25)
		player:addMod(dsp.mod.CHR, 25)
		player:addMod(dsp.mod.STORETP, 75)
		player:addMod(dsp.mod.MATT, 25)
		player:addMod(dsp.mod.MDEF, 25)
		player:addMod(dsp.mod.DEFP, 100)	
		player:addMod(dsp.mod.HPP, 75)
		player:addMod(dsp.mod.MPP, 75)	
		player:addMod(dsp.mod.ACC, 100)
		player:addMod(dsp.mod.RACC, 100)
		player:addMod(dsp.mod.ATTP, 100)
		player:addMod(dsp.mod.RATTP, 100)
		player:addMod(dsp.mod.MACC, 100)
		player:addStatusEffect(dsp.effect.DRAIN_SAMBA,3,0,0);
		player:addStatusEffect(dsp.effect.REFRESH,10,0,0);
		player:addStatusEffect(dsp.effect.REGEN,25,0,0);	
		player:addStatusEffect(dsp.effect.REGAIN,10,0,0);
		player:addStatusEffect(dsp.effect.HASTE,448,0,0);
		player:addStatusEffect(dsp.effect.FAST_CAST,60,0,0);
		player:PrintToPlayer("SOLO MODE ACTIVATED");
	elseif (LvL > 50 and LvL <= 90) then	
		player:addMod(dsp.mod.STR, 50)
		player:addMod(dsp.mod.DEX, 50)
		player:addMod(dsp.mod.VIT, 50)
		player:addMod(dsp.mod.AGI, 50)
		player:addMod(dsp.mod.INT, 50)
		player:addMod(dsp.mod.MND, 50)
		player:addMod(dsp.mod.CHR, 50)
		player:addMod(dsp.mod.STORETP, 75)
		player:addMod(dsp.mod.MATT, 35)
		player:addMod(dsp.mod.MDEF, 50)
		player:addMod(dsp.mod.DEFP, 100)	
		player:addMod(dsp.mod.HPP, 75)
		player:addMod(dsp.mod.MPP, 75)	
		player:addMod(dsp.mod.ACC, 250)
		player:addMod(dsp.mod.RACC, 250)
		player:addMod(dsp.mod.ATTP, 100)
		player:addMod(dsp.mod.RATTP, 100)
		player:addMod(dsp.mod.MACC, 250)
		player:addStatusEffect(dsp.effect.DRAIN_SAMBA,3,0,0);
		player:addStatusEffect(dsp.effect.REFRESH,10,0,0);
		player:addStatusEffect(dsp.effect.REGEN,30,0,0);	
		player:addStatusEffect(dsp.effect.REGAIN,6,0,0);
		player:addStatusEffect(dsp.effect.HASTE,448,0,0);
		player:addStatusEffect(dsp.effect.FAST_CAST,60,0,0);
		player:PrintToPlayer("SOLO MODE ACTIVATED");
	elseif (LvL > 90) then
		player:addMod(dsp.mod.STR, 75)
		player:addMod(dsp.mod.DEX, 75)
		player:addMod(dsp.mod.VIT, 75)
		player:addMod(dsp.mod.AGI, 75)
		player:addMod(dsp.mod.INT, 75)
		player:addMod(dsp.mod.MND, 75)
		player:addMod(dsp.mod.CHR, 75)
		player:addMod(dsp.mod.STORETP, 75)
		player:addMod(dsp.mod.MATT, 50)
		player:addMod(dsp.mod.MDEF, 100)
		player:addMod(dsp.mod.DEFP, 100)	
		player:addMod(dsp.mod.HPP, 75)
		player:addMod(dsp.mod.MPP, 75)	
		player:addMod(dsp.mod.ACC, 500)
		player:addMod(dsp.mod.RACC, 500)
		player:addMod(dsp.mod.ATTP, 100)
		player:addMod(dsp.mod.RATTP, 100)
		player:addMod(dsp.mod.MACC, 500)
		player:addStatusEffect(dsp.effect.DRAIN_SAMBA,3,0,0);
		player:addStatusEffect(dsp.effect.REFRESH,10,0,0);
		player:addStatusEffect(dsp.effect.REGEN,35,0,0);	
		player:addStatusEffect(dsp.effect.REGAIN,6,0,0);
		player:addStatusEffect(dsp.effect.HASTE,448,0,0);
		player:addStatusEffect(dsp.effect.FAST_CAST,60,0,0);
		player:PrintToPlayer("SOLO MODE ACTIVATED");
	end
end;

User avatar
whasf
Site Admin
Posts: 1310
Joined: Thu Jul 19, 2012 9:11 pm

Re: Need help with my script

Post by whasf » Thu Mar 19, 2020 2:42 pm

Part 1 - Do a check at the start of your script to see if they have the Allied Tags effect, if so, use :delMod and :deleteEffect for all the mods and effects, otherwise add the mods and effects.

Part 2 - I think there is a lua method exposed to check if the player is in a party or not, look through lua_baseentity.h
-- Whasf

NekoNinja
Posts: 28
Joined: Thu Jun 01, 2017 10:20 am

Re: Need help with my script

Post by NekoNinja » Thu Mar 19, 2020 4:49 pm

Will do thanks Whasf!

Post Reply