Ir al contenido

Foto

Broken Functions List


  • Por favor identifícate para responder
46 respuestas en este tema

#26
kevL

kevL
  • Members
  • 4.052 mensajes
GetIsFriend/Enemy/Neutral *cough* see above.

(yep, still doing faction tribulations)

#27
kevL

kevL
  • Members
  • 4.052 mensajes
AdjustReputation(x, y, n)

so ... *apparently* ( and i say apparently because so far there's no indication i'm not psychotic )


Apparently, the engine takes how x feels about y then adds n to how y feels about x ...


Note that when dealing with PC-faction these issues do not show up. That's because the engine happily transposes NPC-faction reps to PC-faction reps, so when using faction functions the order of (oPC, oNPC) does not seem to matter,

it ought come into play only when dealing with reputations between nonPC factions.

#28
rjshae

rjshae
  • Members
  • 4.477 mensajes
This isn't so much a problem with a broken function as an issue with the AI; but I might as well record it here for posterity.

In the 'hench_i0_ai' script there's an 'InitializeItemSpells' function that, among other things, determines whether to exclude item "talents". Down about 45 lines from the start of the function, there is an 'if' statement that first checks if the creature is polymorphed, then looks to see if the first item in its inventory is valid. This code looks like the following (without the line wrapping):
  if (bPolymorphed ||
     !GetIsObjectValid(GetFirstItemInInventory()) ||
        !GetCreatureUseItems(OBJECT_SELF))
  {
    	gExcludedItemTalents |= TALENT_EXCLUDE_ITEM;
  }
The issue here is that the 'GetFirstItemInInventory' call only checks the items in the unequipped inventory; it does not check the equipped items. This means if a creature has an equipped item with a usable property (like a staff or wand), it may not get used unless there is also an unequipped item in its inventory.

:?

There are several fixes for this:
  • Always add an item to the inventory of creatures that have items with activated properties.
  • Modify the above code to check for equipped items.
  • In the Campaign spawn script, check whether the spawned creature has an equipped item with an item property. If it does, add a worthless item to the inventory. (For example, the 'broken item'.)
The following subroutine can be used in the 'hench_i0_ai' script to apply the second option:
// Return TRUE if the target has an equipped item or inventory
int HasAnItem( object oTarget = OBJECT_SELF )
{
    if ( GetIsObjectValid( GetFirstItemInInventory( oTarget ) ) )
        return TRUE;
    int nSlot;
    for ( nSlot = INVENTORY_SLOT_HEAD; nSlot < NUM_INVENTORY_SLOTS; nSlot++ ) {
        if ( GetIsObjectValid( GetItemInSlot( nSlot, oTarget ) ) )
            return TRUE;
    }
    return FALSE;
}
It is called with a line like the following:
    if ( bPolymorphed ||
         !HasAnItem() ||
         !GetCreatureUseItems( OBJECT_SELF ) )
  {
    	gExcludedItemTalents |= TALENT_EXCLUDE_ITEM;
  }

Editado por rjshae, 19 julio 2012 - 09:53 .


#29
diophant

diophant
  • Members
  • 116 mensajes
