Author Topic: "dot" operator  (Read 834 times)

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
"dot" operator
« on: January 12, 2011, 03:29:26 am »


               I know we can use it to pick info out of vectors and structs in nwn. I was wondering if there are any other datatypes that we can use this for in nwn and if anyone knows if there is a way to use it for the "ENGINE STRUCTURES":

location
itemproperty
effect
event
talent

to pick specific info out of them.

Thanks in andvance for any info. Sorry if it is a dumb question. My knowledge of scripting is still limited to nwnscript. I just barely got the c++ ball rolling.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
"dot" operator
« Reply #1 on: January 12, 2011, 03:45:24 am »


               It is not a dumb question that is for sure.  unfortunatly, I do not know if any of the other structures are made public to nwscript the way the vector is.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
"dot" operator
« Reply #2 on: January 12, 2011, 07:22:28 am »


               Locations are only accessible via vector, facing, and area breakdown (ie, GetPositionFromLocaiton). Itemprops and effects are accessible via nwnx_structs (include below). Events are accessible via nwnx_events. No one has hacked into talents much, afaik.


const int EFFECT_TRUETYPE_APPEAR                                =  81;
const int EFFECT_TRUETYPE_NEGATIVE_LEVEL                        =  82;
const int EFFECT_TRUETYPE_BONUS_FEAT                            =  83;
const int EFFECT_TRUETYPE_WOUNDING                              =  84;
const int EFFECT_TRUETYPE_SWARM                                 =  85;
const int EFFECT_TRUETYPE_VAMPIRIC_REGENERATION                 =  86;
const int EFFECT_TRUETYPE_DISARM                                =  87;
const int EFFECT_TRUETYPE_TURN_RESISTANCE_DECREASE              =  88;
const int EFFECT_TRUETYPE_BLINDNESS_INACTIVE                    =  89;
const int EFFECT_TRUETYPE_PETRIFY                               =  90;
const int EFFECT_TRUETYPE_ITEMPROPERTY                          =  91;
const int EFFECT_TRUETYPE_SPELL_FAILURE                         =  92;
const int EFFECT_TRUETYPE_CUTSCENEGHOST                         =  93;
const int EFFECT_TRUETYPE_CUTSCENEIMMOBILE                      =  94;
const int EFFECT_TRUETYPE_DEFENSIVESTANCE                       =  95;


/* Returns the duration specified at ApplyEffectToObject() time for
 * the effect. The value of this is undefined for effects which are
 * not of DURATION_TYPE_TEMPORARY. */
float GetEffectDuration (effect eEffect);

/* Returns the remaining duration of the specified effect. The value
 * of this is undefined for effects which are not of
 * DURATION_TYPE_TEMPORARY. */
float GetEffectDurationRemaining (effect eEffect);

/* Returns the internal effect integer at the index specified. The index
 * is limited to being between 0 and 15, and which index contains what
 * value depends entirely on the type of effect. */
int GetEffectInteger (effect eEffect, int nIndex);

/* Sets the internal effect integer at the specified index to the
 * value specified. */
void SetEffectInteger (effect eEffect, int nIndex, int nValue);

/* Sets the effect's spell id as specified, which will later be returned
 * with GetEffectSpellId(). */
void SetEffectSpellId (effect eEffect, int nSpellId);

/* Returns the duration specified at AddItemProperty() time for
 * the item property. The value of this is undefined for properties
 * which are not of DURATION_TYPE_TEMPORARY. */
float GetItemPropertyDuration (itemproperty ipProp);

/* Returns the remaining duration of the specified item property. The
 * value of this is undefined for effects which are not of
 * DURATION_TYPE_TEMPORARY. */
float GetItemPropertyDurationRemaining (itemproperty ipProp);

/* Returns the internal item property integer at the index specified.
 * The index is limited to being between 0 and 15, and which index
 * contains what * value depends entirely on the type of property. */
int GetItemPropertyInteger (itemproperty ipProp, int nIndex);

/* Sets the internal item property integer at the specified index to the
 * value specified. */
void SetItemPropertyInteger (itemproperty ipProp, int nIndex, int nValue);

/* Returns the spell id that created the item property. */
int GetItemPropertySpellId (itemproperty ipProp);

/* Sets the item property's spell id as specified, which will later be
 * returned with GetItemPropertySpellId(). */
void SetItemPropertySpellId (itemproperty ipProp, int nSpellId);


float GetEffectDuration (effect eEffect) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATION", "          ");
    return StringToFloat(GetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATION"));
}

float GetEffectDurationRemaining (effect eEffect) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATIONREMAINING", "          ");
    return StringToFloat(GetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATIONREMAINING"));
}

int GetEffectInteger (effect eEffect, int nIndex) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETINTEGER", IntToString(nIndex) + "          ");
    return StringToInt(GetLocalString(GetModule(), "NWNX!STRUCTS!GETINTEGER"));
}

