Difference between revisions of "Talk:Magic effect scripts"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Haama
(→‎Undocumented blocktypes: Rezzing the topic)
imported>EnigmaniteZ
 
(5 intermediate revisions by 3 users not shown)
Line 16: Line 16:
:Throwing Stars 3 uses a MenuMode block on a scripted effect of a potion - it will run for a single frame. I wonder if the same is true for enchanted items that are equipped in the inventory menu? Spells and staffs won't run in MenuMode (can't cast them), don't know about Wortcraft.
:Throwing Stars 3 uses a MenuMode block on a scripted effect of a potion - it will run for a single frame. I wonder if the same is true for enchanted items that are equipped in the inventory menu? Spells and staffs won't run in MenuMode (can't cast them), don't know about Wortcraft.


:Rezzing the topic a bit, as the page was flat wrong about other blocktypes. Any other experiences, confirmations of the above?
:Rezzing the topic a bit, as the page was flat wrong about other blocktypes. Any other experiences, confirmations of the above?--[[User:Haama|Haama]] 10:56, 9 February 2008 (EST)


== Script Effect Variables ==
== Script Effect Variables ==
Line 31: Line 31:


::[[User:DragoonWraith|<font face="Oblivion,Daedric" size=3>D</font>ragoon <font face="Oblivion,Daedric" size=3>W</font>raith]] [[User_talk:DragoonWraith|<font face="Oblivion,Daedric" size=2>TALK</font>]] 22:40, 8 July 2006 (EDT): Gah, that's not going to help me very much. I need the fact that the variables are local - multiple people are going to be hit with this spell, and multiple people need to have their own, separate values for the variables. *sigh* Why on earth did Bethesda have to artificially limit script size? Alright, I can think of a... ''very'' annoying way around this. Thanks for your help.
::[[User:DragoonWraith|<font face="Oblivion,Daedric" size=3>D</font>ragoon <font face="Oblivion,Daedric" size=3>W</font>raith]] [[User_talk:DragoonWraith|<font face="Oblivion,Daedric" size=2>TALK</font>]] 22:40, 8 July 2006 (EDT): Gah, that's not going to help me very much. I need the fact that the variables are local - multiple people are going to be hit with this spell, and multiple people need to have their own, separate values for the variables. *sigh* Why on earth did Bethesda have to artificially limit script size? Alright, I can think of a... ''very'' annoying way around this. Thanks for your help.
:::[[User:EnigmaniteZ|EnigmaniteZ]] Methinks I know of...something. Does your ability set depend on an object? Maybe the spell can add an item with a script to their inventory temporarily, and use that object's script as a repository of variables? Though it would require something like This.itemref.varname and i'm not sure that works. hmm...in theory it should. I think i should try it in C++. Though it may be cumbersome and unwieldy. --2:25 Nov\30\2009
:::Never mind...doesn't work.


== Query - Multiple Summons ==
== Query - Multiple Summons ==
Line 39: Line 41:


thanks, Luis
thanks, Luis
== Determining The Caster ==
Is there any function you can use to determine who cast a scripted spell? I'm thinking something I can use like "Set casterRef To <function>", so I can generalise a spell to be able to be used by NPCs as well as the player. [[User:Innominate|Innominate]] 02:49, 15 July 2008 (EDT)
:Use a combination of [[GetScriptActiveEffectIndex]] and [[GetNthActiveEffectCaster]].--[[User:Haama|Haama]] 14:35, 15 July 2008 (EDT)
:So there's no way to do it without OBSE? I was hoping GetParentRef would work or something. Oh well. [[User:Innominate|Innominate]] 06:04, 16 July 2008 (EDT)

Latest revision as of 18:01, 30 November 2009

Script Abilities[edit source]

Is it possible to stick a script-effect spell as an ability on someone? And if so, will the scripteffectupdate spell function more or less as a gamemode block? It seems a handy way of jamming scripts onto people who already have one...Talkie Toaster 14:21, 20 April 2006 (EDT)

Yes, I use this method extensively. It works exactly like a normal spell script. ScriptEffectStart and Update process as soon as you add the ability, and scriptEffectFinish runs when you call removeSpell. It's not just useful for magic effects, but is also probably the closest thing to MW-style targeted scripts that we have. Scruggs 16:04, 29 May 2006 (EDT)

Undocumented blocktypes[edit source]

