Where are scripts stored for game magic effect ranges?

Post » Mon Aug 01, 2011 8:54 pm

I was wondering where Bethesda stored its scripts for spell ranges like "self" "touch" and "target". I am trying to script a spell that only has a certain range. Like a fire ball that only goes 20 feet before disappearing. I could only see this working is if I create a touch spell that explodes w/ no target. The script would mimic the script of the Bethesda's "target" script with a simple frame counter if command attached to it. But I have no idea how I would replicate the "target" effect. Any insight would be appreciated.

Thanks!

edit: I am testing a variable damage fire ball script I made and I am wondering why this spell won't flag a murder as a murder and just as an assault.
It has one scripted effect (target; 5 area; hostile) and a stunted magicka on self. The script is as follows:

ref target
short damage

begin ScriptEffectFinish
_ set target to GetSelf
_ set damage to ( GetRandomPercent * 36 / 100 ) + 67
_ set damage to damage * ( 100 - target.GetActorValue ResistMagic )
_ set damage to damage / 100
_ set damage to damage * ( 100 - target.GetActorValue ResistFire )
_ set damage to damage / 100
_ set damage to 0 - damage
_ target.ModActorValue2 Health damage
_ return
end

To test the spell, I went on a rampage in the Imperial City and I would get a bounty of 40 each time I killed someone and it would be marked as an assault in the stat page instead of a murder.

edit2: I switched the blocktype to ScriptEffectStart and went on another rampage but it is still not counting a kill even though the target ends up dead.

edit3: I am going to need to rephrase my question because it may all be for nothing in the end anyways.

Is it possible to be responsible for a "kill" in a magic script? My character is getting charged for assault because it is a "hostile" script, but when the script ends up killing the target, it does not record as a kill on the status screen or charged with murder. Is so, why do Bethesda's scripts count as murders. For example if you were to use a spell that does Bethesda's fire damage, why can you kill someone but not when you write your own spell. I must be missing something. So if anyone can point me to where Bethesda's spell scripts are so I could look at how they do it, I would be most grateful or if you happen to know why I am welcome to any advice. Thanks again!

edit4: Sorry for so many edits, I am just learning more and more about the editor and running into new solutions and problems and testing them out. Well I figured out a workaround by doing an if IsActorEvil command and check if the actor is in each faction in a similar manor and ModCrimeGold by iCrimeGoldMurder and SetPCFactionMurder. I would prefer not to do this however, because it would be incompatible with any factions that are not in the original game and I would imagine there must be a way to do this because Bethesda's "fire damage" works with factions from other mods right?
User avatar
Kelsey Anna Farley
 
Posts: 3433
Joined: Fri Jun 30, 2006 10:33 pm

Post » Tue Aug 02, 2011 3:10 am

I'm not certain, but there may be a difference between the instant damage effect most built-in spells have and the "over time" ones in the way they're treated for crime purposes. My understanding is that the player is responsible for the instant damage when the spell or weapon strikes, but not the remainder that continues to affect the victim. So if the strike kills, it's a murder, but if the poison or other damage takes its time to kill, it's just an assault.
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Tue Aug 02, 2011 2:18 am

Also, magic effects are pretty annoying. Those, along with Black Soul Gems, Azura's Star and the Skeleton Key, are pretty much some of the only hard coded stuff in the game. The thing is, stock spells (with the exception of special quest spells) aren't scripted. They are hard coded as magic effects in the engine, so the way they behave can't be observed by scripts, as they simply aren't scripts.
User avatar
Amelia Pritchard
 
Posts: 3445
Joined: Mon Jul 24, 2006 2:40 am

Post » Tue Aug 02, 2011 4:02 am

edit: I am testing a variable damage fire ball script I made and I am wondering why this spell won't flag a murder as a murder and just as an assault.
It has one scripted effect (target; 5 area; hostile) and a stunted magicka on self. The script is as follows:

ref target
short damage

begin ScriptEffectFinish
_ set target to GetSelf
_ set damage to ( GetRandomPercent * 36 / 100 ) + 67
_ set damage to damage * ( 100 - target.GetActorValue ResistMagic )
_ set damage to damage / 100
_ set damage to damage * ( 100 - target.GetActorValue ResistFire )
_ set damage to damage / 100
_ set damage to 0 - damage
_ target.ModActorValue2 Health damage
_ return
end

To test the spell, I went on a rampage in the Imperial City and I would get a bounty of 40 each time I killed someone and it would be marked as an assault in the stat page instead of a murder.

edit2: I switched the blocktype to ScriptEffectStart and went on another rampage but it is still not counting a kill even though the target ends up dead.

edit3: I am going to need to rephrase my question because it may all be for nothing in the end anyways.

Is it possible to be responsible for a "kill" in a magic script? My character is getting charged for assault because it is a "hostile" script, but when the script ends up killing the target, it does not record as a kill on the status screen or charged with murder. Is so, why do Bethesda's scripts count as murders. For example if you were to use a spell that does Bethesda's fire damage, why can you kill someone but not when you write your own spell. I must be missing something. So if anyone can point me to where Bethesda's spell scripts are so I could look at how they do it, I would be most grateful or if you happen to know why I am welcome to any advice. Thanks again!

edit4: Sorry for so many edits, I am just learning more and more about the editor and running into new solutions and problems and testing them out. Well I figured out a workaround by doing an if IsActorEvil command and check if the actor is in each faction in a similar manor and ModCrimeGold by iCrimeGoldMurder and SetPCFactionMurder. I would prefer not to do this however, because it would be incompatible with any factions that are not in the original game and I would imagine there must be a way to do this because Bethesda's "fire damage" works with factions from other mods right?

What you want about the projectile disappearing after 20 ft is complicated and I would just confuse you more if I tried to explain. About crime detection, it is far easier:
First, instead of 'ModAV2 Health (damage you want to deal)', 'use ModAVMod Health damage (damage you want to deal)', that way health can be modified in decimals, which otherwise get truncated with ModAV2.
Second, before applying the damage, do this simple check:
If target.GetAVHealth < -damage_ target.kill player  ;if the attacker is other than the player, I can tell you how to retrieve itendiftarget.ModAvMod heath damage damage

There, Kill triggers the assassination crime for , no need for all that hassle in edit4.

Note, Magic effect scripts will by default run its function on the actor they are affecting. You don't need to define the ref target as GetSelf, you can omit it and all the commands in the script effect will run on the target anyways.

Lets simplify and correct your script taking advantage of OBSE
float damagebegin ScriptEffectStartlet damage := -((GetRandomPercent*0.36)+67)*(100-(GetActorValue ResistMagic))*0.0001*(100-(GetActorValue ResistFire)) ;you can put it all in one lineIf GetAV Health < -damagekill player  ;if the attacker is other than the player, I can tell you how to retrieve itendifModAVMod Heath damage damageend

User avatar
Carolyne Bolt
 
Posts: 3401
Joined: Mon Jul 10, 2006 4:56 am


Return to IV - Oblivion