Spell-Casting from Health instead of Mana?

Post » Tue Jun 19, 2012 5:06 am

I wanted to create a "Blood Mage" perk. When the character is out of mana, he can continue casting if he wishes but it costs health instead of mana. If it is able to be how I envisioned it, the remaining magicka would be used up and then drain health (similar to how the mana bar quickly drains when you cast a spell).

I initially thought it possible because of the spell 'Equilibrium' (sacrifice health for magicka). However, when looking at the spell I notice it accomplishes its task by just damaging health and restoring magicka. So I started on creating a basic script for it.

pseudo-script

Event OnSpellCast	if (mana < spell.manaCost)		int healthcost = spell.manaCost - mana		Health = Health - healthcost		ContinueCastingSpell()	endifEndEvent

Unfortunately I'm running into obstacles with just about everything. Does anyone have a better idea of how to do this? Here are my problems more specifically...

-There doesn't seem to be an event that is called when a player casts a spell
-(if there is an event, there doesn't seem to be a way to get that spells cost)

-I can't find any way to get around the cancellation of the spell when you run out of magicka... this is why ContinueCastingSpell() is left so vague.
User avatar
Katie Pollard
 
Posts: 3460
Joined: Thu Nov 09, 2006 11:23 pm

Post » Mon Jun 18, 2012 1:30 pm

not sure that would be possible but why not create a (0 mana cost) spell that would drain the player health and convert the damage into mana and give it to player?

Detect spell cast (i knew there was one cos there isn't an equivalent for listening for swinging a weapon)
http://www.creationkit.com/OnSpellCast_-_ObjectReference

As for the spell cost, no i don't think so.
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm

Post » Mon Jun 18, 2012 2:23 pm

Thanks, that does detect when you cast the spell (which is when you release the mouse click and the spell takes effect).
It is more the equivalent for OnHit() than for listening for the swing.

When the player doesn't have enough magicka, which is when this would take effect, the OnSpellCast event does not call because the spell is not cast and "You Don't Have Enough Magicka" displays in the top-left.
So I guess my main problem is getting around the problem of spell cancellation.

I will have to try your way I think, I remember seeing a script that makes a spell cast other spells. So if I understand correctly >>
>> Player casts FireBolt
>> if Magicka < FireBoltCost -- (how would I get any augmented costs of FireBolt? like if the player is dual-casting or has an item that reduces cost?)
>>switch health for magicka
>>cast original FireBolt
User avatar
Natalie Taylor
 
Posts: 3301
Joined: Mon Sep 11, 2006 7:54 pm

Post » Tue Jun 19, 2012 4:34 am

There is a spell already in game which converts health into mana. Alteration school I think. May be worth seeing how that does stuff, but It seems that what you intend to do could work.
User avatar
Ana Torrecilla Cabeza
 
Posts: 3427
Joined: Wed Jun 28, 2006 6:15 pm

Post » Mon Jun 18, 2012 7:35 pm

There is a spell already in game which converts health into mana. Alteration school I think. May be worth seeing how that does stuff, but It seems that what you intend to do could work.

the spells name is equilibrium.
i agree that it might be helpful to look into that one...
User avatar
Sheeva
 
Posts: 3353
Joined: Sat Nov 11, 2006 2:46 am

Post » Mon Jun 18, 2012 5:22 pm

Actually what I'd be interested in is the reverse effect. Would it be possible to create a mana shield absorbing x% of the damage and apllying that to mana instead of health. I gues that'd be super useful for mages.
User avatar
Tania Bunic
 
Posts: 3392
Joined: Sun Jun 18, 2006 9:26 am

Post » Mon Jun 18, 2012 9:58 pm

Add a perk to the player. The perk implements an ability spell. The ability spell applies two effects. One effect is to restore magicka. The other is to drain health. Each effect checks for the following target conditions ...

http://www.creationkit.com/GetActorValue
http://www.creationkit.com/IsCasting
http://www.creationkit.com/GetCurrentCastingType

The only issue might be ensuring magicka restores at a fast enough rate. You would likely want this only for concentration spells.
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm


Return to V - Skyrim