Jump to content

Script Trouble


RyanFialcowitz

Recommended Posts

I'm having problems getting my script to work. It's supposed to show you a menu allowing you to pick one of the combat skills and give you a perk relevant to your choice- this part works. It's then supposed to set all other combat skills to zero and unequip the player's weapon if it doens't match the choice they made. This part doesn't work- the game seems to ignore the conditions I'm using and it just zeros out all the combat skills and unequips all items.

 

Here's the script:

ScriptName WeaponRestrictionScript


Float FQuestDelayTime
Ref Weapon
Short Button
Short DoOnce
Short Setup


Begin GameMode


Set FQuestDelayTime To .7
Set Button To GetButtonPressed
Set Weapon To PlayerRef.GetEquippedObject 5


If Setup == 0
ShowMessage ChooseCombatSkillMessage
Set Setup To 1
EndIf


If Button > -1
If Button == 0
Player.AddPerk SizeMatters
ElseIf Button == 1
Player.AddPerk Cyborg
ElseIf Button == 2
Player.AddPerk LittleLeaguer
ElseIf Button == 3
Player.AddPerk GunNut
ElseIf Button == 4
Player.AddPerk IronFist
EndIf
EndIf


If Player.HasPerk SizeMatters == 0
Player.SetAv BigGuns -70
EndIf


If Player.HasPerk Cyborg == 0
Player.SetAv EnergyWeapons -70
EndIf


If Player.HasPerk LittleLeaguer == 0
Player.SetAv MeleeWeapons -70
EndIf


If Player.HasPerk GunNut == 0
Player.SetAv SmallGuns -70
EndIf


If Player.HasPerk IronFist == 0
Player.SetAv Unarmed -70
EndIf


If (Player.HasPerk SizeMatters == 0 && Player.GetEquipType Weapon == 0) 
Player.UnequipItem Weapon
EndIf


If (Player.HasPerk Cyborg == 0 && Player.GetEquipType Weapon == 1) 
Player.UnequipItem Weapon
EndIf


If (Player.HasPerk LittleLeaguer == 0 && Player.GetEquipType Weapon == 3) 
Player.UnequipItem Weapon
EndIf


If (Player.HasPerk GunNut == 0 && Player.GetEquipType Weapon == 2) 
Player.UnequipItem Weapon
EndIf


If (Player.HasPerk IronFist == 0 && Player.GetEquipType Weapon == 4) 
Player.UnequipItem Weapon
EndIf


End

This is driving me nuts! Any help would be greatly appreciated.

 

Link to comment
Share on other sites

Hmmm ... it seems like it should be working except for a couple things.

 

Your "Ref Weapon" could be having a problem because GetEquipType is returning a base-ID .... but not really sure there , and it doesn't explain why all your skills are getting zero'd. I would guess some unexpected glitchyness is happening.

 

And maybe it is because you need to break the script up into MenuMode and GameMode blocks.

Because the message box with buttons is MenuMode 1001 ... hence not gamemode.

 

Sorry I couldn't be more help .

Link to comment
Share on other sites

Hmmm ... it seems like it should be working except for a couple things.

 

Your "Ref Weapon" could be having a problem because GetEquipType is returning a base-ID .... but not really sure there , and it doesn't explain why all your skills are getting zero'd. I would guess some unexpected glitchyness is happening.

 

And maybe it is because you need to break the script up into MenuMode and GameMode blocks.

Because the message box with buttons is MenuMode 1001 ... hence not gamemode.

 

Sorry I couldn't be more help .

 

I got the script to work, mostly. If the player had the perk the skill would remain untouched and they could equip the relevant weapon. If not the skill was zeroed out and inappropriate weapons would be unequipped.

 

The problem became that giving the perks via the script rarely worked and it seemed completely random when it did work. It got to be such a headache that I just gave up. I'm sure there's some more efficient way to accomplish this goal but I couldn't figure it out. Now that I think of it I can't think of any other mods that add perks via scripts like I was trying to do. Perhaps this is why.

 

So, I kept the script but not the menu stuff. I do appreciate your response though!

Link to comment
Share on other sites

Hmmm ... I'm sorry you feel so discouraged. I'd suggest not to take it so hard ... its a common occurrence.

 

I do think a different approach might achieve what you want ... there is always many ways with the geck to get to an end result.

Link to comment
Share on other sites

Hmmm ... I'm sorry you feel so discouraged. I'd suggest not to take it so hard ... its a common occurrence.

 

I do think a different approach might achieve what you want ... there is always many ways with the geck to get to an end result.

 

Indeed, I don't understand why a script would have such a difficult time adding a perk. It's the lack of understanding why it's not working that causes the real frustration.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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