before calling it Random Equipment 3 Mod I would like to add a couple of feaures:
Code: Select all
(setq intSetWeaponConfig (lambda (levelChoice)
(block (choiceWeapon)
(if (eq levelChoice extended)
(setq levelChoice (cat (sysGetLevel) "a"))
)
(switch
(eq levelChoice 1a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "cv--- ----- ----- -----"))
(eq levelChoice 1b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "cu--- ----- ----- -----"))
(eq levelChoice 2a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "vcv-- ----- ----- -----"))
(eq levelChoice 2b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "vcuv- ----- ----- -----"))
(eq levelChoice 3a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "-vcv- ----- ----- -----"))
(eq levelChoice 3b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "-vcu- ----- ----- -----"))
(eq levelChoice 4a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "--vcv ----- ----- -----"))
(eq levelChoice 4b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "--vcu v---- ----- -----"))
(eq levelChoice 5a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "---vc v---- ----- -----"))
(eq levelChoice 5b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "---vc uv--- ----- -----"))
(eq levelChoice 6a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----v cv--- ----- -----"))
(eq levelChoice 6b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----v cuv-- ----- -----"))
(eq levelChoice 7a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- vcv-- ----- -----"))
(eq levelChoice 7b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- vcuv- ----- -----"))
(eq levelChoice 8a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- -vcv- ----- -----"))
(eq levelChoice 8b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- -vcuv ----- -----"))
(eq levelChoice 9a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- --vcv ----- -----"))
(eq levelChoice 9b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- --vcu ----- -----"))
(eq levelChoice 10a)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- ---vc ----- -----"))
(eq levelChoice 10b)
(setq choiceWeapon (itmCreateRandom "w,-m -Launcher -Ammo;" "----- ---uc ----- -----"))
)
(if choiceWeapon
(block (enhancedWeapon)
;set the enhanced weapon to the selected weapon, then maybe we will enhance it.
(setq enhancedWeapon choiceWeapon)
;10% of the weapons will be nerfed or enhanced at random
(block (roll enhancement)
(setq roll (random 1 10))
(setq enhancement (random (list 0x0101 0x0102 0x0103 0x0104 0x0105 0x0f01 0x0f02 0x0f03 0x1002 0x8f01 0x8f02 0x8f03 0x8101 0x8102 0x8103 0x8104)))
(if (leq (roll 1))
(block Nil
(setq enhancedWeapon (itmSetEnhanced choiceWeapon enhancement))
)
)
)
(objAddItem gSource enhancedWeapon)
(shpInstallDevice gSource enhancedWeapon)
)))))
If the lambda variable is "extended" the new if will generate the string *number*a and then that will be passed to the switch.
However I don't know why, this code won't generate a weapon and when the function is called in the console "sometimes" i get the weapon installed and "sometimes" not (not joking!)
I'm still trying to figure out when the function works and why.
It's really strange, I start a new game and the function won't work, then after some time the function starts working.
The same function without modifications even caused a hard crash when called in the system after Eridani, but I was unable to get the crash a second time.
If I manage to make this work, I can make more if statements for sovereigns. For example Sung ships could have the weapons filtered for the Sung modifier in the weapons extended.
[EDIT] I just noticed that all the weapon installed when you call the function in the console are enhanced, what I'm doing wrong with the if function ?
