lorg8472 Posted December 8, 2021 Share Posted December 8, 2021 (edited) I'm trying to make a weapon that starts different events depending on the race of the target.I added an explosion to the projectile and its magic effect with this simple script, but it doesn't work Scriptname prova extends activemagiceffectrace property humanrace autoEvent OnEffectStart(Actor akTarget, Actor akCaster ) race targetRace = akTarget.getrace() debug.notification("target is" + targetrace) debug.trace(targetrace) if targetRace == humanrace debug.trace("is human") debug.notification("IS HUMAN") else debug.trace("NONE") debug.notification("NONE") endif endevent The problems are : debug.notification ("target is " + targetrace) outputs "Race" instead of the actual race. the if statement always outouts "none" , even when I'm shooting humans Can anyone explain me where I'm wrong?Thanks Edited December 8, 2021 by lorg8472 Link to comment Share on other sites More sharing options...
lorg8472 Posted December 8, 2021 Author Share Posted December 8, 2021 (edited) Problem half solved.I didn't set the property accordingly in creation kit.Now the if statement works.I still don't have the actual race in the notification though. Edited December 8, 2021 by lorg8472 Link to comment Share on other sites More sharing options...
DieFeM Posted December 8, 2021 Share Posted December 8, 2021 (edited) You're passing a race record to the string, therefore it shows that it is a race, if you want to show the name of the race you should be using GetName() from F4SE, if you don't want to use script extender then you need to use a message record, a quest and an alias, then you can use a text replacement tag in your message body. In the quest you must set a reference alias with the fill type set to Specific Reference with no reference assigned and set as optional, you will fill the reference with the script right before displaying the message. In the message you must set the quest as the "Owner Quest". Let's say that your alias is named TargetActor, in the body of the message you'd write: target is <Alias.Race=TargetActor>Reference here: https://www.creationkit.com/index.php?title=Text_Replacement Then you can call your message like this: Scriptname prova extends activemagiceffect race property humanrace auto Message Property RaceMessage Auto ReferenceAlias Property TargetActor Auto Event OnEffectStart(Actor akTarget, Actor akCaster ) TargetActor.ForceRefTo(akTarget) RaceMessage.Show() race targetRace = akTarget.getrace() if targetRace == humanrace debug.trace("is human") debug.notification("IS HUMAN") else debug.trace("NONE") debug.notification("NONE") endif endevent Edited December 8, 2021 by DieFeM Link to comment Share on other sites More sharing options...
lorg8472 Posted December 12, 2021 Author Share Posted December 12, 2021 DieFem thank you very much. GetName() worked at first try. I'm still struggling a bit with the alias. But I'm confident I'll learn to use that as well Link to comment Share on other sites More sharing options...
DieFeM Posted December 12, 2021 Share Posted December 12, 2021 I've forgot to mention that for the alias method you need to tick a checkbox for it to store the actor name and therefore show it in the message, otherwise it will show just dots, but there are two very similar named options and i don't recall which one it is, stores text or uses stored text, I think that marking both should work. Link to comment Share on other sites More sharing options...
lorg8472 Posted December 13, 2021 Author Share Posted December 13, 2021 That's just what was happening, checked those two boxes and now it's working.thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts