Jump to content

[Template] Perform action based on target's race


hextun

Recommended Posts

Posted
set $actor_race resultfrom actor_race $system.self ""

if $actor_race &= "High Elf"     [Altmer]
if $actor_race &= "Argonian"     [Argonian]
if $actor_race &= "Wood Elf"     [Bosmer]
if $actor_race &= "Breton"       [Breton]
if $actor_race &= "Dark Elf"     [Dunmer]
if $actor_race &= "Imperial"     [Imperial]
if $actor_race &= "Khajiit"      [Khajiit]
if $actor_race &= "Nord"         [Nord]
if $actor_race &= "Orc"          [Orsimer]
if $actor_race &= "Redguard"     [Redguard]

msg_console $"{$system.currentScriptName}: unhandled race {$actor_race}"
goto [end]

[Altmer]
; do Altmer thing
goto [end] 
[Argonian]
; do Argonian thing
goto [end] 
[Bosmer]
; do Bosmer thing
goto [end]
[Breton]
; do Breton thing
goto [end]
[Dunmer]
; do Dunmer thing
goto [end]
[Imperial]
; do Imperial thing
goto [end]
[Khajiit]
; do Khajiit thing
goto [end]
[Nord]
; do Nord thing
goto [end]
[Orsimer]
; do Orsimer thing
goto [end]
[Redguard]
; do Redguard thing

[end]

 

  • 6 months later...
Posted

Thanks for sharing these templates, this one look interesting as it could give a wide variety of outcomes in the one trigger.  How would I format it if I had other custom races or races like Dremora, Golden Saints, etc.  It looks like the Full name record for the race is being used based on what is in the left = section at the top and a label is being matched to that for scripting.  I don't see the editor ID or the form ID being used here.  My plan to adapt my own version of this template is to use it to give unique messages with flavor text from the actor and a gift from them matching the race background.  So I guess my question is, am I on the right track with that.  To expand this am I finding full name records, matching labels (of my own creation or finding these tags somewhere??) and adding to the basic goto/end arguments at the bottom of the script?  

Posted
4 hours ago, Temmerian said:

Thanks for sharing these templates, this one look interesting as it could give a wide variety of outcomes in the one trigger.  How would I format it if I had other custom races or races like Dremora, Golden Saints, etc.  It looks like the Full name record for the race is being used based on what is in the left = section at the top and a label is being matched to that for scripting.  I don't see the editor ID or the form ID being used here.  My plan to adapt my own version of this template is to use it to give unique messages with flavor text from the actor and a gift from them matching the race background.  So I guess my question is, am I on the right track with that.  To expand this am I finding full name records, matching labels (of my own creation or finding these tags somewhere??) and adding to the basic goto/end arguments at the bottom of the script?  

 

You're correct. :) If you open xEdit and find the Race record you are interested in, you can use its NAME attribute, which is what will be returned from actor_race for actors of that race.

 

In fact, you could technically do this:

 

set $actor_race resultfrom actor_race $system.self ""

goto $actor_race
; if you got here, the goto failed because a matching label for the race could not be found
msg_console $"{$system.currentScriptName}: unhandled race {$actor_race}"
goto [end]

[High Elf]
; do Altmer/High Elf thing
goto [end]
;...
[Dremora]
; do Dremora thing
goto [end]

[end]

 

I'm not sure why I didn't recommend that in the first place. Doing it this way means fewer if checks in cases where the race in question is further down the list.

  • Recently Browsing   0 members

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