I m trying to make a random class generator for a bunch of NPCs i made for my mod.
For example:
When the player walks through a trigger, the game will roll random numbers and get a result of 1 to 4. Accoring to that number the NPC will get a different class.
But i really dont know how i can call the ID of that NPC. I mean how to tell the script to change the class of the first NPC.
I made the script below so far but is not working. My game dont crash but not class change occurs.
Attention: NPC is not in game world that moment. He will spawn to the world later, having the class i have rolled for him.
I m using .GetOwner but i dont think its right.
My NPC ID is "PC01"
Can anyone help me plz?
scriptname NPCClasstrigger
short PC01class
ref NPC01
Begin OnTrigger Player
set PC01class to Rand 1 4
set NPC01 to PC01.GetOwner
if PC01Class == 1
NPC01.SetClass Crusader
message "Crusader"
elseif PC01Class == 2
NPC01.SetClass Warrior
message "Warrior"
elseif PC01Class == 3
NPC01.SetClass Warlock
message "Warlock"
elseif PC01Class ==4
NPC01.SetClass Thief
message "Thief"
endif
End