This function can be used to retrieve a specific buff pointer from an object or mobile @entity via a defined label. If the @label parameter is empty then a pointer to the first unlabeled buff will be returned.
Example:
// // Presumably a buff with the label "powerCharge" was defined for // the object via the web editor (alternatively it could have been // assigned via the ->label resolution on a buff pointer. //
if( %isEquippedItem( %getOwner( @this ), @this ) ) { @timer = %getPlayerVar( @this, "powerChargeTimer" ) @timer -= 1
@buff = %buffGetByLabel( @this, "powerCharge" )
if( @timer < 10 ) { @buff->modifier = 10 } elseif( @timer < 1 ) { @buff->modifier = 0 @timer = 40 }
%setPlayerVar( @this, "powerChargeTimer", @timer ) } endif |