Khet Posted June 2, 2009 Author Share Posted June 2, 2009 Just gave it a shot, with the baseobject idea it didn't work. Reverted back to the way the script was before and the same issue arises. I'm seriously starting to think it's a problem with the Get EquipType always coming back as a bloody pistol. Link to comment Share on other sites More sharing options...
TGBlank Posted June 2, 2009 Share Posted June 2, 2009 Are you loading the geck through "fose_loeader.exe" -editor? Link to comment Share on other sites More sharing options...
Khet Posted June 2, 2009 Author Share Posted June 2, 2009 Yep, I am. It has to be something simple that I'm doing wrong here... Link to comment Share on other sites More sharing options...
Alundaio Posted June 2, 2009 Share Posted June 2, 2009 ----------Try this-----------------ref equippedWeaponref equipType Begin GameMode set equippedWeapon to Player.GetEquippedObject 5set equipType to equippedWeapon.GetWeaponType Link to comment Share on other sites More sharing options...
Khet Posted June 2, 2009 Author Share Posted June 2, 2009 Still coming back as a pistol. Once again I'm testing it with the Chinese Assault Rifle (which, according the the FOSE command lists should come back as a 6 when the EquipType is checked) but it's still coming back as a 3 or a 4. Here's the exact script I JUST ran. Now, I don't know how much of a difference it makes but when I had everything in it's own If block ALL the perks were being added except for the FOPRAuto. Once I moved everything to else if's only the FOPRPistol is showing up no matter what I have equipped. SCN FOPRProfessionScript ref equippedWeapon ref equipType Begin GameMode set equippedWeapon to Player.GetEquippedObject 5 set equipType to equippedWeapon.GetEquipType If EquipType == 3 || 4 && Player.IsInCombat == 1 Player.AddPerk FOPRPistol Else Player.RemovePerk FOPRPistol ElseIf EquipType == 0 || 1 || 2 && Player.IsInCombat == 1 Player.AddPerk FOPRMelee Else Player.RemovePerk FOPRMelee ElseIf EquipType == 5 || 7 && Player.IsInCombat Player.AddPerk FOPRRifle Else Player.RemovePerk FOPRRifle ElseIf EquipType == 6 && Player.IsInCombat == 1 Player.AddPerk FOPRAuto Else Player.RemovePerk FOPRAuto EndIf End As a side note the FOPRPistol perk IS removed when I leave combat. At least that's working! edit: Just checked the FOSE site again and read up on the baseform (which is what GetEquipType returns) and it sounds like it's trying to return an editor ID, unless I'm reading it wrong. Here's the little bit: Calling By Base Form (B):Syntax Example: FunctionName someParameters objectID:refExamples: ; get the form at index 2 (3rd item) of the Alcholic Drinks form list ref form set form to ListGetNthForm AlchohlicDrinks 2 Most Fallout scripting functions use this calling convention, where all information is passed into the function as a parameter. These parameters can be base forms, integers, floats, form lists or references. Base forms can either be passed in using the Editor Name directly, or the base form could be put into a reference variable first. In some documentation you will see the term ObjectID rather than Base Form - these terms are mostly interchangeable. Link to comment Share on other sites More sharing options...
TGBlank Posted June 2, 2009 Share Posted June 2, 2009 EquipType should be a short, not a ref. Do notEquipType == 3 || 4 && Player.IsInCombat == 1 Do( ( (EquipType == 3) || ( EquipType == 4 ) ) && ( Player.IsInCombat == 1) ) Same for the others.|| is a logical separators, it's used to separate conditions, in your previous script, you where asking: "If (EquipType is equal to 3) OR ( 4 AND the player is in combat )For future reference, 0 is considered false, anything else is considered true. so (5) is true, (2+2) is true, (-1 + 1) is false. Use parenthesis. Specially if you are not keen on what is the operator's priority and precedence. Even more so if you didn't understood the last sentence. Don't use IsInCombat, is not too reliable for what you want, try IsWeaponOut instead. Identation.. for the love of tink, use proper indentation. Else goes at the same 'level' than it's corresponding IF. The structure is: If (condition) Stuff EndIf or If (condition) Stuff Else other stuff EndIf or If (condition) Stuff ElseIf (another condition) Stuff2 ElseIf (yet another condition) Stuff3 Else More stuff Endif With each if, you can have either no Else, or 1 else, no more. It also goes last, after all elseifs.Ergo, put all your removeperk on a single else, and put the else at the bottom. Link to comment Share on other sites More sharing options...
Alundaio Posted June 2, 2009 Share Posted June 2, 2009 You are running Geck with -Fose right? Maybe when you equip a weapon it's not considered the Weapon slot. Try right hand. *Edit* Nevermind the Code Master got it. Link to comment Share on other sites More sharing options...
Khet Posted June 2, 2009 Author Share Posted June 2, 2009 Heh, sorry. Never really understood the 'format' for writing scripts, always did my own thing. As for your suggestions, made them, and now the FOPRRifle is appearing too, along side the Pistol. At least it's a change. I'm starting to feel quite incompetent. Edit: Sorry, that's pistol and Melee. Unless there's something else I missed... here's the changes. SCN FOPRProfessionScript ref equippedWeapon Short equipType Begin GameMode set equippedWeapon to Player.GetEquippedObject 5 set equipType to equippedWeapon.GetEquipType If (((EquipType == 3) || EquipType == 4) && (Player.IsInCombat == 1)) Player.AddPerk FOPRPistol ElseIf (((((EquipType == 0) || (EquipType == 1) || (EquipType == 2))) && (Player.IsInCombat == 1))) Player.AddPerk FOPRMelee ElseIf (((EquipType == 5) || (EquipType == 7)) && (Player.IsInCombat == 1)) Player.AddPerk FOPRRifle ElseIf ((EquipType == 6) && (Player.IsInCombat == 1)) Player.AddPerk FOPRAuto Else Player.RemovePerk FOPRPistol Player.RemovePerk FOPRMelee Player.RemovePerk FOPRRifle Player.RemovePerk FOPRAuto EndIf End Link to comment Share on other sites More sharing options...
Alundaio Posted June 2, 2009 Share Posted June 2, 2009 Wow, super parenthesis! In all honesty this would be perfectly fine (except for the getting the Weapon type correct):-------------------------------------------------------------------------------------------SCN FOPRProfessionScript ref equippedWeapon Short equipType Begin GameMode set equippedWeapon to Player.GetEquippedObject 5 set equipType to equippedWeapon.GetEquipType If (Player.IsWeaponOut) If (EquipType == 3 || EquipType == 4) Player.AddPerk FOPRPistol ElseIf (EquipType == 0 || EquipType == 1 || EquipType == 2) Player.AddPerk FOPRMelee ElseIf (EquipType == 5 || EquipType == 7) Player.AddPerk FOPRRifle ElseIf (EquipType == 6) Player.AddPerk FOPRAuto EndIf Else Player.RemovePerk FOPRPistol Player.RemovePerk FOPRMelee Player.RemovePerk FOPRRifle Player.RemovePerk FOPRAuto EndIf End Link to comment Share on other sites More sharing options...
Khet Posted June 2, 2009 Author Share Posted June 2, 2009 I actually tried it that way but kept giving me parenthsis mismatched. *shrug* Erm, that is, the way TG had it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.