×
Меню
Индекс

MSFD Equipment sharing and other companion functions

 
 
[no fix] companion      (is local short)
 
     short companion
     Set companion to 1
 
Tribunal introduced the option to "share" equipment with NPC's or creatures. To enable this option, you must define a local short variable named "companion" and set it to 1 or higher. Setting it to 0 or a negative value will disable sharing. This method is used both for mercenaries and for pack animals.
 
[no fix] minimumprofit          (is local float)
 
     Float minimumprofit
     If ( minimumprofit < 0 )
 
Seems to be another variable set by the game, it is probably the difference between current value of all goods and gold minus starting value. If this gets negative, the mercenary can be scripted to quit.
Sample Script: here is the relevant part from Calvus' script (the mercenary in Mournhold). This section handles changes in state when Calvus leaves a contract, either because the contract expires, or because the player has taken Calvus' stuff. The sharing is initiated from dialogue (setting companion to 1), not in the script itself
 
if ( GetJournalIndex Merc_Calvus_Quit < 1 )     ;if Calvus has already quit, don't do this
if ( Contract_Calvus == 1 )          ;if Calvus doesn't have a contract, don't do this
if ( minimumProfit < 0 )     ;Calvus is quitting because player took his stuff
               AiWander 128 6 0 40 30 20 0 0 0 0 0 0
               Set Companion to 0; stop sharing
               StopScript Contract_Calvus
               Set Contract_Calvus to 0
               ForceGreeting
               return
          else
               if ( Contract_Calvus == 0 )     ;handles Calvus after a contract expires
                     AiWander 128 6 0 40 30 20 0 0 0 0 0 0
                    Set Companion to 0; stop sharing
                    if ( GetJournalIndex Merc_Calvus < 10 )
                         Journal Merc_Calvus 10     ;first contract expired
                    else
                         Journal Merc_Calvus 20     ; most recent contract expired
                    endif
               endif    
          endif
     endif
endif
 
 
[no fix] StayOutside     (is local short)
 
     short StayOutside
     set StayOutside to 1
 
A useful variable for companions. When used in a script, it causes whoever it's assigned to to automatically remain (and wait) outside of any interior the player may enter (automatically rejoins upon return). (Forum info / Grumpy)