void SetEffectInteger (effect eEffect, int nIndex, int nValue) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETINTEGER", IntToString(nIndex) + " " + IntToString(nValue));
}

void SetEffectSpellId (effect eEffect, int nSpellId) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETSPELLID", IntToString(nSpellId));
}

int GetEffectTrueType (effect eEffect) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETTRUETYPE", "          ");
    return StringToInt(GetLocalString(GetModule(), "NWNX!STRUCTS!GETTRUETYPE"));
}

void SetEffectTrueType (effect eEffect, int nTrueType) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETTRUETYPE", IntToString(nTrueType));
}

void SetEffectCreator (effect eEffect, object oCreator) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETCREATOR", ObjectToString(oCreator));
}


int GetHasMatchingEffect (object oObject, object oCreator, int nSpellId, int nTrueType, int nInt0) {
    SetLocalString(oObject, "NWNX!STRUCTS!GETHASEFFECT", ObjectToString(oCreator) + " " +
        IntToString(nSpellId) + " " + IntToString(nTrueType) + " " + IntToString(nInt0));
    return StringToInt(GetLocalString(oObject, "NWNX!STRUCTS!GETHASEFFECT"));
}

int GetHasEffectByCreator (object oCreator, object oObject=OBJECT_SELF, int nSpellId=-1) {
    return GetHasMatchingEffect(oObject, oCreator, nSpellId, -1, 0);
}

int GetHasEffectOfTrueType (int nTrueType, object oObject=OBJECT_SELF, int nSpellId=-1) {
    return GetHasMatchingEffect(oObject, OBJECT_INVALID, nSpellId, nTrueType, 0);
}

int GetHasEffectState (int nState, object oObject=OBJECT_SELF, object oCreator=OBJECT_INVALID, int nSpellId=-1) {
    return GetHasMatchingEffect(oObject, oCreator, nSpellId, EFFECT_TRUETYPE_SETSTATE, nState);
}


object GetItemPropertyCreator (itemproperty ipProp) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETCREATORREQUEST", " ");
    return GetLocalObject(GetModule(), "NWNX!STRUCTS!GETCREATOR");
}

float GetItemPropertyDuration (itemproperty ipProp) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATION", "          ");
    return StringToFloat(GetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATION"));
}

float GetItemPropertyDurationRemaining (itemproperty ipProp) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATIONREMAINING", "          ");
    return StringToFloat(GetLocalString(GetModule(), "NWNX!STRUCTS!GETDURATIONREMAINING"));
}

int GetItemPropertyInteger (itemproperty ipProp, int nIndex) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETINTEGER", IntToString(nIndex) + "          ");
    return StringToInt(GetLocalString(GetModule(), "NWNX!STRUCTS!GETINTEGER"));
}

void SetItemPropertyInteger (itemproperty ipProp, int nIndex, int nValue) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETINTEGER", IntToString(nIndex) + " " + IntToString(nValue));
}

int GetItemPropertySpellId (itemproperty ipProp) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!GETSPELLID", "          ");
    return StringToInt(GetLocalString(GetModule(), "NWNX!STRUCTS!GETSPELLID"));
}

void SetItemPropertySpellId (itemproperty ipProp, int nSpellId) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETSPELLID", IntToString(nSpellId));
}

void SetItemPropertyCreator (itemproperty ipProp, object oCreator) {
    SetLocalString(GetModule(), "NWNX!STRUCTS!SETCREATOR", ObjectToString(oCreator));
}


effect EffectBonusFeat (int nFeat) {
    effect eEff = EffectVisualEffect(nFeat);

    SetEffectTrueType(eEff, EFFECT_TRUETYPE_BONUS_FEAT);
    return eEff;
}

effect EffectIcon (int nIcon) {
    effect eEff = EffectVisualEffect(nIcon);

    SetEffectTrueType(eEff, EFFECT_TRUETYPE_ICON);
    return eEff;
}

effect EffectDisarm (int nDisarm) {
    effect eEff = EffectVisualEffect(nDisarm);

    SetEffectTrueType(eEff, EFFECT_TRUETYPE_DISARM);
    return eEff;
}

effect EffectDamageResistanceDecrease (int nDamType, int nAmount) {
    effect eEff = EffectSpellImmunity(765);

    SetEffectInteger(eEff, 1, nDamType);
    SetEffectInteger(eEff, 2, nAmount);
    return eEff;
}

effect EffectDamageResistanceIncrease (int nDamType, int nAmount) {
    effect eEff = EffectSpellImmunity(766);

    SetEffectInteger(eEff, 1, nDamType);
    SetEffectInteger(eEff, 2, nAmount);
    return eEff;
}

Funky
               
               

               


                     Modifié par FunkySwerve, 12 janvier 2011 - 07:23 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
"dot" operator
« Reply #3 on: January 12, 2011, 07:24:42 am »


               Top of include was truncated - sorry, forum limit. Functions are still there, though.



Funky