• 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!

Lua Function doChallengePlayer(cid, target) - Exeta Res other players!

I

Icy

Guest
player.cpp:
Code:
bool Player::challengePlayer(Player* player)
{
	sendCancel("You have been taunted!");
	setAttackedCreature(player);
	sendCreatureSquare(player, 112);
	sendMagicEffect(getPosition(), 13);
	sendMagicEffect(player->getPosition(), 14);
	
	return true;
}

player.h: (public)
Code:
		virtual bool challengePlayer(Player* player);

luascript.cpp:
Code:
	//doChallengePlayer(cid, target)
	lua_register(m_luaState, "doChallengePlayer", LuaInterface::luaDoChallengePlayer);

luascript.h: (protected)
Code:
		static int32_t luaDoChallengePlayer(lua_State* L);

Have fun.
 
Thanks, took forever as I was trying to find out how to set the "Red Box" and it turned out that it was client-sided... lol
 
Thanks for this Icy, I will definitively be using this in the next up coming weeks

Too bad I didn't think of this when I made a taunt spell months back (just forces the player to follow another player till they hit escape)
 
Thanks for this Icy, I will definitively be using this in the next up coming weeks

Too bad I didn't think of this when I made a taunt spell months back (just forces the player to follow another player till they hit escape)

Glad you like it. :)
 
exeta res -> monster
u funct. -> player
?

o.o nice

Something like this:

taunt.lua:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)

function onCastSpell(cid, var)
	if isPlayer(variantToNumber(var)) then
		doChallengePlayer(cid, variantToNumber(var))
	else
		doChallengeCreature(cid, variantToNumber(var))
	end
	return doCombat(cid, combat, var)
end
 
It's like taunt on LoL/WoW ?

Never played wow, but it's kinda like Shen's Taunt or Rammus' Taunt.

It basically makes you attack them and you can keep attacking them if you want, or you can stop. (And you still have control of your character).
 
but what about if you use it to make the other player to get Skull, else if the other player have the no attack player icon?
 
does someone have a tutorial for adding this?D:
i dont know a s** of this :c
 
but what about if you use it to make the other player to get Skull, else if the other player have the no attack player icon?

I can try to implement a callback - didn't think of it at first since it will be an offensive spell and mark yourself if you hit / target an unmarked player with it in the first place.
 
what should i put in luascript.cpp

like:

Code:
int32_t LuaInterface::luaDoChallengeCreature(lua_State* L)
{
	//doChallengeCreature(cid, target)
	ScriptEnviroment* env = getEnv();
	uint32_t targetCid = popNumber(L);

	Creature* creature = env->getCreatureByUID(popNumber(L));
	if(!creature)
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}

	Creature* target = env->getCreatureByUID(targetCid);
	if(!target)
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}

	target->challengeCreature(creature);
	lua_pushboolean(L, true);
	return 1;
}

but for player
 
I just add the code to each one or it need to be in some orders?...
For Ex.
Under

Function: bla bla bla} add: Ur code}
 
I feel kinda dumb, but where do i place these files? I cannot find a .cpp anywhere in my distro :(

im using 0.3.6 tfs


thanks!
 
Back
Top