PDA

View Full Version : Hostile script question


kdsphantom
10-18-2005, 03:48 PM
Hello,
I am trying to use this script to change the faction of a creature, after you talk to them, using the dialog to fire this script.

void main()
{
object oNPC= GetObjectByTag("n_devaronian01");
ChangeToStandardFaction(oNPC, 1);
SetMinOneHP(oNPC, TRUE);
//SetMaxHP(oNPC, TRUE); dunno syntax to heal guy//
AdjustAlignment( GetFirstPC(),ALIGNMENT_LIGHT_SIDE,5);
//ChangeToStandardFaction(OBJECT_SELF, STANDARD_FACTION_HOSTILE_1)
}

the 2nd line doesnt seem to change n_devaronian01 's faction to hostile to me and fight me, nor the 3rd line set him to min 1 hp. The script compiles, and fires after the dialog, I get the Light side points but doesnt seem to affect n_devaronian01. By tag means ResRef correct? As in n_devaronian01.utc

The last line, if, when I use Object_self it if I understand this right, changes my the PC faction to hostile with who i dunno, but when that line is active it does turn us hostile, and why I know line 3 doesnt work as i can kill him.

But I dont know why it does turn him hostile and line 2 and 3 dont work.

The middle line SetMaxHP, after the fight id like n_devaronian01 to be healed, but I dont know the syntax command.

Any help would be great ) thank you
kdsphantom

stoffe
10-18-2005, 04:19 PM
Hello,
I am trying to use this script to change the faction of a creature, after you talk to them, using the dialog to fire this script.
(snip)
object oNPC= GetObjectByTag("n_devaronian01");
(snip)


Make sure that the Tag of the creature actually is n_devaronian01. It looks like that would be the ResRef (filename) and not the Tag if it's based on the standard template (n_devaronian01.utc) with that name in the game. If that's the case the tag would simply be Devaronian instead. Check the Tag field in the UTC to be sure.

kdsphantom
10-18-2005, 05:06 PM
@ stoffe -mkb-
as ever thank you much, I just knew i was doing something wrong
in the other scripts and events I had run for some reason the TAG field had happened to be the same as the resref. So they of course worked, but thank you so much for pointing out where I went wrong ).
I thought that I read/ seen that you used ResRef, but you have no idea how happy I am that you solved/ explained this to me ).
kdsphantom

The Source
10-19-2005, 09:40 AM
Hello,
I am trying to use this script to change the faction of a creature, after you talk to them, using the dialog to fire this script.

Within the DLGEditor, you can enter the following:
In the script box enter one of the following:

a_attackonend <--Will work 100% of the time.

or

a_hostile <-- Will work on only a limited number of levels.

(You must place one of them in the last dialogue's options when using DLGEditor. When I get home latter, I will check to make sure my instructions ar correct. However, those are the two scripts that will work.)

kdsphantom
10-19-2005, 02:06 PM
Thank you MacLeodCorp
as you can tell im really green on scripts, still learning how to use the tools and everything. But this will help me that is for sure.
kdsphantom

The Source
10-19-2005, 02:38 PM
Explination: Just in case...

When using the DLG Editor:
1. Type in your dialogue lines.
2. While having the last dialogue selected, type: a_attackonend or a_hostile in either: Script #1 or Script #2.

(There will be no parameters, or any other information necessary.)

In game:
At the end of your conversation with your new NPC, the script will change the alignment of the character. Therefore, they will instantly attack. Within the Script #1 and Script #2 boxes, you can set any type of script that comes from the .nss files. As long as the script is either in the main portion of the file structure, or extracted and added to a new module, then the script will have no problem launching. See the .nss files for more information about what needs to be added for parameters.