1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Scripting Questions

Discussion in 'Neverwinter Nights (Classic)' started by Nerezza, Aug 11, 2005.

  1. Nerezza Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Dec 21, 2004
    Messages:
    31
    Likes Received:
    0
    [​IMG] 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
     
  2. Alavin

    Alavin If I wanted your view, I'd read your entrails Veteran

    Joined:
    Aug 26, 2003
    Messages:
    930
    Likes Received:
    0
    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!
     
  3. Nerezza Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Dec 21, 2004
    Messages:
    31
    Likes Received:
    0
    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 ]
     
  4. Alavin

    Alavin If I wanted your view, I'd read your entrails Veteran

    Joined:
    Aug 26, 2003
    Messages:
    930
    Likes Received:
    0
    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.
     
  5. Nerezza Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Dec 21, 2004
    Messages:
    31
    Likes Received:
    0
    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. >.<
     
  6. Lynadin Gems: 11/31
    Latest gem: Bloodstone


    Joined:
    Sep 20, 2004
    Messages:
    417
    Likes Received:
    0
    That's why i gave up scripting ... lol :)
     
  7. Nerezza Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Dec 21, 2004
    Messages:
    31
    Likes Received:
    0
    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?
     
  8. Alavin

    Alavin If I wanted your view, I'd read your entrails Veteran

    Joined:
    Aug 26, 2003
    Messages:
    930
    Likes Received:
    0
    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.
     
  9. Alavin

    Alavin If I wanted your view, I'd read your entrails Veteran

    Joined:
    Aug 26, 2003
    Messages:
    930
    Likes Received:
    0
    I've sent you an email containing the script (just incase you come here first). It finally works!
     
  10. Nerezza Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Dec 21, 2004
    Messages:
    31
    Likes Received:
    0
    Thanks for all the help Alavin I'll see what i can do.
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.