int IsUsingSilver(object oTarget)
{
object oWeapon = GetLastWeaponUsed(oTarget);
if(GetItemBaseMaterialType(oWeapon) == GMATERIAL_METAL_ALCHEMICAL_SILVER)
{
return TRUE;
}
return FALSE;
}
Posting a Script - Because It Works Now :)
#1
Posté 27 février 2014 - 08:22
- Kaldor Silverwand, rjshae et bealzebub aiment ceci
#2
Posté 27 février 2014 - 08:24
GM: What is the purpose?
Barbarian: The formatting in the forums... the wind in my hair!
GM: Yes... it is good. Drink!
#3
Posté 27 février 2014 - 08:31
yes, it is good
#4
Posté 06 mars 2014 - 04:42
int IsUsingSilver(object oTarget)
{
object oWeapon = GetLastWeaponUsed(oTarget);
if(oWeapon == OBJECT_INVALID) return FALSE;
if(GetItemBaseMaterialType(oWeapon) == GMATERIAL_METAL_ALCHEMICAL_SILVER)
{
return TRUE;
}
return FALSE;
}
This is the version that actually works BTW...
if enemy AI makes it change weapons, like from sword to bow - and the timing is right, the game will lock because the enemy has no weapon to check for.
this script was written for a Feat with an AOE HB.
thank you, that is all... ![]()
#5
Posté 06 mars 2014 - 04:43
/heh
![]()
- Morbane aime ceci
#6
Posté 06 mars 2014 - 05:40
I guess you could probably do something like...
int IsUsingSilver(object oTarget)
{
object oWeapon = GetLastWeaponUsed(oTarget);
return ( ( oWeapon != OBJECT_INVALID) &&
( GetItemBaseMaterialType(oWeapon) == GMATERIAL_METAL_ALCHEMICAL_SILVER ) );
}
but, eh, same diff.
#7
Posté 06 mars 2014 - 06:44
I guess you could probably do something like...
int IsUsingSilver(object oTarget) { object oWeapon = GetLastWeaponUsed(oTarget); return ( ( oWeapon != OBJECT_INVALID) && ( GetItemBaseMaterialType(oWeapon) == GMATERIAL_METAL_ALCHEMICAL_SILVER ) ); }but, eh, same diff.
looking at this, and it looks like the return does not actually return anything useful - that is OBJECT_INVALID may be an int and GMATERIAL_METAL_ALCHEMICAL_SILVER is as well - but the return value would be whatever number that the const strings represent - not TRUE or FALSE.
or am i just not seeing the logic?
#8
Posté 06 mars 2014 - 07:36
If you used it in an 'if' conditional, would it not give a true/false value? Same principle.
#9
Posté 06 mars 2014 - 07:51
Morbane,
look at it this way,
both expressions in the parenthesis need to evaluate TRUE for the return to be true.
if (oWeapon != OBJECT_INVALID) -> if true
if (basematerial == Silver) -> if true
then TRUE.
#10
Posté 06 mars 2014 - 09:13
got it.
always happy to see ways of streamlining script code ![]()





Retour en haut






