Jump to content

Need help about script about CastSpell for "aimed" and "target location"


Chronepsys

Recommended Posts

Hi all,

 

long time not coming here in need of help.

hope you all feel good.

 

I am working on a script which should cast random spell on an event.

At first i was looking for "when attacking" but it seem more complex so i am doing with a cast when hitting the target.

 

However, with spells that are "aimed" it works fine, but i wish to use it with a "target location" spell and the spell doesn't cast.

 

If someone can help me a bit please.

 

Here is my actual code.

He is attached to a 1h sword.

 

 

 

Scriptname vMaelstromScript extends activemagiceffect
Spell Property Spell1 auto ;Should be targetlocation spell
Spell Property Spell2 auto ;Aimed spell
Spell Property Spell3 auto ;Aimed spell
Spell Property Spell4 auto ;Aimed spell
Spell Property Spell5 auto ;Aimed spell
Spell Property Spell6 auto ;Aimed spell
Spell Property Spell7 auto ;Aimed spell to cast on friendly target
actor caster
actor target
Event OnEffectStart(Actor akTarget, Actor akCaster)
caster = akCaster
target = akTarget
if target.isHostileToActor(caster)
int randy = Utility.RandomInt(1, 100)
if (randy >= 84)
Spell1.Cast(akCaster, akTarget)
elseif (randy >= 68)
Spell2.Cast(akCaster, akTarget)
elseif (randy >= 52)
Spell3.Cast(akCaster, akTarget)
elseif (randy >= 36)
Spell4.Cast(akCaster, akTarget)
elseif (randy >= 20)
Spell5.Cast(akCaster, akTarget)
else
Spell6.Cast(akCaster, akTarget)
endif
Else
Spell7.Cast(akCaster, akTarget)
Endif
Endevent

 

I assume that the "actor" and the "target" are needed for Aimed spell but, i wonder what needs a "target location" one to be cast.

 

Hoping for your help.

Edited by Chronepsys
Link to comment
Share on other sites

What do you mean exactly by 'target location', a conjure spell, a rune spell or something else made by you that requires a target to function correctly?.


* When the function 'cast' is used on actors, the spell casted will always be in front (0 degree in Z axe) of the actor, you can't direct /aim where the spell will be casted to, this works ONLY on objects / non actors.

So, the function:



Spell1.Cast(akCaster, akTarget)


will never work if you expect for the actor to cast the spell to a specific 'akTarget'.


** The only circustance were 'akTarget' will work when used on actors is when the spell is directed to the caster itself as the target, for example:



Spell1.Cast(akCaster, akCaster)


where the second akCaster is the akTarget.


If you need the actor to fire a spell when you are using a specific weapon, then you don't attach the script to the weapon, but to the actor through the weapon (while the weapon gets equipped).


If you are aiming for something like the 'Bloodskaal' projectile effect, then you have taken the wrong approach.

Edited by maxarturo
Link to comment
Share on other sites

Hi Maxarturo,

 

Ok, i understand so that the spells with which the script works are only working by luck...

 

You, right about bloodskall. I first looked for same script, found them on the net but no try gets work.

So i came back to this script which gave me more result.

 

In very first place, i was planning to make a script that cast a spell when a power attack is triggered.

One spell for forward, another for backward, again another for left, a fourth one for right and a last one for standing.

 

I guess i must go back after "bloodskall" type of script and work about to understand why i did not get result with them before.

Will you be ok for me to come back here asking you help in this, when i will be lost ? (and i know i will :pinch:)

Link to comment
Share on other sites

Hi Chronepsys.


Yes, no problem, just keep in mind that, if I don't reply immediately is because I work like crazy and I've a very f***** up work schedule, but I'll reply the minute I've some free time in front of my pc.


Also, if you want some assistance you need to tell me with what kind of weapon you are trying to achieve this, because if you will be using the 'Bloodskal' scripts, that set up works ONLY with 2h sword weapons and will not work with any other weapon.

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...