sample:
have this snippet in OnEnter/OnLevelUp/OnRespawn and OnLevelDown (special scripted event i created via hooking SetXP calls) (actually all these events run this via ExecuteScript):
void main()
{
object oPC = OBJECT_SELF;
/*string sPlayerId = GetPlayerId(oPC); <- this doesnt interest you
object oSkin = GetPCSkin(oPC);
itemproperty ip = GetFirstItemProperty(oSkin);
while(GetIsItemPropertyValid(ip))
{
RemoveItemProperty(oSkin,ip);
ip = GetNextItemProperty(oSkin);
}*/
//this will remove all effects first
effect e = GetFirstEffect(oPC);
string sTag;
while(GetIsEffectValid(e))
{
sTag = GetTag(GetEffectCreator(e)) ;
if(sTag == "EC_UNARMED_MEPH" || sTag == "EC_AB" || sTag == "EC_NINJA")
{
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
//now re-apply them
if(GetHasFeat(FEAT_NINJA_GHOST_SIGHT,oPC))
{
AssignCommand(GetObjectByTag("EC_NINJA"), ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectSeeInvisible()), oPC));
}
...and so on
}
or this, this is special event-based scripting, its for the Ring of lesser regeneration, the actual regen is +1/3rounds its for lvl 1-4 characters.
#include "_sh_inc_newfce"
void main()
{
object oPC, oItem;
int nEvent = GetRunningEvent();
if(nEvent == EVENT_MODULE_ON_PLAYER_EQUIP_ITEM)
{
oPC = GetPCItemLastEquippedBy();
AddEventScript(oPC,EVENT_SCRIPTED_ON_PLAYER_RESSURECTED,"sh_uniq_rregen1");
AssignCommand(GetObjectByTag("EC_sh_uniq_rregen1"), CORE_ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectRegenerate(1, 18.0)), oPC));
}
else if(nEvent == EVENT_MODULE_ON_PLAYER_UNEQUIP_ITEM_STARTED)
{
oPC = GetPCItemLastUnequippedBy();
RemoveEventScript(oPC,EVENT_SCRIPTED_ON_PLAYER_RESSURECTED,"sh_uniq_rregen1");
effect e = GetFirstEffect(oPC);
while(GetIsEffectValid(e))
{
if(GetTag(GetEffectCreator(e)) == "EC_sh_uniq_rregen1")
{
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
}
else if(nEvent == EVENT_SCRIPTED_ON_PLAYER_RESSURECTED)
{
object oPC = OBJECT_SELF;
if(GetModule() == oPC)
{
oPC = GetLastRespawnButtonPresser();
}
if(GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTRING,oPC)) == "sh_uniq_rregen1" ||
GetTag(GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oPC)) == "sh_uniq_rregen1"
)
{
AssignCommand(GetObjectByTag("EC_sh_uniq_rregen1"), CORE_ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectRegenerate(1, 18.0)), oPC));
}
}
}
Modifié par ShaDoOoW, 14 juin 2011 - 09:23 .