Jump to content

[LE] How To Make 1 Spell Do Multiple Things?


peterh0lland

Recommended Posts

Hi all, first let me just apologize for the terrible Topic Title, it's quite hard to describe what I want.

 

Anyway, I am trying to make a spell that allows me to make 2 Actors fight each other. The way I want my spell to operate is the first time I cast it on a target, it will store that actor in a property for later use. Then on the second cast, it will hit another Actor and make the first Actor Attack this one.

 

I have tried using a combination of If statements and Intergers to simulate "stages" (here is some code, so you know what I mean)

 

=======================

 

Scriptname aasMassCombatInteruptScript extends activemagiceffect

Int Property stage Auto

Actor Property Actor1 Auto

Actor Property Actor2 Auto


Event OnEffectStart(Actor Target, Actor Caster)

if stage == 1

Actor2 = Target

Actor2.StartCombat(Actor1)
Actor1.StartCombat(Actor2)



EndIf

if stage == 0

Actor1 = Target
stage = 1

EndIf

EndEvent

 

=======================

 

I was looking online, and some people where talking about "Custom Functions" no idea what that is, would it help?

 

Thanks in advance boyos,

 

Pete :smile:

Edited by peterh0lland
Link to comment
Share on other sites

Each instance of an active magic effect is separate, so, as you currently have it, you're only ever going to have a bunch of people in stage 0.

Yeah, I found that out during my testing. Is their anyway to get around that, and have a spell that does what I've said above?

 

Cheers Pete :)

Link to comment
Share on other sites

So I have finally figured out how to do this, I found it out just by purely messing around.

Bascially the way I did it was, by using a GlobalVarible I created to simulate the "stages" that I wanted

Using this method I have created the spell, that I was speaking about above. (but I'd rather not show that code, until its 100% finilized)

In the mean time, just incase you dont understand what I'm saying I whipped up a simple "teleport" spell. (Its not great by any means, but it does the job)

===============================

 

Scriptname aasMassCombatInteruptScript extends activemagiceffect
GlobalVariable Property aaaTargetActive Auto
ObjectReference Property locationMarker Auto
Event OnEffectStart(Actor Target, Actor Caster)
If aaaTargetActive.GetValue() == 1
;This moves the caster to the 'locationMarker'
Caster.MoveTo(locationMarker)
Debug.Notification("Teleported to Saved Location...")
;This sets the GlobalVarible (aaatargetActive) back to 0 so the next time you cast the spell; it will save your current location
aaaTargetActive.SetValue(0)
else
;This Assigns 'Caster' as the Player (not needed, I was just testing)
Caster = Game.GetPlayer()
;This moves the marker to the player (saving their location)
locationMarker.MoveTo(Caster)
;This sets the GlobalVarible (aaatargetActive) to 1, so on the next cast the if statement above will run; allowing us to TP to our marker
aaaTargetActive.SetValue(1)
Debug.Notification("Location Saved...")
EndIf
EndEvent
============================
Edited by peterh0lland
Link to comment
Share on other sites

  • Recently Browsing   0 members

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