morogoth35 Posted September 30, 2017 Share Posted September 30, 2017 (edited) Hi guys I am trying to make a simple polymorph spell but I get a compiler error with the script and I hope you might know what is wrong with it. Here is the script: Scriptname PolymorphScript extends ActiveMagicEffect Race Property PolymorphRace Auto String DefaultRace Event OnEffectStart(Actor akTarget, Actor akCaster) If (akTarget.GetActorBase().GetRace() != PolymorphRace) Debug.Notification("The spell hit the target.") DefaultRace = akTarget.GetRace() akTarget.SetRace(PolymorphRace) EndIf EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) Debug.Notification("Target was returned to its default race.") akTarget.SetRace(DefaultRace) EndEvent Here is the compiler error: (20,10): type mismatch on parameter 1 (did you forget a cast?) Edited September 30, 2017 by morogoth35 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 30, 2017 Share Posted September 30, 2017 You have DefaultRace defined as a string but are trying to use it as a Race. Redefine it as a Race and it should work. i.e.change String DefaultRaceinto Race DefaultRace Link to comment Share on other sites More sharing options...
morogoth35 Posted September 30, 2017 Author Share Posted September 30, 2017 Thanks that worked. Link to comment Share on other sites More sharing options...
Recommended Posts