Jump to content

Scripting Assistance Needed


Darkfirebird

Recommended Posts

Hey all. Curious to know how I can make a Scripted Ability on the Player to automatically apply a script. Like Midas' Magic mod with his Detection Spell. I want to make it as an Aura type thing though. I have a few mods running with new Creatures and NPCs, I rather not edit them all to include a script to make it work. So, I do know I need ScriptEffectStart and ScriptEffectUpdate but I cannot get it to tag the NPCs / Creatures, Just usually me. I kinda got mad and deleted it all the way seeing it didn't work as I wanted it to. It works fine as a Cast Spell and normal AoE Spell seeing it gets it own target, but I want to test it as an Aura. ( Kinda like Diablo 2 Lord of Destructions Holy Fire Paladin Aura and the likes. ) Anyone have any ideas how to accomplish this?

 

Example:

scn TestAuraSpellScript

ref target

Begin ScriptEffectStart ; set up what is hit
  set target to GetSelf
End

Begin ScriptEffectUpdate ; dont bother with anything over the distance of 50000
  set target to GetSelf ; update what is around player
  if target.GetDistance player > 50000
     return
  endif
End

Begin OnDeath Player 
; Killed by player. though i don't think this is needed here 
; need a way to figure the affected is killed by Player
  removeallitems ; test to see if script applied all the way even when killed 
End

 

Not the real code. ( Not that I have it anymore XD )

Quick example of what I want it to do as an Aura.

 

Any help is appreciated!

Link to comment
Share on other sites

I can't think of a way of determining if someone is killed by the player without an Object script, (Only ScriptEffectStart/Update/Finish are allowed for Magic Effect scripts) but the traditional method of producing "Aura" effects is to repeatedly cast an AoE Script Effect spell on the player via activator (a tutorial for casting spells from an activator can be found here. So the script on the player would go something like...

 

Begin ScriptEffectUpdate

  if (timer < 10)
  MyActivator.Cast MyAoESpell self
  set timer to 0
  else
  set timer to timer + 1
  endif
end

Link to comment
Share on other sites

I can't think of a way of determining if someone is killed by the player without an Object script, (Only ScriptEffectStart/Update/Finish are allowed for Magic Effect scripts) but the traditional method of producing "Aura" effects is to repeatedly cast an AoE Script Effect spell on the player via activator (a tutorial for casting spells from an activator can be found here. So the script on the player would go something like...

 

Begin ScriptEffectUpdate

  if (timer < 10)
  MyActivator.Cast MyAoESpell self
  set timer to 0
  else
  set timer to timer + 1
  endif
end

 

That does work out but if the Aura is on the player... well this wouldn't be too helpful. Perhaps using OBSE could help but I don't know. Perhaps having the 'Aura' add a special ability that adds the OnDeath Script. But I am not sure how to do this. The Activator casting the spell is a start though. Maybe having it add the Ability with the script could work. Doing this, this way, would likely change how big the file is. If I change the Activator to MoveTo player every 5 seconds, would that hit performance at all?

Link to comment
Share on other sites

Alright. So far I have this for the Ability to add.

SCN CMFXPSpellScript

ref self
short MyLvl
short PLvl
short XPGained

Begin ScriptEffectStart
set self to GetSelf
set MyLvl to self.GetLevel
set PLvl to Player.GetLevel
End

Begin ScriptEffectUpdate
set self to GetSelf
set MyLvl to self.GetLevel
set PLvl to Player.GetLevel
End

Begin OnDeath Player
if MyLvl == PLvl
Set XPGained to + ((MyLvl*5+45)*(1+PLvl))*CMFXPMult
Set CMFCurXP to CMFCurXP + XPGained
Message "You gained %0.f experience." XPGained
elseif MyLvl > PLvl
Set XPGained to ((MyLvl*5+45)*(1+PLvl*0.05))*CMFXPMult
Set CMFCurXP to CMFCurXP + XPGained
Message "You gained %0.f experience." XPGained
elseif MyLvl < PLvl && MyLvl < ( PLvl - 9 )
Message "This Creature / NPC is worth no experience."
elseif MyLvl < PLvl
Set XPGained to ((MyLvl*5+45)*(1-PLvl*0.05))*CMFXPMult
Set CMFCurXP to CMFCurXP + XPGained
Message "You gained %0.f experience." XPGained
endif
End

 

CMFCurXP and CMFXPMult are Globals ( Also have CMFMaxXP but for a seperate script to do the Level Up )

 

Thought I would try to make my own EXP version of Oblivion but WITHOUT modifying the NPCs / Creatures. The EXP Formula is based on WoW atm lol.

Link to comment
Share on other sites

You could always use GetSelf to check if the subject is the player, and dispel it if so. You can check if the subject is dead using GetDead (Probably in a ScriptEffectFinish block. Dead people have everything on the dispelled). I can't think of a reliable way to check if the player is doing the killing, though...

 

While you can add scripts with OBSE, the function isn't actually finished, and it isn't really a good idea to use it for released mods. And even if it was, it would overwrite the scripts the beings already had...

Link to comment
Share on other sites

You could always use GetSelf to check if the subject is the player, and dispel it if so. You can check if the subject is dead using GetDead (Probably in a ScriptEffectFinish block. Dead people have everything on the dispelled). I can't think of a reliable way to check if the player is doing the killing, though...

 

While you can add scripts with OBSE, the function isn't actually finished, and it isn't really a good idea to use it for released mods. And even if it was, it would overwrite the scripts the beings already had...

 

So far I been testing... But the Activator wont load nor the Interior with it... So im redoing it using Oblivion.esm instead of blank. Will get back to ya

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...