putations seem to be broken (yes, I activated them in the campaign settings). Workaround: Change to STANDARD_FACTION_HOSTILE, or adjust the faction reputation. You might readjust the faction reputation in the onExit script of the area (see http://social.biowar...13272578-1.html).

Set/GetFactionLeader: I couldn't get it to work for NPCs, GetFactionLeader always returned OBJECT_INVALID. Workaround: use a fixed set of faction leaders, and write your own GetFactionLeader function like this:
[nwscript]
object myGetFactionLeader(object oNPC)
{
  object leader;

  leader = GetObjectByTag("Leader_Faction1");
  if (GetFactionEqual(oNPC, leader))
    return leader;
  leader = GetObjectByTag("Leader_Faction2");
  if (GetFactionEqual(oNPC, leader))
    return leader;
   ...
}
[/nwscript]

#30
kamal_

kamal_
  • Members
  • 5.235 mensajes

diophant wrote...

putations seem to be broken (yes, I activated them in the campaign settings). Workaround: Change to STANDARD_FACTION_HOSTILE, or adjust the faction reputation. You might readjust the faction reputation in the onExit script of the area (see http://social.biowar...13272578-1.html).

Set/GetFactionLeader: I couldn't get it to work for NPCs, GetFactionLeader always returned OBJECT_INVALID. Workaround: use a fixed set of faction leaders, and write your own GetFactionLeader function like this:
[nwscript]
object myGetFactionLeader(object oNPC)
{
  object leader;

  leader = GetObjectByTag("Leader_Faction1");
  if (GetFactionEqual(oNPC, leader))
    return leader;
  leader = GetObjectByTag("Leader_Faction2");
  if (GetFactionEqual(oNPC, leader))
    return leader;
   ...
}
[/nwscript]

GetFactionLeader is not initialized. You have to intialize it yourself.
social.bioware.com/%20http:/social.bioware.com/forum/1/topic/164/index/8906305#13260454

SetFactionLeader is supposed to make the npc it runs on the leader.

Editado por kamal_, 29 julio 2012 - 12:11 .


#31
diophant

diophant
  • Members
  • 116 mensajes

kamal_ wrote...

diophant wrote...

putations seem to be broken (yes, I activated them in the campaign settings). Workaround: Change to STANDARD_FACTION_HOSTILE, or adjust the faction reputation. You might readjust the faction reputation in the onExit script of the area (see http://social.biowar...13272578-1.html).

Set/GetFactionLeader: I couldn't get it to work for NPCs, GetFactionLeader always returned OBJECT_INVALID. Workaround: use a fixed set of faction leaders, and write your own GetFactionLeader function like this:
[nwscript]
object myGetFactionLeader(object oNPC)
{
  object leader;

  leader = GetObjectByTag("Leader_Faction1");
  if (GetFactionEqual(oNPC, leader))
    return leader;
  leader = GetObjectByTag("Leader_Faction2");
  if (GetFactionEqual(oNPC, leader))
    return leader;
   ...
}
[/nwscript]

GetFactionLeader is not initialized. You have to intialize it yourself.
social.bioware.com/%20http:/social.bioware.com/forum/1/topic/164/index/8906305#13260454

SetFactionLeader is supposed to make the npc it runs on the leader.


I initialized the faction leader on client enter, but GetFactionLeader still returned OBJECT_INVALID. Has somebody successfully used these functions?

#32
kevL

kevL
  • Members
  • 4.052 mensajes
script 'gc_alignment'

( conversation check for Alignment )


line 55, change nCheck to nAlignCheck

#33
Dann-J

Dann-J
  • Members
  • 3.161 mensajes

rjshae wrote...

The ItemPropertyOnHitCastSpell call can be used to add a spell of type IP_CONST_ONHIT_CASTSPELL_ONHIT_UNIQUEPOWER to a weapon. When this is applied to a throwing weapon, however, an attack hit does not fire the on-hit-cast-spell script named "i_{THROWING ITEM TAG}_hc". This also does not work if you build a throwing weapon item with the property "On Hit Cast Spell: Unique Power (On Hit)".


This must have been fixed in a patch at some point, because it works now. My return-on-hit throwing weapon scripts utilise it.

#34
kevL

kevL
  • Members
  • 4.052 mensajes
// Get oCreature's animal companion creature type
// (ANIMAL_COMPANION_CREATURE_TYPE_*).
// * Returns ANIMAL_COMPANION_CREATURE_TYPE_NONE if oCreature is invalid or does
//   not currently have an animal companion.
int GetAnimalCompanionCreatureType(object oCreature);

couldn't get it to work. It kept returning "-1"

So i'd beware this one too:

int GetFamiliarCreatureType(object oCreature);


#35
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 mensajes
@KevL: Did you pass the animal or the owner as oCreature?

#36
kevL

kevL
  • Members
  • 4.052 mensajes
both ...
tried both, and with the summons up and without ...

If you or someone can get it to work that be cool,

[edit] maybe, hold on .......

Editado por kevL, 07 enero 2013 - 07:22 .


#37
kevL

kevL
  • Members
  • 4.052 mensajes
well, I got it to spit out #255, ANIMAL_COMPANION_CREATURE_TYPE_NONE

when passing in my Badger (although the badger companion has Badger as its AC type in its properties). I thought for a moment that it was returning -1 because I was testing on one of Cyphre's extended companions #28 the Smilodon ... but the AnimalCompanionType is stored in the .Bic/.Ifo simply as an integer and that should not be a problem : just return the integer from character properties. But even when I swapped the Smilodon (#28) for a Badger (#0) it still gave me -1

when i passed in the Master, whether the companion was summoned or not; but when I passed in the companion, the Smilodon returned -1 as it has no AnimalCompanionType set in its blueprint, the Badger returned 255 as noted above ( probably because it doesn't have the Animal Companion feat )

But I really want to just grab the ACType straight from the PC properties GFF file 'cause it's right there in front of my eyes, listed "CompanionType" as an Int. ah well, more workarounds ...

#38
kevL

kevL
  • Members
  • 4.052 mensajes
talent TalentSpell(int nSpell);
talent TalentFeat(int nFeat);
talent TalentSkill(int nSkill);

still broken.

int GetCreatureHasTalent(talent tTalent, object oCreature=OBJECT_SELF);

crash to desktop.


Use

talent GetCreatureTalentRandom(int nCategory, object oCreature=OBJECT_SELF, int iExcludedTalentsFlag = 0);

talent GetCreatureTalentBest(int nCategory, int nCRMax, object oCreature=OBJECT_SELF, int iExcludedTalentsFlag = 0);

int GetIsTalentValid(talent tTalent);


#39
kevL

kevL
  • Members
  • 4.052 mensajes
nwscript constants:

DAMAGE_TYPE_ALL <--> DAMAGE_TYPE_BLUDGEONING


loL,

- a comment in 'nx_s0_glass_doppel_buff'

// DAMAGE_TYPE_ALL is bludgeoning DR, don't ask me why

Confirmed in test. Plus, DT_Bludgeoning seems to be DT_All (vice versa). This is when used in EffectDamageReduction(), although i imagine that as an nwscript constant it might foobar be global ...

#40
I_Raps

I_Raps
  • Members
  • 1.262 mensajes
I looked at the Wiki this morning and saw you've been busy. Do you have any thoughts on True Sight?


(By the way, what did you change on Mass Deathward? I couldn't tell what was different.)

#41
kevL

kevL
  • Members
  • 4.052 mensajes
hey _Raps

just added Druid 9 to the castersList on MassDW (MotB addition). True Sight? I'm not sure, a couple years ago i had the same thoughts as others recently: does this work. Ark's right in that it shouldn't see through Stealth, but the only creature I've (not even) tested with is ... Dragons. They all have True Sight on their carapices -- which means it's an itemproperty like an amulet is. Spell Resistance taught us to be leary of itemproperties (though the vast majority work great). I'm thinking that, like SR, if a modder wants to be sure® of TS then apply it like an effect ( EffectTrueSeeing() )

all i can say without specific testing is that my playful dragons didn't let anything by ( w/ TS as itemproperty on their carapice ), although i also like to have their Spot & Listen up very high.


Thanks ... i think i might make that change for Dragons in the OC (True Seeing as effect, take it off the hide), or first do some tests vs. Greater Invis. if/when I get my head out from a score of discombobulated spellscripts .. & Factions still trouble me though i'm using scripts now that seem to make faction-decisions tighter and i got so upset with STANDARD_HOSTILE spellTargetting that i changed it to mean "start a riot" (hit everything, friend or foe! * ), which could well lead me back into more efforts on factions .....



* but not Plot

[ edit ] looks like Dann has TS covered in General

Editado por kevL, 08 abril 2013 - 12:24 .


#42
kevL

kevL
  • Members
  • 4.052 mensajes
not a bug, a Feature ( untested )

RPGplayer1 01/06/09 - Changed damage bonus from magical to physical

// HACK:
// If sum of two physical DAMAGE_TYPE_* constants is used (like 1+2 in this case),
// extra damage will be labeled as physical and will be of same type as weapon used


eg:

effect eDmg = EffectDamageIncrease(3, 3);

The second "3" represents the addition of nwscript constants

int DAMAGE_TYPE_BLUDGEONING = 1;
int DAMAGE_TYPE_PIERCING = 2;



( Also, not sure how this relates to Type_All/Type_Bludgeoning, noted above. )

Editado por kevL, 14 abril 2013 - 09:42 .


#43
Dann-J

Dann-J
  • Members
  • 3.161 mensajes

I looked at the Wiki this morning and saw you've been busy. Do you have any thoughts on True Sight?


(By the way, what did you change on Mass Deathward? I couldn't tell what was different.)

 

From the point of view of being able to attack when blinded, true sight as an item property certainly works. I have a permanently blind companion in a module I'm working on who can only initiate attacks when wearing a circlet with the true sight item property. The downside is that the companion also reacts to hostile creatures with an ethereal effect on them, but can't actually attack them, so they tend to run back and forth near the target in confusion.



#44
kevL

kevL
  • Members
  • 4.052 mensajes

GetLastSpell()

as used in the OnSpellCastAt event, ignores the SpellID that was passed in w/

SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, iSpellID));

and uses a value like GetSpellId() instead.


For example, a spell's Child ID will be referenced, if trying to trigger a particular OnSpellCastAt event with its Master ID.

Workaround: kill it with fire (that wasn't very helpful)
- handle the direct SpellID somehow. Set/Get a local_var or if possible map the child to its parent to trigger the action you want in the SpellCastAt script itself ...,,

/ carry on.


  • A rjshae le gusta esto

#45
kevL

kevL
  • Members
  • 4.052 mensajes

GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_*)

returns a creature that feels reputation_type vs OBJECT_SELF instead of as seemingly advertised; how OBJECT_SELF feels about creature.


cf. my previous comments about Reputation I've come to the conclusion that everything works fine if the Faction_Table is reversed, except for the PC column (which doesn't matter because it returns the same value either way)

here is the testscript


  • A rjshae le gusta esto

#46
Lance Botelle

Lance Botelle
  • Members
  • 1.480 mensajes

GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_*)

returns a creature that feels reputation_type vs OBJECT_SELF instead of as seemingly advertised; how OBJECT_SELF feels about creature.


cf. my previous comments about Reputation I've come to the conclusion that everything works fine if the Faction_Table is reversed, except for the PC column (which doesn't matter because it returns the same value either way)

here is the testscript


Hi KevL,

Yes, I have noticed "errors" with "GetNearestCreature" too. I wrote a function called GetNearestNPC, which says this: "GetNearestNPC will return any living NPC either friend or enemy. This replaces GetNearestCreature which can return a companion not currently controlled by a player even if NOT_PC is specified." The function is too home-brew with references to other functions to include here I'm afraid.

I have a couple more home brew functions around this topic, including this one too:-
 

///////////////////////////////////////////////////////////////////////////////////////////////////
// Returns a LIVING enemy - More useful that attacking dead ones!
// Rewrite of official campaign function.
///////////////////////////////////////////////////////////////////////////////////////////////////
object GetNearestLiveEnemy(object oSource=OBJECT_SELF, int nNth = 1);
object GetNearestLiveEnemy(object oSource=OBJECT_SELF, int nNth = 1) 
{
    return GetNearestCreature(CREATURE_TYPE_REPUTATION,
                              REPUTATION_TYPE_ENEMY,
                              oSource, nNth, CREATURE_TYPE_IS_ALIVE, CREATURE_ALIVE_TRUE);
}


#47
kevL

kevL
  • Members
  • 4.052 mensajes
constant IP_CONST_FEAT_* mismatch

iprp_feats.2da - note that rows 22(WeaponProfMartial) and 23(WeaponProfSim) do not jive with nwscript constants

IP_CONST_FEAT_WEAPON_PROF_SIMPLE = 22
IP_CONST_FEAT_WEAPON_PROF_MARTIAL = 23

workaround: when scripting, use the numeric constants. Ie,
22 = Martial Proficiency ip
23 = Simple Proficiency ip


they are used only in the function, ItemPropertyBonusFeat()
afaiaa