"Other block types are invalid (they will compile but the code inside them will never run)." - This is almost true. OnActivate will process in a magic effect script, which can be useful but should be used very carefully. Even after the effect ends, the onActivate block will override normal activation, so it's best to use this for permanent scripted abilities.

I found that OnHit, OnHitWith, OnMagicEffectHit, and onDeath will not process in magic effect scripts. A shame since these would be much more useful than OnActivate.

I'd be careful with using undocumented features as long as Oblivion is still updated - Bethsoft might change them on a whim and your mod will no longer work.--JOG 01:20, 20 June 2006 (EDT)

ScriptEffectUpdate appears to run in menus when time is passing ("waiting" menu and fast travel). A MenuMode block in a magic effect script will also run during those menus, but not while other menus (inventory, etc) are displayed. Scruggs 10:09, 1 August 2006 (EDT)

Throwing Stars 3 uses a MenuMode block on a scripted effect of a potion - it will run for a single frame. I wonder if the same is true for enchanted items that are equipped in the inventory menu? Spells and staffs won't run in MenuMode (can't cast them), don't know about Wortcraft.
Rezzing the topic a bit, as the page was flat wrong about other blocktypes. Any other experiences, confirmations of the above?--Haama 10:56, 9 February 2008 (EST)

Script Effect Variables[edit source]

Dragoon Wraith TALK 15:35, 8 July 2006 (EDT): I was wondering, do variables used in magic scripts become variables on the effected object? They seem to run locally (i.e. if you have the script on multiple actors, each one can record its own values for each variable), but can you access them from another script with ActorID.VarName? If not, how can you access them?

Also, if you have two scripted effects on the same actor, can they share variable data? For instance, if the first applied script had a variable "OriHealth" that was set to the Health of the actor when the script was applied, can a second spell cast on the actor also have a variable called "OriHealth", and will it have the same value as the original variable did? I assume that when a spell wears off, the variables are wiped, but what if the first effect is still working when the second one is applied? If the variables aren't the same, is there any way to set the variable in the second script to the value of the first script?

Basically, what I'm trying to do is split up a script that is too long (currently 10,060 lines, though only 70 or so will ever run at a time). An ability is added, does its part, and adds another ability on top of that that continues the script, but it needs to have the data from the first part of the script. Is there any hope?

As far as I can tell, the variables in a spell script remain separate. Typing sv while an affected NPC is selected in the console won't list any magic effect script vars, and trying to access them via show ActorID.spellVar likewise fails. I doubt very much that two different spell scripts running on the same actor and having two identically named variables would share the values of those variables; the name you give to the variable in your script may be identical, but they are processed by the game the same way variables with unique names are processed. Being in separate scripts keeps them isolated.
You can easily pass the values of the variables in the first ability script to a quest script, and have the second ability script read those values into its own variables when it starts running. Scruggs 22:05, 8 July 2006 (EDT)
Dragoon Wraith TALK 22:40, 8 July 2006 (EDT): Gah, that's not going to help me very much. I need the fact that the variables are local - multiple people are going to be hit with this spell, and multiple people need to have their own, separate values for the variables. *sigh* Why on earth did Bethesda have to artificially limit script size? Alright, I can think of a... very annoying way around this. Thanks for your help.
EnigmaniteZ Methinks I know of...something. Does your ability set depend on an object? Maybe the spell can add an item with a script to their inventory temporarily, and use that object's script as a repository of variables? Though it would require something like This.itemref.varname and i'm not sure that works. hmm...in theory it should. I think i should try it in C++. Though it may be cumbersome and unwieldy. --2:25 Nov\30\2009
Never mind...doesn't work.

Query - Multiple Summons[edit source]

How would i set up a script that would summon multiple NPC's or creatures at once, in a spell or an enchantment (eg. Staff of the Everscamp).

any tips or tutorial scripts would be greatly appreciated

thanks, Luis

Determining The Caster[edit source]

Is there any function you can use to determine who cast a scripted spell? I'm thinking something I can use like "Set casterRef To <function>", so I can generalise a spell to be able to be used by NPCs as well as the player. Innominate 02:49, 15 July 2008 (EDT)

Use a combination of GetScriptActiveEffectIndex and GetNthActiveEffectCaster.--Haama 14:35, 15 July 2008 (EDT)
So there's no way to do it without OBSE? I was hoping GetParentRef would work or something. Oh well. Innominate 06:04, 16 July 2008 (EDT)