View Full Version : Scripting Questions
Nerezza Thu, 11th Aug '05, 7:22am Hey people. I have messed around with the NWN toolset ever since I bought the game way back. But now I am seriously thinking of getting into it and releasing modules. However I have very little if not any scripting talent. For my current module I am working on I require a couple of scripts that I have no idea how to execute. So I was wondering if any of you could help me out?
The scripts I need are as follows:
1) A Script that strips the PC of equipment at the start. (So that the PC does not begin with the default armor etc)
2) A Trigger that makes it so when the player walks over a certain area, it changes the faction of a specific creature to HOSTILE .
3) My module is to end when the PC exits the dungeon. A script to end the game by walking through an area transition door is needed.
Any help with this would be greatly appreciated, and your names will be mentioned in the final credits. It would help alot if you told me exactly what to do with the scripts as well, (eg. with the faction change, wether to make a generic trigger or w/e)
Thanks guys and I hope to be able to publish my modules in the upcoming future!
- Nerezza
nerezza_lovecat@hotmail.com
Alavin Thu, 11th Aug '05, 12:28pm 1)
Put this in the OnClientEnter script under Edit -> Module Properties -> Events:
void main()
{
object oItem = GetFirstItemInInventory();
while(GetIsObjectValid(oItem))
{
DestroyObject(oItem);
object oItem = GetNextItemInInventory();
}
}
2)
Put this in the OnEnter script of a generic trigger:
void main()
{
object oCre = GetEnteringObject();
if(GetIsPC(oCre))
{
AdjustReputation(oCre, GetObjectByTag("Tag of a creature you want hostile"), -100);
}
}
3)
Put this in the OnAreaTransitionClick of your ending door:
void main()
{
ExportAllCharacters();
EndGame("");
}
That's everything. Good luck!
Nerezza Thu, 11th Aug '05, 3:28pm Wow thanks a heap Alavin, it helped heaps. However, the script to strip the PC of equipment does not appear to be functioning as intended. I looked at the script and using plain common sense, (like I said no scripting experience here -_-) I summised that yes you have given me a functioning script, but I am unsure if it is the one I need.
It's like this:
The module is designed for a newly created character, not one that is loaded in. When new characters start up they seem to be instantly equipped with default items judging by their class. It is these items I do not want to appear. Yet even with the script you provided they still seem to be present in the player inventory.
If you could find some way around this it would be great. Thanks for the help =D
P.S:
Is there a way to insert and endgame bik? I have an intro just wondering if I can use an outro.
[ August 11, 2005, 18:49: Message edited by: Nerezza ]
Alavin Thu, 11th Aug '05, 8:25pm Oops, silly mistake on my part...
void main()
{
object oItem = GetFirstItemInInventory(GetEnteringObject());
while(GetIsObjectValid(oItem))
{
DestroyObject(oItem);
object oItem = GetNextItemInInventory(GetEnteringObject());
}
}
I forgot to set whose inventory it was to delete...
For the ending bik, just place the name of the file between the quotes in EndGame(""); from the third script.
Nerezza Fri, 12th Aug '05, 7:06am Damnit lol. Well the outro movie worked fine but the items are still there. Any way to wipe everything from the inventory? Keeps putting a torch and a set of armor in there, along with the standard 3 healing potions. >.<
Lynadin Fri, 12th Aug '05, 8:40am That's why i gave up scripting ... lol :)
Nerezza Fri, 12th Aug '05, 10:24am I just loaded up the game then and it came up in the console with an error:
Script strip_pc, OID: 80000000, Tag: ,ERROR: TOO MANY INSTRUCTIONS
It did seem however to get rid of the 3 healing potions =/
So in a sense the script is working, just the pc doesn't like being naked.
Any thoughts?
Alavin Fri, 12th Aug '05, 10:32pm Hmm, in theory that should work... I've never needed to use it, myself, but that should remove all items. But when tested, I got the same results. I'll have a tinker with it in the morning, when my mind is in a state of clarity.
Alavin Sun, 14th Aug '05, 8:08pm I've sent you an email containing the script (just incase you come here first). It finally works!
Nerezza Mon, 15th Aug '05, 9:11pm Thanks for all the help Alavin I'll see what i can do.
|
|