I did this many years ago, and yes, scripting this is the best method if you plan on releasing the mod.
Here was my approach:
1. Create a unique reference of the creature you wish to summon. Place this creature (in this case a BM_ice_troll) in your test cell (every mod should have one for testing stuff). Set the creatures AI to Fight: 30, and add a follow package with the player as the target.
2. Create a new spell. I did something simple like "fortify fatigue for 1 sec on self", and called it "Summon Troll". Do not auto-calc the value of the spell as it will not be balanced. Set the spell cost to a minimum of 130 (depending on the power of the summoned creature and spell duration). Just keep it balanced.
Next, add the spell to your vendors inventory.
3. Create your global script. This will run as soon as the game loads. This code will require the creation of a new global variable (short). To do this go to-> Gameplay-> Globals-> New-> [name your variable here] -> OK. Default values should be "Short and 0" if not, set to that value and type. Click OK. In this case my global var is AST_TrollEnabled.
Begin AST_MAIN_Summonif ( AST_TrollEnabled == 1 ) Returnendifif ( MenuMode == 1 ) returnendifif ( AST_TrollEnabled == 0 ) if ( Player-> GetSpellEffects, AST_Summon_Test == 1 ) PlaySound, "conjuration hit" PlaceAtPc, ast_mountain_troll, 1, 128, 0 set AST_TrollEnabled to 1 endifendifend
Now, once that's compiled it will need to be added to the start scripts. Go to -> Gameplay-> Edit Start Scripts-> Add Script-> find your script, double-click to add, and then close the window.
Now you need a local script for the creature. This will remove the creature once the spell effect wears off the player:
Begin AST_MountainTrollShort AIStateif ( AST_TrollEnabled == 1 ) set AIState to 10endifif ( AIState == 10 ) if ( Player-> GetSpellEffects, ast_summon_test == 0 ) PlaySound, "conjuration hit" PositionCell, 1540, -800, 91, 000, "clutter warehouse - everything must go!" SetHealth 0 set AST_TrollEnabled to 0 set AIState to 0 endifendifend
Like I said, it's been many years and there may be a better and more efficient way of doing this.