• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Request: Talkaction Command "/debless"

dozot

New Member
Joined
Dec 7, 2010
Messages
8
Reaction score
0
Alright, I am new to coding and I have been trying to get a talkaction command made or even a Spell that could be used to remove Blessings from a player.
So when I would say either
Talkaction:
!debless [Player Name]
/debless [Player Name]

Spell:
Debless "[Player Name]

It would remove all of their Blessings but I can't seem to get it to work.
I can get the spell to show up on my server in the orange text but it doesn't remove their Blessings, it just does like a Magic Effect but does nothing to them.

If anyone has some extra time I would greatly Appreciate some help with this.

Thanks.
 
I tired but i doubt this is going to work.

LUA:
	<instant name="xxxx" words="xxx" lvl="18" mana="x" prem="1" aggressive="0" needtarget="1" params="1" exhaustion="2000" needlearn="0" event="script" value="xxxx.lua">
		<vocation id="x"/>
		<vocation id="x"/>
	</instant>

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)

function doPlayerRemoveBlessing(cid, blessing)
	return doPlayerAddBlessing(cid, -blessing)
end


function onCastSpell(cid, var)
	for i = 1, 5 do
		if getPlayerBlessing(param, i) == false then
			doPlayerSendCancel(cid, "Your target player is currently offline or does not have any blessings.")
				doSendMagicEffect(cid, CONST_ME_POFF)
		else
			doPlayerRemoveBlessing(param, i)
	
		end
	return doCombat(cid, combat, var)
end
end
 
I'm headin to bed now, I'll try it in the morning.
Greatly appreciate your help.
I'll let you know tomorrow if it worked, but I know it's a odd command/spell request and I honestly had searched A LOT to find it but I swear it's no where. Lol.
 
Alright, so even though the player is standing beside me (and as blessings) as the player is me it says the ""Your target player is currently offline or does not have any blessings.".
 
Sorry Cykotitan, I don't understand the first part of what you're saying, the "add a removeBlessing function to player.h " part.
 
Code:
		void addBlessing(int16_t blessing) {blessings += blessing;}
		void removeBlessing(int16_t blessing) {blessings -= blessing;}
Code:
int32_t LuaInterface::luaDoPlayerRemoveBlessing(lua_State* L)
{
	//doPlayerRemoveBlessing(cid, blessing)
	int16_t blessing = popNumber(L) - 1;
	ScriptEnviroment* env = getEnv();
	if(Player* player = env->getPlayerByUID(popNumber(L)))
	{
		if(player->hasBlessing(blessing))
		{
			player->removeBlessing(1 << blessing);
			lua_pushboolean(L, true);
		}
		else
			lua_pushboolean(L, false);
	}
	else
	{
		errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
	}

	return 1;
}
 
Cykotitan,
I'm really sorry but are you wanting me to add that to the lua or is that the entire lua?
>_<
And if I'm just adding it what do I take out to put this in and where in the lua do I place it?
(Sorry for making you repeat yourself. :[ )
 
Alright, I appologize, but I still don't understand, can you give me a step by step?
I know to put it in spells and I know how to redirect it to the lua and I know where to put the lua.
I just need you to tell me what to do with the.......

Code:
		void addBlessing(int16_t blessing) {blessings += blessing;}
		void removeBlessing(int16_t blessing) {blessings -= blessing;}
Code:
int32_t LuaInterface::luaDoPlayerRemoveBlessing(lua_State* L)
{
	//doPlayerRemoveBlessing(cid, blessing)
	int16_t blessing = popNumber(L) - 1;
	ScriptEnviroment* env = getEnv();
	if(Player* player = env->getPlayerByUID(popNumber(L)))
	{
		if(player->hasBlessing(blessing))
		{
			player->removeBlessing(1 << blessing);
			lua_pushboolean(L, true);
		}
		else
			lua_pushboolean(L, false);
	}
	else
	{
		errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
		lua_pushboolean(L, false);
	}

	return 1;
}
 
First: search "Compiling Tutorial"
Second: edit in your source folder the next files "luascript.cpp" and luascript.h"
And the final: add the lines what Cykotitan was posted and compile all.
 
Back
Top