• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

doCreatureSetShield(cid, shield)

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,890
Reaction score
466
Location
Texas
As title explains, anyway to make this?

Like, in party shield comes up, wondering since npcs can have shields without being in party, if a lua function is possible, should work just like skull function
 
Try this one:
Code:
int32_t LuaScriptInterface::luaDoCreatureSetShieldType(lua_State* L)
{
	//doCreatureSetShieldType(cid, shield)
	PartyShields_t shield = (PartyShields_t)popNumber(L);

	ScriptEnviroment* env = getScriptEnv();
	if(Creature* creature = env->getCreatureByUID(popNumber(L)))
	{
		creature->setShield(shield);
		lua_pushboolean(L, LUA_NO_ERROR);
	}
	else
	{
		reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND));
		lua_pushboolean(L, LUA_ERROR);
	}
	return 1;
}

Also add to your constant.lua:
Code:
	SHIELD_NONE = 0,
	SHIELD_WHITEYELLOW = 1,
	SHIELD_WHITEBLUE = 2,
	SHIELD_BLUE = 3,
	SHIELD_YELLOW = 4,
	SHIELD_BLUE_SHAREDEXP = 5,
	SHIELD_YELLOW_SHAREDEXP = 6,
	SHIELD_BLUE_NOSHAREDEXP_BLINK = 7,
	SHIELD_YELLOW_NOSHAREDEXP_BLINK = 8,
	SHIELD_BLUE_NOSHAREDEXP = 9,
	SHIELD_YELLOW_NOSHAREDEXP = 10

So you can use it like this: doCreatureSetShieldType(cid, SHIELD_WHITEYELLOW).
Also add the function to luascript.h:
Code:
static int32_t luaDoCreatureSetShieldType(lua_State* L);
 
no, its not possible for players because its dynamic generated. party shield can be declared only for monsters/npcs. You can of course modify it, but this way you should also resign from party system.
 
I see... I took the green skull out of the party system already, seeing that I am using the skull system for something else. So maybe I'll just keep shields for party.
 
Back
Top