thelawfull Posted July 11, 2015 Share Posted July 11, 2015 have a great idea but no knowledge of scripting, Maybe somebody could help?. Link to comment Share on other sites More sharing options...
Surilindur Posted July 12, 2015 Share Posted July 12, 2015 (edited) Selecting the skill level by hand when making spells in the CS (just below the effects list) makes them usable only after that skill level has been reached, not before. Also the auto-calculate thing works, but it calculates the level automatically. Like Expert level spells can only be cast if that magic skill is greater than or equal to 75. If that was what you were thinking. Making a script... umm... how to make it depends on the amount of spells, I think. Just a few could be made by checking skill level and if player has that spell already. If the idea is to add a spell when skill level is high enough. ; Alteration adept spell, actor value codes are in OBSE command documentation If ( Player.GetActorValueC 20 >= 50 ) && ( Player.HasSpell SomeAdeptSpellID == 0 ) Player.AddSpell SomeAdeptSpellID MessageBoxEX "You have unlocked %n!", SomeAdeptSpellID EndIf Or something a bit like that? For a hundred spells, using an array might be better than writing that a hundred times. Just add all the spells to an array and then go through it. Maybe something like that could work (not tested, though): Array_var aSpells Array_var aTemp ref rTemp int iLevel int iSchool ... ; Initialise the array somewhere and add spells to it, you could probably ; do this somewhere else, as it only needs to be done once, if this is a quest script let aSpells := ar_Construct Array ar_Append aSpells SomeSpellID ; SetDebugMode 0 disables, SetDebugMode 1 enables the debug messages (PrintD) for the whole mod ; Also can be done just once per save load, for example. SetDebugMode 1 ... let aTemp := ar_Construct Array PrintD "MyModPrefix: Check " + $( ar_Size aSpells ) + " spells..." ForEach aTemp <- aSpells let rTemp := *aTemp let iLevel := ( GetSpellMasteryLevel rTemp ) * 25 let iSchool := ( GetSpellSchool rTemp ) + 20 If ( Player.GetActorValueC iSchool >= iLevel ) && ( Player.HasSpell rTemp == 0 ) Player.AddSpell rTemp PrintD "MyModPrefix: Added '" + $rTemp + "' to player (AV " + $iSchool + ", level " + $iLevel + ")" MessageEX "You have unlocked %n!", rTemp EndIf Loop PrintD "MyModPrefix: Check finished!" let aTemp := ar_Null Maybe something like that could be useful for several spells. Easier than checking each one individually. :P Hopefully that helps a little. :) Edit: OBSE is required for those, forgot to mention it. Edited July 12, 2015 by PhilippePetain Link to comment Share on other sites More sharing options...
thelawfull Posted July 12, 2015 Author Share Posted July 12, 2015 (edited) the spells wont have a school requirement, But a skill one and yes having it after is what I am looking for thankyou. :smile:theres only about 7 or 8 spells but i want them unlocked when you meet a certain sneak requirement endurance requirement stuff like that. Edited July 12, 2015 by thelawfull Link to comment Share on other sites More sharing options...
thelawfull Posted July 12, 2015 Author Share Posted July 12, 2015 so stength adept spell, actor value codes are in OBSE command documentationIf ( Player.GetActorValueC 30 ) && ( Player.HasSpell SomeAdeptSpellID == 0 )Player.AddSpell SomeAdeptSpellIDMessageBoxEX "through training you have learned %n!", SomeAdeptSpellIDEndIf Link to comment Share on other sites More sharing options...
thelawfull Posted July 12, 2015 Author Share Posted July 12, 2015 maybe you could help me with this one and i could give you credit?, Im a very new scripter and dont know what im doing really. Link to comment Share on other sites More sharing options...
Surilindur Posted July 13, 2015 Share Posted July 13, 2015 (edited) There are actor value codes in OBSE command documentation I like to use. But there is also just the normal GetActorValue command from the base game, which works with names. LikePlayer.GetActorValue StrengthWhereas the OBSE version requires the numbers presented in OBSE command documentation.Player.GetActorValueC 0If you want to check player's actor value, you can use either version. The 'comparison operator' thingy or whatever it is named checks the value returned against another value. Like If ( 2 > 3 ) ; False, 2 is not greater than 3 If ( 2 < 3 ) ; True, 2 is less than 3 If ( 1 == 1 ) ; True, 1 is equal to 1 If ( 1 >= 1 ) ; True, 1 is greater than OR EQUAL TO 1 If ( 1 <= 1 ) ; True, 1 is smaller than OR EQUAL TO 1 If ( 1 <= 2 ) ; True, 1 is LESS THAN or equal to 2 If ( 1 != 2 ) ; True, 1 is something else than 2 and the HasSpell returns 1 if actor has that spell, 0 if the actor does not have the spell. If player does not have the spell,If ( Player.HasSpell MySpellEditorID == 0 )Will return true so long as player does not have the spell. If you want to check if player does not have a spell AND player has strength greater than or equal to 90, that would work:If ( Player.GetActorValue Strength >= 90 ) && ( Player.HasSpell MySpellEditorID == 0 )So that checking actor value the easy way (should be enough for your project, I just try to use OBSE whenever I can, even when not necessary :P ) would work this way:If ( <actor ref>.GetActorValue <name of value> <comparison operator thingy> <value to compare to> )And Player strength with 'greater than or equal to' with a comparison value of 33 would beIf ( Player.GetActorValue Strength >= 33 )To print a message(box) with %n and such (to display names and such) will require OBSE. A piece like that: ref rSpell ... let rSpell := MySpellEditorID MessageBoxEX "Through training, you have learned %n", rSpellShould, if the spell would be named 'Fireball', show a messagebox:Through training, you have learned FireballMaybe it also works with editor IDs like I showed you:MessageBoxEX "Through training, you have unlocked %n", MySpellEditorIDBut I have used it with reference variables (ref), so I am not sure. This should, if player has strength greater than or equal to 33 and not the spell, add it to player and display a messagebox. ref rSpell ... ; Set the ref variable to your spell, lines like this with ";" prefix ; are comments in the script editor and do not produce effects in game. let rSpell := MySpellEditorID If ( Player.GetActorValue Strength >= 33 ) && ( Player.HasSpell rSpell == 0 ) Player.AddSpell rSpell MessageBoxEX "Through training, you have learned %n", rSpell EndIf OBSE allows to use "let" instead of "set", which is handy if you end up doing more scripting. Here are some examples of how normal "set...to" is easier with "let": set X to Y --> let X := Y set X to X - Y --> let X -= Y set X to X + Y --> let X += Y set X to X*Y --> let X *= Y set X to X/Y --> let X /= Y set X to X^Y --> let X ^= Y And more. The OBSE command documentation has everything listed. Does that help? I am extremely bad at explaining things. :P Edit: Also no need to give any credit, as you could always read everything on the scripting portal of the Construction Set wiki. :) Edited July 13, 2015 by PhilippePetain Link to comment Share on other sites More sharing options...
Recommended Posts