Jump to content

Multiple Combat Actors Script


Rizalgar

Recommended Posts

It's okay! Just tell me, "Riz, just stop bro, go do something with your life."

 

Well, I'm not going to.

 

Anyhow, as it states, I'm trying to get multiple combat targets inside a script. From Googling I've seen that it'd most likely require an OnUpdate function, but they're so vague about how to do this, but that's also not the only problem I'm having. So here goes...

 

 

- What I'm trying to do -

 

Create a spell, that when cast, freezes nearby actors in place.

 

- What's the problem? -

 

I can't get it to track more than one target.

When the initial damage spell is cast (which is a scripted spell, not a straight out the box frost spell) it's supposed to drop an activator that casts the Freeze spell on the enemies, this is also not working.

 

- What have I done so far? -

 

Made the scripted damage spell, which works on a single target, but not multiple enemies.

Made the scripts for both activators. Yep, both.

Made the activator, placed randomly in the world, to be called upon on cast.

 

- Why not just make a regular Frost spell and use Area of Effect and Slow? -

My spells magicka cost and damage come from two global variables, so this would not work for me.

 

Here's the scripts, point out my ignorance!

 

Damage script

 

 

Scriptname Wow_SS_FrostNova extends activemagiceffect  
{Main script for frost nova}

Actor Property PlayerRef Auto
GlobalVariable Property Wow_Att_Intellect Auto
GlobalVariable Property Wow_Stat_SpellPower Auto
GlobalVariable Property Wow_Stat_Haste Auto
GlobalVariable Property Wow_Stat_Crit Auto
MiscObject Property Wow_FrostNovaGem Auto

Actor Target2
Actor Target3

Event OnEffectStart(actor caster, actor target)

	Int Intellect = Wow_Att_Intellect.GetValue() as Int
	Int SpellPower = Wow_Att_Intellect.GetValue() as Int
	Int CritChance = Wow_Stat_Crit.GetValue() as Int
	
	Int Crit = Utility.RandomInt(1, 100)
	
	Float ManaMax = Game.GetPlayer().GetActorValue("Magicka")
	Float ManaCost = ((ManaMax / 100) * 2)
	Float Damage = SpellPower * 0.79
	Float CritDamage = Damage * 2
	
	If PlayerRef.GetActorValue("Magicka") < ManaCost
		;Do nothing
	Else
		PlayerRef.DamageActorValue("Magicka", ManaCost)	
		PlayerRef.PlaceAtMe(Wow_FrostNovaGem)
		If CritChance > Crit
			caster.DamageActorValue("Health", CritDamage)
			If PlayerRef.GetCombatTarget() != Target2
				Target2 = caster
				caster.DamageActorValue("Health", CritDamage)
				If PlayerRef.GetCombatTarget() != Target3
					Target3 = caster
					caster.DamageActorValue("Health", CritDamage)
				EndIf
			EndIf
		Else
			caster.DamageActorValue("Health", Damage)
			If PlayerRef.GetCombatTarget() != Target2
				Target2 = caster
				caster.DamageActorValue("Health", Damage)
				If PlayerRef.GetCombatTarget() != Target3
					Target3 = caster
					caster.DamageActorValue("Health", Damage)
				EndIf
			EndIf
		EndIf
	EndIf
	
EndEvent

 

 

 

The Frostnovagem to be dropped on cast script

 

 

Scriptname Wow_SS_FrostNova2 extends ObjectReference  
{Script that freezes the enemies}

Actor Property PlayerRef Auto
ObjectReference Property Wow_Frostnova_Invisibile Auto

Event OnLoad()

	ObjectReference Nova = Wow_Frostnova_Invisibile as ObjectReference
	Self.PlaceAtMe(Wow_Frostnova_Invisibile)
	Wow_Frostnova_Invisibile.Enable()
	
	
	Utility.Wait(2.0)
	
	Self.Disable()
	Self.Delete()
	
EndEvent

 

 

 

The activator that should cast the spells at up to three targets script

 

 

Scriptname Wow_SS_FrostNova3 extends ObjectReference  
{Needed}
Actor Property PlayerRef Auto
Spell Property Wow_Spell_FrostNova2 Auto
Actor Target1
Actor Target2
Actor Target3

Event OnLoad()
	Target1 = PlayerRef.GetCombatTarget()
	Wow_Spell_FrostNova2.Cast(Self, Target1)
	If PlayerRef.GetCombatTarget() != Target2
		Target2 = Target1
		Wow_Spell_FrostNova2.Cast(Self, Target1)
		If PlayerRef.GetCombatTarget() != Target3
			Target3 = Target1
			Wow_Spell_FrostNova2.Cast(Self, Target1)
		EndIf
	EndIf

	Utility.Wait(1.0)
	Self.Disable()
	
EndEvent

 

 

 

 

- Edit -

 

As far as getting multiple targets to get hit by a spell, would an OnUpdate() with StopCombat() StarCombat() set up work? It seems like a doozy to do, so an insight would be cool before I even attempted it.

Edited by Rizalgar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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