Mktavish Posted May 28, 2019 Share Posted May 28, 2019 I just use the functions bible https://geckwiki.com/index.php?title=Category:Functions But the old one I can see may be easier to understand http://geck.bethsoft.com/index.php?title=Category:Functions Anyways , the place to start with scripting is the "Begin" function , and what is known as scripting blocks. http://geck.bethsoft.com/index.php?title=Begin So the first thing to do with a script is declare its name like this. SCN MyScript Then a begin block starts the engine reading the code like this. Begin OnActivate Then you either make a command like this. PlayerRef.AddItem MySuperGun Or pose a Question / condition like this. If PlayerRef.GetInventoryCount MySuperGun == 1 And you can have series of questions / commands and other stuff will discuss later.But stopping here to see if you follow ? And plz ask questions if need. Link to comment Share on other sites More sharing options...
MaiYass Posted May 28, 2019 Author Share Posted May 28, 2019 (edited) I just use the functions bible https://geckwiki.com/index.php?title=Category:Functions But the old one I can see may be easier to understand http://geck.bethsoft.com/index.php?title=Category:Functions Anyways , the place to start with scripting is the "Begin" function , and what is known as scripting blocks. http://geck.bethsoft.com/index.php?title=Begin So the first thing to do with a script is declare its name like this. SCN MyScript Then a begin block starts the engine reading the code like this. Begin OnActivate Then you either make a command like this. PlayerRef.AddItem MySuperGun Or pose a Question / condition like this. If PlayerRef.GetInventoryCount MySuperGun == 1 And you can have series of questions / commands and other stuff will discuss later.But stopping here to see if you follow ? And plz ask questions if need.How do you name the script? I've been messing around with creating scrips and haven't seen anything that let's me name it...Edit: nvm, figured it out. Edited May 28, 2019 by TomSkele Link to comment Share on other sites More sharing options...
MaiYass Posted May 28, 2019 Author Share Posted May 28, 2019 I just use the functions bible https://geckwiki.com/index.php?title=Category:Functions But the old one I can see may be easier to understand http://geck.bethsoft.com/index.php?title=Category:Functions Anyways , the place to start with scripting is the "Begin" function , and what is known as scripting blocks. http://geck.bethsoft.com/index.php?title=Begin So the first thing to do with a script is declare its name like this. SCN MyScript Then a begin block starts the engine reading the code like this. Begin OnActivate Then you either make a command like this. PlayerRef.AddItem MySuperGun Or pose a Question / condition like this. If PlayerRef.GetInventoryCount MySuperGun == 1 And you can have series of questions / commands and other stuff will discuss later.But stopping here to see if you follow ? And plz ask questions if need.New issue now :/ I copied the first block of script that Rick posted into my script, but when I try to save it, I get the warning message "Script command "OnDeath" not found." and it doesn't save, even if I click the "Yes to all" option, so I tried deleting the OnDeath section, but trying to save that gives me the warning message "Mismatched begin/end block starting on line 7." or in this case the script line "being OnCombatEnd" and doesn't save, even if I click "Yes to all". Any idea what to do? Link to comment Share on other sites More sharing options...
GamerRick Posted May 28, 2019 Share Posted May 28, 2019 (edited) I forgot the "begin" statement for the OnDeath block. Here is what you do: 1) In the object window, go to Miscellaneous - Script and open AgathaScript (which is already an object script like you want) 2) In the Script Edit window - Click the menu item Script - New... (which will clear the contents of the window) 3) cut and paste this into the edit window, and change MyNPCScript with your NPC's name. scn MyNPCScript short hasSpell begin OnStartCombat if hasSpell == 0 addspell stealthBoyInvisibilitySpell set hasSpell to 1 endif end begin OnCombatEnd if hasSpell == 1 removespell stealthBoyInvisibilitySpell set hasSpell to 0 endif end begin OnDeath if hasSpell == 1 removespell stealthBoyInvisibilitySpell set hasSpell to 0 endif end 4) Click the save icon, which will compile your script and save it if there are not errors. 5) Close the script edit window and save your mod. The script is now a part of your mod. 6) Open your NPCs window and select the above script from the dropdown list. 7) Actually acknowledge me and thank me for taking the time to help you. I need it. Edited May 28, 2019 by GamerRick Link to comment Share on other sites More sharing options...
MaiYass Posted May 28, 2019 Author Share Posted May 28, 2019 I forgot the "begin" statement for the OnDeath block. Here is what you do: 1) In the object window, go to Miscellaneous - Script and open AgathaScript (which is already an object script like you want) 2) In the Script Edit window - Click the menu item Script - New... (which will clear the contents of the window) 3) cut and paste this into the edit window, and change MyNPCScript with your NPC's name. scn MyNPCScript short hasSpell begin OnStartCombat if hasSpell == 0 addspell stealthBoyInvisibilitySpell set hasSpell to 1 endif end begin OnCombatEnd if hasSpell == 1 removespell stealthBoyInvisibilitySpell set hasSpell to 0 endif end begin OnDeath if hasSpell == 1 removespell stealthBoyInvisibilitySpell set hasSpell to 0 endif end 4) Click the save icon, which will compile your script and save it if there are not errors. 5) Close the script edit window and save your mod. The script is now a part of your mod. 6) Open your NPCs window and select the above script from the dropdown list. 7) Actually acknowledge me and thank me for taking the time to help you. I need it.Thanks! I'll be sure to credit you once I update my mod! Link to comment Share on other sites More sharing options...
Recommended Posts