For refference here is my script for activating vfx. It would really help clean scripting if visualeffect.2da entries followed a racial/sex format in the 2daexcerpt below. Its pretty jumbled formatting but you can see the pattern of the racial/sex using theint constants that Bioware has provided.
#include "awa_inc_vfx"
#include "x2_inc_switches"
#include "awa_inc_debug"
void main()
{
int nEvent =GetUserDefinedItemEventNumber();
if (!nEvent == X2_ITEM_EVENT_ACTIVATE)
return;
object oTarget = GetItemActivator();
object oItem = GetItemActivated();
location lLocation = GetLocation(oTarget);
AWA_DEBUG("tag_vfx: oTarget = "+GetName(oTarget)+" oItem = "+GetName(oItem));
//stop module from firing on enter of PC
if (!GetIsObjectValid( GetAreaFromLocation( lLocation )))
{
return;
}
int effectNum = GetLocalInt(oItem, "vfx");
//AWA_DEBUG("tag_vfx: effectNum = "+IntToString(effectNum));//6145
string sTag = "vfx_"+IntToString(effectNum);
object oSource = GetObjectByTag(sTag);
int nVFX = effectNum;
if (GetLocalInt(oItem, "racial"))
{
int nRace = GetRacialType(oTarget);
nRace = nRace * 2;
nVFX = effectNum + nRace + GetGender(oTarget);
//AWA_DEBUG("tag_vfx: nVFX = "+IntToString(nVFX));
}
//AWA_DEBUG("tag_vfx: effectNum = "+IntToString(effectNum)+" sTag = "+sTag+" oSource = "+GetName(oSource));
effect eVFX = GetFirstEffect(oTarget);
int nEfxRemoved = FALSE;
while (GetIsEffectValid(eVFX))
{
if (GetEffectType(eVFX)==EFFECT_TYPE_VISUALEFFECT &&
GetEffectSubType(eVFX)==SUBTYPE_SUPERNATURAL &&
GetEffectDurationType(eVFX)==DURATION_TYPE_PERMANENT &&
GetEffectCreator(eVFX) == oSource)
{
// AWA_DEBUG("tag_vfx: right effect found");
SendMessageToPC(oTarget,"Removing VFX");
RemoveEffect(oTarget, eVFX);
nEfxRemoved = TRUE;
return;
}
eVFX = GetNextEffect(oTarget);
}
if (!GetIsEffectValid(eVFX) && nEfxRemoved == FALSE)
{
AWA_DEBUG("tag_vfx: vfx not in use and was not removed");
//AssignCommand(GetObjectByTag(sTag), ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(effectNum), oTarget)));
AssignCommand(oSource, eEffectsApplyedvfx(oTarget, nVFX));
}
}
6147 VFX_QUIVER_BROWN_DWARF_MALE D 0 **** qvr_brn_dm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16144 VFX_QUIVER_BROWN_DWARF_FEMALE D 0 **** qvr_brn_df **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16149 VFX_QUIVER_BROWN_ELF_MALE D 0 **** qvr_brn_em **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16150 VFX_QUIVER_BROWN_ELF_FEMALE D 0 **** qvr_brn_ef **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16151 VFX_QUIVER_BROWN_GNOME_MALE D 0 **** qvr_brn_gm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16152 VFX_QUIVER_BROWN_GNOME_FEMALE D 0 **** qvr_brn_gf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16153 VFX_QUIVER_BROWN_HALFLING_MALE D 0 **** qvr_brn_fm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16154 VFX_QUIVER_BROWN_HALFLING_FEMALE D 0 **** qvr_brn_ff **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16155 VFX_QUIVER_BROWN_HUMAN_MALE D 0 **** qvr_brn_hm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16156 VFX_QUIVER_BROWN_HUMAN_FEMALE D 0 **** qvr_brn_hf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16157 VFX_QUIVER_BROWN_HALFORC_MALE D 0 **** qvr_brn_om **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16158 VFX_QUIVER_BROWN_HALFORC_FEMALE D 0 **** qvr_brn_of **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16159 VFX_QUIVER_BROWN_HUMAN_MALE D 0 **** qvr_brn_hm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16160 VFX_QUIVER_BROWN_HUMAN_FEMALE D 0 **** qvr_brn_hf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16161 VFX_QUIVER_BLACK_DWARF_MALE D 0 **** qvr_blk_dm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16162 VFX_QUIVER_BLACK_DWARF_FEMALE D 0 **** qvr_blk_df **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16163 VFX_QUIVER_BLACK_ELF_MALE D 0 **** qvr_blk_em **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16164 VFX_QUIVER_BLACK_ELF_FEMALE D 0 **** qvr_blk_ef **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16165 VFX_QUIVER_BLACK_GNOME_MALE D 0 **** qvr_blk_gm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16166 VFX_QUIVER_BLACK_GNOME_FEMALE D 0 **** qvr_blk_gf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16167 VFX_QUIVER_BLACK_HALFLING_MALE D 0 **** qvr_blk_fm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16168 VFX_QUIVER_BLACK_HALFLING_FEMALE D 0 **** qvr_blk_ff **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16169 VFX_QUIVER_BLACK_HUMAN_MALE D 0 **** qvr_blk_hm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16170 VFX_QUIVER_BLACK_HUMAN_FEMALE D 0 **** qvr_blk_hf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16171 VFX_QUIVER_BLACK_HALFORC_MALE D 0 **** qvr_blk_om **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16172 VFX_QUIVER_BLACK_HALFORC_FEMALE D 0 **** qvr_blk_of **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16173 VFX_QUIVER_BLACK_HUMAN_MALE D 0 **** qvr_blk_hm **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 16174 VFX_QUIVER_BLACK_HUMAN_FEMALE D 0 **** qvr_blk_hf **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 1
Modifié par DM_Vecna, 31 décembre 2013 - 08:44 .