peterh0lland Posted December 18, 2018 Share Posted December 18, 2018 (edited) 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 activemagiceffectInt Property stage AutoActor Property Actor1 AutoActor Property Actor2 AutoEvent OnEffectStart(Actor Target, Actor Caster) if stage == 1 Actor2 = Target Actor2.StartCombat(Actor1) Actor1.StartCombat(Actor2) EndIf if stage == 0 Actor1 = Target stage = 1 EndIfEndEvent ======================= 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 December 18, 2018 by peterh0lland Link to comment Share on other sites More sharing options...
HadToRegister Posted December 18, 2018 Share Posted December 18, 2018 This is what I'm seeing Link to comment Share on other sites More sharing options...
peterh0lland Posted December 18, 2018 Author Share Posted December 18, 2018 (edited) This is what I'm seeing There mate, fixed it. Sorry bout that ;) Edited December 18, 2018 by peterh0lland Link to comment Share on other sites More sharing options...
foamyesque Posted December 19, 2018 Share Posted December 19, 2018 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. Link to comment Share on other sites More sharing options...
peterh0lland Posted December 19, 2018 Author Share Posted December 19, 2018 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 More sharing options...
peterh0lland Posted December 21, 2018 Author Share Posted December 21, 2018 (edited) 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 locationaaaTargetActive.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 markeraaaTargetActive.SetValue(1) Debug.Notification("Location Saved...") EndIf EndEvent ============================ Edited December 21, 2018 by peterh0lland Link to comment Share on other sites More sharing options...
Recommended Posts