Okay boys and girls, it's time to learn some advanced spell making...stuff. This time we'll be covering conditions and references.
Conditions are parts of the script that basically tell the program to run the command only when the conditions are met.
References allow you to replace a command with a word, which makes it somewhat easier to understand.
Okay well that about does it. Again, you can always go here to do your own research for more conditions and commands. Next time, I'll be quizzing you on scripting, that way you can learn to do some intense scripting
Conditions are parts of the script that basically tell the program to run the command only when the conditions are met.
References allow you to replace a command with a word, which makes it somewhat easier to understand.
- So for starters, let's take out our spell that we made recently. If you actually saved it, open it up, by selecting File -> Data and check Oblivion.esm, then select TutorialSpell so that it is highlighted, and push "Set as Active File". Now go to Gameplay -> Edit Scripts then File -> Open and find TutorialSpellScript. It should look like this:
Scriptname TutorialSpellScript
Begin ScriptEffectStart
RemoveAllItems
end
If you didn't save, well there you go ^
- Okay so now we're going to add some conditions. Let me give you an example of a condition, and then explain it (note that this condition is using a reference, which we will talk about later):
If me.getisessential == 1 || me.getdead == 1 || me.getiscreature == 1
Okay, so every condition will start with if or elseif
The "me" is a reference
Getisessential is the condition. If it equals one, it means that the actor is essential, in other words, it is one of those actors that becomes unconscious when killed. If it equals 0, then it is a normal actor. If getdead equals one, then the actor is dead, if it equals zero the actor is alive. If getiscreature equals one, then the actor is a creature, if it equals zero, the actor is an NPC.
The "||" is logical or. In other words, if you see "||" it is really saying or. && means and.
So for this condition, if the target is essential, dead, or a creature, the script will preform the action.
- Now we're going to cover references.
The reference can be put anywhere, but it is best for it to be underneath the name, like this:
Scriptname Scriptname
Ref Reference
Okay so by typing "Ref" you are telling the script that the word next to it is not a condition, but is instead a reference. But you still have to assign the reference, which we will cover in the example...RIGHT NOW!!!
- So basically, copy this down, and I will explain things along the way:
Scriptname TutorialSpellScript
Ref me (me is a very favorable reference for the command we are going to use it with)
Begin ScriptEffectStart
Set me to getSelf (we have just assigned the reference to a command, the target itself in this case)
If me.getisEssential == 1 || me.getDead == 1 || me.getisCreature == 1
Return
Elseif me.getisEssential == 0 && me.getDead == 0 && me.getisCreature == 0
RemoveAllitems
endif (you have to have one of these for every if in the script)
endif
end
So what this says is if the target is essential, dead, or a creature, do nothing (return actually does do something, but it can't be noticed during gameplay). However, if the target is not essential, is alive, or is an NPC remove all of the target's items.
Okay well that about does it. Again, you can always go here to do your own research for more conditions and commands. Next time, I'll be quizzing you on scripting, that way you can learn to do some intense scripting