2024-06-20 15:47:42 -04:00

32 lines
1.3 KiB
Plaintext

/// /// /// /// /// /// /// /// /// /// /// ///
/// wg_used
/// OnUsed script for witchgrass placeable.
/// If player has a torch equipped, he will burn the plant.
///
/// Created by Gilgon Avalrock
/// /// /// /// /// /// /// /// /// /// /// ///
#include "lib_witchgrass"
void main(){
object oPlayer = GetLastUsedBy();
object oMainHand = GetItemInSlot( INVENTORY_SLOT_RIGHTHAND, oPlayer );
int nMHType = GetBaseItemType( oMainHand );
object oOffHand =GetItemInSlot( INVENTORY_SLOT_LEFTHAND, oPlayer );
int nOHType = GetBaseItemType( oOffHand );
//if player has a torch equiped, burn plant
if( ( nMHType == BASE_ITEM_TORCH ) || ( nOHType == BASE_ITEM_TORCH ) ) {
//fire and smoke...
SetOnFire( OBJECT_SELF );
GenerateSmoke(OBJECT_SELF);
object oSmoke = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_dustplume", GetLocation(OBJECT_SELF));
DestroyObject(oSmoke,6.f);
int i=1;
//get every creature within 10 feet high.
object oCreature = GetNearestObject( OBJECT_TYPE_CREATURE, OBJECT_SELF, i );
while( oCreature != OBJECT_INVALID && GetDistanceToObject( oCreature ) <= 10.f ) {
GetHigh(oCreature);
i++;
oCreature = GetNearestObject( OBJECT_TYPE_CREATURE, OBJECT_SELF, i );
}
}
}