×
Меню
Индекс

MSFD Worn / equipped object information

 
GetWeaponType (returns short)
 
     If ( Player->GetWeaponType == 0 )
          ;Player uses a short blade
 
GetArmorType, armorPart_enum (returns short, -1 to 2)
 
     If ( Player->GetArmorType, 0 == 2 )
          ;Player wears a heavy helmet
 
These functions are called on an Actor to gather information regarding what the Actor has equipped. GetWeaponType returns the weapon type (see Table 1.1) of the Actor’s current weapon. GetArmorType returns the armor weight (see Table 1.3) of the Actor’s currently equipped armor part. The armor parts are coded by the numbers listed below (see Table 1.2). HasItemEquipped returns 1 if the Actor has the given item currently equipped and 0 if it does not.
 
Note: If an NPC has a bow but no arrows and fights using hand-to-hand (no other weapons), GetWeaponType 9 will still return true and HasItemEquipped will return true for the bow.
 
 
Weapon types (Table 1.1):
Weapon Type Name     Type Number
Unarmed     -1
Short blade, 1 hand     0
Long blade, 1 hand     1
Long blade, 2 hand close     2
Blunt, 1 hand     3
Blunt, 2 hand close     4
Blunt, 2 hand wide     5
Spear, 2 hand wide     6
Axe, 1 hand     7
Axe, 2 close     8
Bow     9
Crossbow     10
Thrown weapon     11
Arrow<?>     12
Bolt<?>     13
 
 
Armor parts (Table 1.2):                
Armor Part Name     Part Number
Helmet     0
Cuirass     1
Left Pauldron     2
Right Pauldron     3
Greaves     4
Boots     5
Left Gauntlet     6
Right Gauntlet     7
Shield     8
Left Bracer     9
Right Bracer     10
    
 
 
Armor types / weight (Table 1.3):
Armor Type Name     Type Number
Unarmored     -1
Light Armor     0
Medium Armor     1
Heavy Armor     2
 
 
HasItemEquipped "item_ID" (returns short)
 
     If ( Player->HasItemEquipped "chitin club" == 1 )
          ;you poor dolt!
 
Sample Script:
When this script is placed on an object, Activating a reference to that object does “damage” to it based on the PC’s current weapon and strength. If the weapon is the specific weapon “Rock Splitter” the object is fully damaged in one hit. When the object is fully damaged, it explodes sending shards into the PC’s face unless he has a shield or a helmet equipped.
 
Begin breakme
 
float hitsleft
float hitpercent
short damage
short tempdamage
short weapon
short doOnce
short shieldType
short hasHammer
short hitRock
 
if ( doOnce == 0 )
     set hitsleft to 10000
     set doOnce to 1
endif
 
if ( OnActivate )
     set hasHammer to ( player->HasItemEquipped "RockSplitter" )
     if ( hasHammer == 1 )
          MessageBox "Rock Splitter unleashes its mighty force..."
          set hitsLeft to 0
     else
          MessageBox "You hit the rock with your current weapon..."
          set weapon to ( player->GetWeaponType )
          set damage to ( player->getstrength )
          set tempdamage to 5
 
          if ( weapon == -1 )
               set tempdamage to 1
          endif
          if ( weapon >= 9 )
               set tempdamage to 2
          endif
          if ( weapon == 4 )
               set tempdamage to 10
          endif
          if ( weapon == 8 )
               set tempdamage to 8
          endif
    
          set damage to damage * tempdamage
 
          set hitsleft to hitsleft - damage
     endif
 
     if ( hitsleft <= 0 )
          disable
          set shieldType to ( player->GetArmorType 8 )
          if ( shieldType == -1 )
               set shieldType to ( player->GetArmorType 0 )
               if ( shieldType == -1 )
                    MessageBox "...and the rock shatters sending jagged shards into your eyes."
                    Player->ModHealth -50
               else
                    MessageBox "...and the rock shatters, deadly shards glancing off your helmet."
               Endif
          else
               MessageBox "...and the rock shatters, deadly shards glancing off your shield."
          Endif
     else
          set hitpercent to hitsleft / 100
          set hitpercent to 100 - hitpercent
          MessageBox "...and the rock is %.2f percent damaged but remains intact.", hitpercent
     endif
 
endif