Dekkit Posted August 27, 2012 Share Posted August 27, 2012 (edited) Hey, so I thought it would be really cool for the player to role-play as a bandit more realistically. Obviously. And I would really appreciate any help making this mod. Here is the first part I need help with. Basically the player will be able to wear a bandit mask, which will conceal his/her identity in a way similar to the Gray Fox's Cowl in Oblivion. So you put on the mask, and your crime gold goes up so that guards will attack you on sight, knowing you are a bandit. If you take off the mask, your crime gold is restored to it's original count, and it's as though you never committed a crime. I made a script (kind of a noob at scripting still) to attempt this: Scriptname AAABanditMaskTry02 extends ObjectReference float PlrCrimeGold = Game.Player.getcrimegold {Event OnEquipped(Actor akActor) akActor.SetCrimeGold 1000EndEvent Event OnUnEquipped(Actor akActor) akActor.SetCrimeGold PlrCrimeGoldEndEvent} But when I compile it, I get these errors:d:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\AAABanditMaskTry02.psc(2,22): no viable alternative at input 'Game'd:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\AAABanditMaskTry02.psc(2,26): required (...)+ loop did not match anything at input '.'d:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\AAABanditMaskTry02.psc(2,7): Unknown user flag GameNo output generated for AAABanditMaskTry02.psc, compilation failed.(btw, I ran into an error without using "game." as well) I looked for an hour or two or three or four and couldn't find any hints for the proper syntax when adding or subtracting crime gold from the player. Any help would be greatly appreciated. Also anybody who would be willing to help making the rest of the mod feel free to PM me. Edited August 27, 2012 by Dekkit Link to comment Share on other sites More sharing options...
gasti89 Posted August 27, 2012 Share Posted August 27, 2012 (edited) Ok, 1st of all Game.Player doesn't exist. You call Game.GetPlayer(), or just GetPlayer() if you put "import game" at the beginning of the script. 2nd, Set and Get CrimeGold isn't an actor function, but instead a Faction function. So you have to call this on a crime faction. Since this will restrict the field on a single hold police faction, you might want to put a series of checks to know the location in wich you put on the mask. EDIT: i'll provide a test script in a few mins EDIT2: Script turning a bit long and i don't have much time. Sorry i'll write it asap Edited August 27, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Dekkit Posted August 27, 2012 Author Share Posted August 27, 2012 Thanks! The game.player was a last resort after I tried all the things I thought might work, but I hadn't even read about getplayer(), so I probably wouldn't have ever figured out the script. Also, do you think it would be possible to allow the player to take over a fort after killing the bandits, like eliminating respawns in an area after some trigger and bringing them back? Link to comment Share on other sites More sharing options...
gasti89 Posted August 27, 2012 Share Posted August 27, 2012 (edited) NOTE: Btw i noticed you have { and } at end and start of your script. This treats the whole script as a comment so it won't work. I think it's because you putted the script right after the "script name" tab. That is the comment tab, the real script comes when you right click it and click "edit source". I'm afraid you'll need a global variable to restore back the original crimegold. Using a local variable like you did will make it set everytime the script runs. So after the 1st equip, wich sets the crime to 1000, the variable will return 1000 and not the original value. Now, this script is for 1 single crime faction (Whiterun). If you want this for every hold you'll need to add the other 8. - Create a global variable (Object window ---> miscellaneus ---> global), type short, name "WhiterunCrimeGlobal". Value 0. - Here's the script Faction property WhiterunCrime auto GlobalVariable property WhiterunCrimeGlobal auto Event OnEquipped(Actor akActor) if akActor == Game.GetPlayer() WhiterunCrimeGlobal.SetValue(WhiterunCrime.GetCrimeGold() as Float) WhiterunCrime.SetCrimeGold(1000) endif EndEvent Event OnUnEquipped(Actor akActor) if akActor == Game.GetPlayer() WhiterunCrime.SetCrimeGold(WhiterunCrimeGlobal.GetValue() as Int) endif EndEvent Fill the properties with CrimeFactionWhiterun and your newly created global. Edited August 27, 2012 by gasti89 Link to comment Share on other sites More sharing options...
Dekkit Posted August 27, 2012 Author Share Posted August 27, 2012 I was thinking that I would probably need a global variable as well, and once again I probably never would have figured this out without your script/knowledge. Thanks a lot for the help man. Link to comment Share on other sites More sharing options...
gasti89 Posted August 27, 2012 Share Posted August 27, 2012 Anyway this script is for a single crime faction. For all the 9 holds you'll have to make 9 globals, 18 properties and call the same functions 9 times. I'm sure there's a way to make the script thinner, but it's out of my knowledge :| Link to comment Share on other sites More sharing options...
Ghaunadaur Posted August 27, 2012 Share Posted August 27, 2012 (edited) There's already an existing formlist CrimeFactionsList, which has all 36 crime factions in it. It can be used in a loop to set the new values for the factions.Also, if you want the guards to attack the player on sight, better replace SetCrimeGold() with SetCrimeGoldViolent() and GetCrimeGold() with GetCrimeGoldViolent(). The script may not be perfect, but in a quick test, it worked: Scriptname AAABanditMaskTry02 extends ObjectReference Formlist property CrimeFactionsList auto int[] CrimeGold Function StoreCrimeGold() CrimeGold = new int[36] int i = CrimeFactionsList.GetSize() While (i > 0) i -= 1 Faction CrimeFaction = CrimeFactionsList.GetAt(i) as Faction CrimeGold[i] = CrimeFaction.GetCrimeGold() as int CrimeFaction.SetCrimeGold(1000) EndWhile EndFunction Function RestoreCrimeGold() int i = CrimeFactionsList.GetSize() While (i > 0) i -= 1 Faction CrimeFaction = CrimeFactionsList.GetAt(i) as Faction int FactionCrimeGold = CrimeGold[i] CrimeFaction.SetCrimeGold(FactionCrimeGold) EndWhile EndFunction Event OnEquipped(Actor akActor) if akActor == Game.GetPlayer() StoreCrimeGold() endif EndEvent Event OnUnEquipped(Actor akActor) if akActor == Game.GetPlayer() RestoreCrimeGold() endif EndEvent ...or better make a new formlist. Edited August 27, 2012 by Ghaunadaur Link to comment Share on other sites More sharing options...
Dekkit Posted August 28, 2012 Author Share Posted August 28, 2012 Now you guys are just making me feel bad about my programming/scripting skills (or lack thereof) Link to comment Share on other sites More sharing options...
Recommended Posts