Ir para conteúdo

Spells Functions


honux

Posts Recomendados

Como do mesmo modo resolvi postar algumas funções para NPC's resolvi postar Spells q eu julgo necessário ( porém algumas inúteis ).

Todas as funções são baseadas no CVS de 10/03/06

luaSetPlayerLight

Muda o Light level do Player ( Falta o Decay )

 

int SpellScript::luaSetPlayerLight(lua_State *L){	unsigned char lvl = (unsigned char)lua_tonumber(L, -1);	lua_pop(L,1);	Spell* spell = getSpell(L);	Creature* creature = spell->game->getCreatureByID((unsigned long)lua_tonumber(L, -1));	lua_pop(L,1);	Player* player = dynamic_cast<Player*>(creature);	if(player){  		MagicEffectTargetClass magicTarget;		magicTarget.offensive = false;		magicTarget.drawblood = false;		magicTarget.animationEffect = 0;		magicTarget.attackType = ATTACK_NONE;  		magicTarget.hitEffect = 255; //NM_ME_NONE		magicTarget.animationColor = 19; //GREEN		if(player->getMana() < spell->getMana()){  			magicTarget.damageEffect = 2; //NM_ME_PUFF      		magicTarget.manaCost = player->getPlayerInfo(PLAYERINFO_MAXMANA) + 1; //force not enough mana  		}  		else{    			magicTarget.manaCost = spell->getMana();  			magicTarget.damageEffect = 12; //NM_ME_MAGIC_ENERGIE = 12    			}		bool isSuccess = spell->game->creatureThrowRune(player, player->getPosition(), magicTarget);		if(isSuccess) {		LightInfo lightInfo;		lightInfo.level = lvl;		lightInfo.color = 215;		player->setCreatureLight(lightInfo);		spell->game->changeLight(player);		}		lua_pushnumber(L, 1);		return 1;	}	lua_pushnumber(L, 0);	return 1;}

 

Link para o comentário
Compartilhar em outros sites

  • 1 month later...
  • 2 years later...
×
×
  • Criar Novo...