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

[C++] Help with do targetCombatHealth

perdigs

New Member
Joined
Aug 22, 2010
Messages
114
Reaction score
1
Code:
int32_t LuaScriptInterface::luaDoTargetCombatHealth(lua_State* L)
{
	//doTargetCombatHealth(cid, target, type, min, max, effect[, color])
	ScriptEnviroment* env = getEnv();
	int32_t params = lua_gettop(L);

	TextColor_t color = TEXTCOLOR_UNKNOWN;
	if(params > 6)
		color = (TextColor_t)popNumber(L);

	MagicEffect_t effect = (MagicEffect_t)popNumber(L);
	int32_t maxChange = (int32_t)popNumber(L), minChange = (int32_t)popNumber(L);

	CombatType_t combatType = (CombatType_t)popNumber(L);
	uint32_t targetCid = popNumber(L), cid = popNumber(L);

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

	Creature* target = env->getCreatureByUID(targetCid);
	if(target)
	{
		g_game.combatChangeHealth(combatType, creature, target, random_range(minChange, maxChange, DISTRO_NORMAL), effect, color, false);
		lua_pushboolean(L, true);
	}
	else
	{
		errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, false);
	}

	return 1;
}

Cyko has added in this fucntion the hitcolor for me but
i need another change.

My problem i have monster with PHYSICALDAMAGE not effects this monsters
but if i use this function with the PHYSICALDAMAGE the monster suffers the attack
i need a change to if monster element physicalPercent is 20% hits 20% more lower.
If is physicalPercent -20% hits cause 20% more higher.

Please help me...
 
Code:
int32_t LuaScriptInterface::luaDoCombatAreaHealth(lua_State* L)
{
	//doCombatAreaHealth(cid, type, pos, area, min, max, effect)
	MagicEffect_t effect = (MagicEffect_t)popNumber(L);
	int32_t maxChange = (int32_t)popNumber(L), minChange = (int32_t)popNumber(L);
	uint32_t areaId = popNumber(L);

	PositionEx pos;
	popPosition(L, pos);

	CombatType_t combatType = (CombatType_t)popNumber(L);
	uint32_t cid = popNumber(L);

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

	const CombatArea* area = env->getCombatArea(areaId);
	if(area || !areaId)
	{
		CombatParams params;
		params.combatType = combatType;
		params.effects.impact = effect;

		Combat::doCombatHealth(creature, pos, area, minChange, maxChange, params);
		lua_pushboolean(L, true);
	}
	else
	{
		errorEx(getError(LUA_ERROR_AREA_NOT_FOUND));
		lua_pushboolean(L, false);
	}

	return 1;
}

this script is doAreaCombatHealth and this function have a absorb power or power up of attack
if the monster have <element firePercent="50"/> the hit power is 50% lower. example if hit whith COMBAT_FIREDAMAGE causes 50 of damage if the monster have this tag
the hit causes 25 of damage in this creature...

I need to paste this for doTragetCombatHealth...
please Cyko help me...
 
Back
Top