Jump to content

[LE] Preventing dual summons when dual casting.


AslanKebab

Recommended Posts

Hello everyone, i have summoning spell done by script so that i can decide where the actor is placed. but my main issue is that I am trying to prevent a double summon due to dual casting with a script driven summon spell.

I tried running a check before placing the actor that checks with a FindClosestReferenceOfTypeFromRef() running before placing the actor, is not stopping this reliably as it often returns none and still spawns two actors, probably due to it being a slow and costly function and/or "script lag".

so far i have tried these variants of my code
Event OnInit()
    DuplicateRef = Game.FindClosestReferenceOfTypeFromRef(SummonActorBase, Game.GetPlayer(), fOffset * 5)
EndEvent

Event OnEffectStart(Actor akTarget, Actor akCaster)
    Debug.messagebox(DuplicateRef)
    if (DuplicateRef == none)
        SummonActor = akCaster.PlaceActorAtMe(SummonActorBase)
        Utility.Wait(0.5)
        SummonActor.Enable(true)
        SummonActor.MoveTo(akCaster, fOffset * Math.Sin(akCaster.GetAngleZ()), fOffset * Math.Cos(akCaster.GetAngleZ()), 10.0)
    else
        OnEffectFinish(akTarget, akCaster)
    endif
EndEvent

and

Event OnEffectStart(Actor akTarget, Actor akCaster)
	DuplicateRef = Game.FindClosestReferenceOfTypeFromRef(SummonActorBase, Game.GetPlayer(), fOffset * 5)
	Debug.messagebox("DuplicateRef is " + DuplicateRef)
	int aiStage
	While aiStage < 6
        aiStage += 1
    	if aiStage == 1
    		if DuplicateRef != none
    			return OnEffectFinish(akTarget, akCaster)
    		endif
    	elseif aiStage == 2
    		SummonActor = akCaster.PlaceActorAtMe(SummonActorBase)
    	elseif aiStage == 3
    		SummonActor.Disable(false)
    	elseif aiStage == 4
    		SummonActor.MoveTo(akCaster, fOffset * Math.Sin(akCaster.GetAngleZ()), fOffset * Math.Cos(akCaster.GetAngleZ()), 10.0)
    	elseif aiStage == 5
    		SummonActor.Enable(true)
    	elseif aiStage == 6
    		Utility.Wait(0.6)
    	endif
    endWhile
EndEvent

Both produce the same issue so any suggestions would be appreciated.
I am not using SKSE or Globals in the project.

Edited by AslanKebab
Link to comment
Share on other sites

You can easily solve this by making the spell to ONLY be casted by either one of both hands, right or left, and that's it.


One more alternative would be to make the script to respond to a global variable, so this way only one magick effect can be fire each time.


There is also the option to "Disallow Dual Casting", but i currently can't remember where or how exactly is that done...

Link to comment
Share on other sites

The equip type "EthierHand" does not prevent the player from casting both at once. forcing the spell to be equipped with one hand either left or right is usually only for NPC spells. i would like to avoid that when possible.

This is part of a bigger project so I am avoiding Globals completely

There is a "Disallow Spell Absorb/Reflect" and "No Dual Casting Modifications" can´t find "Disallow Dual Casting" if you can find it and tell me where,that would be very helpful.

Thanks for the response.

Edited by AslanKebab
Link to comment
Share on other sites

I meant: scripted so that it can only be used by either one of both hands.

 

"This is part of a bigger project so I am avoiding Globals completely"

If this is a part of a bigger project and you are excluding from now one of the most useful tools of CK, then you have started with very few and limited options to innovate.
* Some things can ONLY be done with 'Global Variable', and there is no workaround for this.
As i said, i can't remember right now, i'm not in front of my PC, and whenever i do sit on it... i have my own project to worry about and keep doing those stupids 'Apostrophes' in those hundreds and hundreds of lines... Sorry, but i'm going through my own mod's crisis...
Have a nice weekend.
Link to comment
Share on other sites

Alright I seem to have found a solution.

Having the isDualCasting == 0 condition on the Magic Effect does prevent one of the hands casting when the same spell is equipped in both hands.
I dismissed this as a potential solution early on thinking that isDualCasting would return true if any two spells equipped in each hand would be fired at once, this seems to only be true when two of the same spells are being cast at once including spells that needs to be equipped in both hands per default.

not sure if this is of any use to anyone but I hope it helps as there no information on how the isDualCasting condition actually works on CK wiki
https://www.creationkit.com/index.php?title=IsDualCasting

Edited by AslanKebab
Link to comment
Share on other sites

  • Recently Browsing   0 members

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