Talk:Cast

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

--Mrflippy 00:29, 13 April 2006 (EDT): It looks like this command may not work if the player is targeted and god mode is active. For example "activator.cast FlippySpell player" doesn't seem to be working with god mode active.

--Kkuhlmann 08:41, 13 April 2006 (EDT): All bets are off if you're in god mode. Don't test your scripts while in god mode...

Stalker 13:16, 17 April 2006 (EDT) This doesn't seem to work on containers god mode or not.


--Blackblade 20:35, 16 November 2006 (EDT) Is there a way to cast target spells without an Refrence?

It depends what you mean. If its an AoE spell, just place an invisible activator and have it cast the spell at the player; or, place a tiny corpse near the activator and use that as the target of the spell.
If you want a target spell fired in a particular direction, but not at a particular reference, place two invisible activators along the path you want the spell to follow and have the first cast the spell at the second. Scruggs 04:39, 17 November 2006 (EST)

Seems that spells targeting someone else (not self) will be treated as touch spells. As such, if the command is used on an npc to cast a "ranged spell" (target instead of touch or self), the npc would walk up to the target and cast the spell instead, or else it would just continue pursue. This was explained to me by Xcom. Any idea on how to fix this? Without possibly doing something similar to what Scruggs suggested above? (for another situation, which might also benefit this) Reinhartmenken 23:47, 7 December 2006 (EST)

Yeah, that's really annoying, especially since if an NPC is too far away from the target or just isn't in the mood, he'll sometimes just ignore the Cast completely.
The only idea I have off-hand is to call Look to make the NPC face the target, tell him to play the casting animation, and then stick an activator in front of him to cast the spell at the target. Probably not what you wanted to hear.
Might be worth popping over to the OBSE Wish List to put in a request. They really do take requests into consideration, although they've got plenty to keep them busy already. Scruggs 00:55, 8 December 2006 (EST)

Dragoon Wraith TALK 16:12, 21 May 2007 (EDT): Heh, could have sworn that Casting at an Activator didn't work when I tested it... but I was trying so many different things to get it to work, so who knows. I didn't realize it was an issue with Cast until later on in my testing, so I was trying to use different things to get MoveTo/SetPos to work, assuming those were the problems with my script's horrible aim. Anyway, thanks for fixing that, mmmpld and Scruggs! Good to know about the Self range spells for the player, too.

What happens if Cast is used on the player, with a Target spell, and no target ID is supplied? Does it cast along the current heading, or does it not cast at all? Abramul 18:53, 23 October 2007 (EDT)

Just tried it - it doesn't compile... wondering about this myself. I want to be able to cast a spell at a door whenever the player presses Activate - guess I need to get the player's heading and position, move a disabled activator to the player's position, move a second activator some 200-300 units in front of the player, and cast the spell?
--Haama 23:27, 14 November 2007 (EST)

Spell casting from an object[edit source]

Something that I didn't find in any reference, and that is worth mentioning imho: Cast must be called from a reference. Items in inventories aren't references.

Wich means that any item in your inventory will not execute a cast function from within its attached script (MenuMode block, OnEquip block, etc.), and the script just moves on to the next line of code. This issue was discussed on Bethesda forum. --HawkFest 03:06, 21 January 2008 (EST)

Mm, this is true. It's true of most functions, actually. Scripted items in inventories can't actually do very much without supplying a reference.
You can use GetContainer to do what I assume you were trying to do - to get the person holding the item to cast the spell.
Or you can use a Disable, Persistent Activator to cast the spell on the Ref from GetContainer, if you want to spell to be cast on the person holding the item.
Dragoon Wraith TALK 16:20, 21 January 2008 (EST)
Added it to the article - there was a (quick) question in the forums that boiled down to this. Still not sure if cast would run if called from a non-dynamic ref in an inventory. These references stay the same whether or not in an inventory. Anyone ? UDUN 08:22, 4 April 2010 (EDT)
EDIT : quick tested - seems cast does not run even on (persistent or not) non dynamic references. GetSelf on these in an inventory still returns 0. UDUN 10:59, 4 April 2010 (EDT)
Not sure what you mean by "non-dynamic" - it just needs a reference. An object in an inventory is not a reference, and therefore will not work.
Dragoon Wraith TALK 11:30, 5 April 2010 (EDT)
I meant non FFxxxxxx form IDs. These stay the same before and after putting them in a container - but, yes, while in the container they are zeroed. Wasn't sure about this bit. UDUN 11:46, 5 April 2010 (EDT)
Items in containers do not have referecnes. You need a reference to use this function. You don't need any FF~ formID, just an actual reference.
A reference is a formID. I wrote non FFxxxxxx. This comment will destroy itself, please delete yours also - to keep these pages as clean as possible :) UDUN 08:29, 7 April 2010 (EDT)
Excuse me? Uh, no, we're not in the habit of deleting discussions on the Wiki. Having a formID does not make something a reference. Frankly, you are wrong. You don't need an FFxxxxxx formID to use Cast. You need a reference. An object in a container is not a reference, does not have a reference. None exists to cast the spell. I'm confused what the issue is.
Dragoon Wraith TALK 00:14, 8 April 2010 (EDT)