Jump to content

Scripting help


IgorTheBlack

Recommended Posts

The former question? If you aren't using a custom-made external application to do this, there isn't a chance in hell. Getting the player's encumberance would prove extremely difficult, if not downright impossible, and to make the item "change" weight, you'd have to greate an object for every weight possibility and switch them out from the PC's inventory.

 

As for the latter question, no -- they don't have any weight at all.

Link to comment
Share on other sites

Can't change the weight of an object -- you must use seperate obects. IIRC, you cannot change the magnitude of a spell, either.

 

Doing this via spell is still viable, however, as you can use Burden (and Feather) spells of varying magnitude in combination to get a value -- for example, if you need a magnitude 79 Burden, you could add a magnitude 64 Burden, a magnitude 16 Burden, and a magnitude 1 Feather to get the desired goal.

 

...Yeah, really makes you wish you learned binary arithmetic sooner, don't it?

Link to comment
Share on other sites

As I've said before, no. And as I've said before, you can't change a spell's magnitude via scripting.

 

If you're just trying to make the PC get overencumbered, why not simply add a spell that Burdens him by 3200 points or something?

 

If you aren't, however, doing this via a Burden spell would be quite simple. Just create Burden spells based on exponents of two (up to 128) multiplied by five, then get the binary equivalent of the player's Strength. Then, of course, the possibility of a Feather or additional Burden spell comes into effect and with it, the problem of reduced accuracy. The simplest solution here would be to just make sure there are no Feather effects present, and drop the item if there are.

 

Something like this...

 

Short STRR
Set STRR to ( Player->GetStrength )
Short Temp
Short p7
Set Temp to ( STRR - 128 )
If ( Temp > -1 )
 Set p7 to 1
 Set STRR to Temp
Else
 Set p7 to 0
EndIf
Short p6
Set Temp to ( STRR - 64 )
If ( Temp > -1 )
 Set p6 to 1
 Set STRR to Temp
Else
 Set p6 to 0
EndIf
Short p5
Set Temp to ( STRR - 32 )
If ( Temp > -1 )
 Set p5 to 1
 Set STRR to Temp
Else
 Set p5 to 0
EndIf
Short p4
Set Temp to ( STRR - 16 )
If ( Temp > -1 )
 Set p4 to 1
 Set STRR to Temp
Else
 Set p4 to 0
EndIf
Short p3
Set Temp to ( STRR - 8 )
If ( Temp > -1 )
 Set p3 to 1
 Set STRR to Temp
Else
 Set p3 to 0
EndIf
Short p2
Set Temp to ( STRR - 4 )
If ( Temp > -1 )
 Set p2 to 1
 Set STRR to Temp
Else
 Set p2 to 0
EndIf
Short p1
Set Temp to ( STRR - 2 )
If ( Temp > -1 )
 Set p1 to 1
 Set STRR to Temp
Else
 Set p1 to 0
EndIf
Short p0
Set Temp to ( STRR - 1 )
If ( Temp > -1 )
 Set p0 to 1
 Set STRR to Temp
Else
 Set p0 to 0
EndIf
Short DoOnce
If ( Player->GetItemCount Some_Stupid_Item < 1 )
 Player->RemoveSpell Burden_5
 Player->RemoveSpell Burden_10
 Player->RemoveSpell Burden_20
 Player->RemoveSpell Burden_40
 Player->RemoveSpell Burden_80
 Player->RemoveSpell Burden_160
 Player->RemoveSpell Burden_320
 Player->RemoveSpell Burden_640
 Return
ElseIf ( Player->GetEffects sEffectBurden )
 If ( DoOnce < 1 )
   MessageBox "The script doesn't like you.  Go away and come back without a magical summat."
   Player->Drop Some_Stupid_Item 1
   Return
 Else
   Return
 EndIf
Else
 Set DoOnce to 0
EndIf
If ( p0 )
 Player->AddSpell Burden_5
Else
 Player->RemoveSpell Burden_5
EndIf
If ( p1 )
 Player->AddSpell Burden_10
Else
 Player->RemoveSpell Burden_10
EndIf
If ( p2 )
 Player->AddSpell Burden_20
Else
 Player->RemoveSpell Burden_20
EndIf
If ( p3 )
 Player->AddSpell Burden_40
Else
 Player->RemoveSpell Burden_40
EndIf
If ( p4 )
 Player->AddSpell Burden_80
Else
 Player->RemoveSpell Burden_80
EndIf
If ( p5 )
 Player->AddSpell Burden_160
Else
 Player->RemoveSpell Burden_160
EndIf
If ( p6 )
 Player->AddSpell Burden_320
Else
 Player->RemoveSpell Burden_320
EndIf
If ( p7 )
 Player->AddSpell Burden_640
Else
 Player->RemoveSpell Burden_640
EndIf

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...