Problem with magic effect script...

Post » Sat Sep 27, 2014 5:08 pm

Why hello there.

I try to script a frost spell but unfortunately I encountered a problem.

A comrade already made some good suggestions, still I haven't found any clean ways to script that spell.

First of all:

There is a initially spell which also uses a normal frost damage function from the destrcution school.

However there is also a probability of 18% that the target gets restrained (frozen).

Formerly this was solved by using "ScriptEffectStart" for setting the target to restrained and making it normal in the "ScriptEffectEnd" block.

But the problem is that with that behaviour the restrained effect is cleared if the spell is casted another time on the target and the probability failed.

So it was suggested to make another spell which controls the restrained effect with a timer.

This is the code of the first spell:

Spoiler
scn SpellEinfrieren18ProzentShort WahrscheinlichkeitRef Targetbegin ScriptEffectStart;InitialisierungSet Target to GetSelf;Kontrolleif (Target.isActor == 0) || (Target.getDead == 1)  || (Target.isRidingHorse == 1)    Returnendif;StartSet Wahrscheinlichkeit to 1 + GetRandomPercentIf ( Wahrscheinlichkeit <= 88 ) ;==>Indeed this aren't 18%. It's set up for testing.;    Target.Setghost 1    if Target.IsSpellTarget 1Frostpfeil || Target.IsSpellTarget 2Frostpfeil        Target.AddspellNS Eingefroren4Sek    elseif Target.IsSpellTarget 3Frostpfeil || Target.IsSpellTarget 4Frostpfeil        Target.AddspellNS Eingefroren5Sek    elseif Target.IsSpellTarget 5Frostpfeil || Target.IsSpellTarget 6Frostpfeil || Target.IsSpellTarget 7Frostpfeil        Target.AddspellNS Eingefroren6Sek    endif    if Target == Player        Message "Sie wurden eingefroren!"    else        MessageEX "%n wurde eingefroren." Target    endifendifend

Now there is the code for the actually freezing spell:

Spoiler
scn SpellEingefroren4SekEffektfloat ErstarrungsdauerRef Targetbegin ScriptEffectStart;SicherheitSet Target to GetSelfif Target.IsSpellTarget 1Frostpfeil == 0 && Target.IsSpellTarget 2Frostpfeil == 0    Set Erstarrungsdauer to -1    Target.Dispel Eingefroren4Sekendif;InitialisierungSet Erstarrungsdauer to 0;Startif Target.GetRestrained == 0    Target.PlayMagicShaderVisuals effectGefrohren    SetRestrained 1endif    if Target == Player        DisableControl 15        DisableControl 18        DisableControl 19        DisableControl 20        DisableControl 20        DisableControl 21        DisableControl 22        DisableControl 23        DisableControl 25    endifEndBegin ScriptEffectUpdate    if Erstarrungsdauer < 4 && Erstarrungsdauer != -1        Set Erstarrungsdauer to Erstarrungsdauer + ScriptEffectElapsedSeconds    else        Set Erstarrungsdauer to -1        if Target == Player            EnableControl 15            EnableControl 18            EnableControl 19            EnableControl 20            EnableControl 21            EnableControl 22            EnableControl 23            EnableControl 24            EnableControl 25                endif        SetRestrained 0        Target.RemoveSpell Eingefroren4Sek    endifEndBegin ScriptEffectFinish        Target.StopMagicShaderVisuals effectGefrohrenEnd

The spell is a magic ability since an illness can be transfered to the player by a simple attack of the enemy.

Somehow that code really works (it was mostly done by my comrade) but it is a very bad and unclean solution.

Since the problem is that by every new spell hit the script effect stops which actually makes me wonder that it even progress another time.

Also the spell doesn't restart if it is applied once more due a successful 18% probability.

Sometimes the magic ability even stays on the target and doesn't get cleared so there are many safety system necessary that this effect doesn't occur when it shouldn't (as seen in the start block).

Is there any way to do this cleaner?

Cheers

User avatar
Stu Clarke
 
Posts: 3326
Joined: Fri Jun 22, 2007 1:45 pm

Post » Sat Sep 27, 2014 12:10 pm

So, to summarize, you would like a spell that does the usual frost effect damage but also has an 18% chance of freezing the target, meaning that the target is paralyzed? And if the spell is cast again, it shouldn't free the target if it was already paralyzed?

User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Sat Sep 27, 2014 12:27 pm

Exactly.

But I don't like a normal "paralyze effect" instead I would like to use SetRestrained 1.

That's the big problem here :(

I tried many weird stuff even quest scripts instead of another magic effect which controls the restraind effect.

The script from above is unclean since often the update block is stopped and the target doesn't lose it's magic ability of being frozen.

However it still wakes up after the correct time somehow still it isn't a good solution.

On the other side it would be good if another success is increasing the already running timer.

For now the script only fixes the problem that the target is freed again but it produces much other dirty stuff including the problem that the timer doesn't get updated due a new freezing success.

So I would really appreciate any better solution than this :smile:

User avatar
xemmybx
 
Posts: 3372
Joined: Thu Jun 22, 2006 2:01 pm


Return to IV - Oblivion