How to define a reference to a specific npc

Discussions and questions about the CS and mods for Oblivion
Post Reply
Oblis
Initiate
Initiate
Posts: 38
Joined: Fri May 18, 2007 2:07 pm
ES Games: Daggerfall, Morrowind, Oblivion
Platform: PC
Location: Greece

How to define a reference to a specific npc

Post by Oblis »

Hello,
This code is made on a triigger. The trigger will place 2 npcs I have created and assign random class on them.
The NPCs appear normally in the game but no class is assigned.
It is not working the way I have typed below.

If I use

Code: Select all

If NPC01Class == 1
NPC01.SetClass Warrior
I get error message

I actually want to declare NPC01ref to be NPC01 (NPC created in Editor) and NPC02 (NPC created in Editor).
Despite using GetSelf, GetContainer etc I want it to understand standard ref IDs.
Anyone can help?

Code: Select all

scriptname NPCtrigger

short NPC1
short NPC01Class
ref NPC01ref

short NPC2
short NPC02Class
ref NPC02ref

short Trigger

Begin OnTrigger Player

set NPC01ref to NPC01
set NPC02ref to NPC02

if Trigger == 0

Set NPC01Class to RAND 1 20
Set NPC02Class to RAND 1 20

If NPC01Class == 1
NPC01ref.SetClass Warrior
Elseif NPC01Class == 2
NPC01ref.SetClass Warlock
elseIf NPC01Class == 3
NPC01ref.SetClass Thief
elseIf NPC01Class == 4
NPC01ref.SetClass Sorcerer
elseIf NPC01Class == 5
NPC01ref.SetClass Scout
elseIf NPC01Class == 6
NPC01ref.SetClass Rogue
elseIf NPC01Class == 7
NPC01ref.SetClass Priest
elseIf NPC01Class == 8
NPC01ref.SetClass Nightblade
elseIf NPC01Class == 9
NPC01ref.SetClass Mage
elseIf NPC01Class == 10
NPC01ref.SetClass Knight
elseIf NPC01Class == 11
NPC01ref.SetClass Hunter
elseIf NPC01Class == 12
NPC01ref.SetClass Conjurer
elseIf NPC01Class == 13
NPC01ref.SetClass Agent
elseIf NPC01Class == 14
NPC01ref.SetClass Acrobat
elseIf NPC01Class == 15
NPC01ref.SetClass Assassin
elseIf NPC01Class == 16
NPC01ref.SetClass Barbarian
elseIf NPC01Class == 17
NPC01ref.SetClass Bard
elseIf NPC01Class == 18
NPC01ref.SetClass Healer
elseIf NPC01Class == 19
NPC01ref.SetClass Monk
elseIf NPC01Class == 20
NPC01ref.SetClass Archer
endif

....
....

NPC01Marker.placeatme NPC01 1,1,1
NPC02Marker.placeatme NPC02 1,1,1
message "Followers have been created!"

set Trigger to 1
endif
end
Post Reply