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.)

Neverwinter Nights Forum Update

Discussion in 'Game/SP News & Comments' started by NewsPro, Jul 1, 2002.

  1. NewsPro Gems: 30/31
    Latest gem: King's Tears


    Joined:
    May 19, 2015
    Messages:
    3,599
    Likes Received:
    0
    (Originally posted by Z-Layrex)

    David Gaider, Designer

    Waypoints: Do you mean actually random walking or walking waypoints? Either way, you want to go into the dialogue file and flip over to the Other Files tab. You'll see two spots for scripts for when the conversation is either aborted or ended. If you want the NPC to resume walking waypoints, put in the nw_d2_walkways script. If you just want the NPC to walk randomly, make a script that simply calls ActionRandomWalk();

    Questions:

    Quote: If you die and respawn does your henchmen also, is there a script to make them do it?

    The ones in the official campaign do, yes.

    Quote: How can I make a monster plead for mercy after you kill him, (script) please?

    There are a LOT of creatures in the official campaign who do this... they use the SurrenderToEnemies command to stop the fighting for a moment and become neutral. There's more involved, though... best advice, truly, would be to look up one of those creatures in the official campaign modules and use it as a template.


    Actions: You're talking about the action queue... each action put into the queue gets completed before the next one is called. Commands that begin with Action (like ActionWait, ActionMoveToObject) are automatically added to the queue. AssignCommand is ONLY used to assign an action to an object from another script. If you are adding commands into the queue from the creature's own script, AssignCommand is not necessary. ActionDoCommand is what you can use to put non-Action commands in the queue. For instance:

    ActionMoveToObject (oWP);
    SetLocalInt (OBJECT_SELF, "Reached_Waypoint", 1);

    In the above scriptlet, the creature would begin to move to the waypoint and immediately set the "Reached_Waypoint" variable to 1... long before he got there. To have it set only after the object was reached, you'd need to put the SetLocalInt into the queue:

    ActionMoveToObject (oWP);
    ActionDoCommand (SetLocalInt (OBJECT_SELF, "Reached_Waypoint", 1));

    If you want your creature to do all 5 actions in order, one after the other, simply make sure he puts all 5 into his queue.


    DM Appearing: There's no event for the appear/disappear... and no way to script it, really, so if you want an effect to go off, I would use the DM Client Console command 'runscript' to activate a script that starts the special effects on your position... and then simply press the appear button right away.

    Scripts Across Modules:

    Quote: Is there any way I can make a script available to any module? I can only seem to open them in the module which they were created.

    Not automatically, no. When you are creating a module, you'll notice that a temp directory gets opened up inside your module folder... all scripts and stuff you create get stored in there and then packed into a .mod file when you save. Other than copy-and-pasting, the only other thing you can do is open up that temp directory while your module is open and copy the .ncc and .ncs file with your scriptname. Save them elsewhere... and if you want to use them in a future module, copy them into the temp folder for it and it will show up in the toolset. Most things in the toolset can be exported to make this easier, but scripts aren't one of them at the moment.

    (Ed. Note: You can export the script, david ran out of coffee and forgot that part. :)


    Factions/Reputations:

    Quote: And what is the difference between faction and "personal reputation" (as used by the SetIsTemporaryFriend function)? Is there a difference? I don't see "personal reputation" mentioned anywhere else.

    A player's faction is his party. Factions will have a 'faction rating' which is their setting towards other factions (such as a PC's party). How the faction feels towards an individual is his 'personal reputation'. So if the rogue in your party goes and kills some peasant in the Commoner faction, the relationship of the entire party lowers towards the Commoner faction (well, you ARE with the guy). The peasant and any nearby friends, however, will become hostile to the rogue... but not to the rest of the party (if and until they become involved). That's the difference. I'm not very keen on the different commands that do what via Factions, however. I do know that AdjustReputation affects the faction rating only... and ClearPersonalReputation affects the personal reputation. Hope that helped a bit.


    Check Alignment: At any rate, if you wanted a 'Text Appears When' conditional script which returns TRUE if the player in dialogue was evil:

    int StartingConditional()
    {
    int nAlign = GetAlignmentGoodEvil (GetPCSpeaker()) == ALIGNMENT_EVIL);
    return nAlign;
    }


    Shops: In part of the dialogue where the store would be opened, go to the 'Actions Taken' section and create a script that basically does this:

    void main()
    {
    object oStore = GetObjectByTag ("STORE_TAG_HERE");
    OpenStore (oStore, GetPCSpeaker());
    }

    Of course, you want to replace STORE_TAG_HERE with whatever the actual tag of your store object is. Don't forget that the store object must be actually placed somewhere in your module. Don't worry... players won't see it. There simply has to be an existing instance instead of just a blueprint. As for respawning to a specific location, I answered someone's question about that not 1 hour ago... let me dig it up again for you.


    Int Rankings: As far as the official campaign functions go:

    Low = less than 10
    Middle = greater than 9, less than 15
    High = greater than 14
    Normal = greater than 8


    Effects: I'm glad you're enjoying yourself. Believe it or not, I learned NWScript the same way... my responsibilities didn't include scripting, so nobody was available to teach me. I just jumped in, looked at what other scripts did, and when I was really stuck I was able to find someone to give me advice. Nice feeling when you finally begin to understand. Takes less time than most people think... it's just such a hurdle to get over that initial overwhelmed feeling. At any rate, what you want to look at is the use of Effects... in particular the EffectVisualEffect. If you look at EffectVisualEffect, you will see it defined as follows:

    effect EffectVisualEffect(int nVisualEffectId, int nMissEffect=FALSE)

    So what you want to do is define an effect variable using this command. 'nVisualEffectId' is a constant... there's a whole list of them all starting with VFX in the constant list.

    VFX_COM_* are combat visual effects.
    VFX_DUR_* are duration visual effects... when you apply these, you will need to give a length of time they appear.
    VFX_FNF_* are 'fire-and-forget- visual effects.
    VFX_IMP_* are (if I remember right) impact visual effects that are generally used for spells when they hit someone.
    VFX_BEAM_* are an exception... you set up the use of these using EffectBeam, not EffectVisualEffect.

    The 'nMissEffect', if you set it to TRUE, means that when you apply the visual effect, it will actually appear in a random spot 'around' the target. If you want the effect to appear where you put it, just ignore this part. A few examples of setting up effect variables:

    effect eVis = EffectVisualEffect (VFX_IMP_SLEEP);
    effect eVis = EffectVisualEffect (VFX_COM_HIT_FIRE, TRUE);
    effect eVis = EffectVisualEffect (VFX_FNF_SMOKE_PUFF);

    OK...now that the variable is set up, you want to apply it. Use either the effect ApplyEffectToObject or ApplyEffectAtLocation, depending on whether or not you have a target object or simply know the location of the spot. For your purposes, we'll assume you have an actual target object variable set up (the same target variable you used to heal them)... I'll assume the variable is oTarget. So, you should be able to add this into your script:

    effect eVis = EffectVisualEffect (VFX_IMP_HEALING_X);
    ApplyEffectToTarget (DURATION_TYPE_INSTANT, eVis, oTarget);

    And that's all you'd need to do. As for sound, you CAN use the PlaySound command to play a particular .wav file... but most of the visual effects have a sound that automatically accompanies them. Try it and let me know how you do.


    Custom Tokens: I think you'd want to set up custom tokens. For instance, if you're cycling through the party members, you could use the following:

    object oPC = GetFirstFactionMember (GetPCSpeaker());
    int nSelect = 1000;
    while (GetIsObjectValid (oPC))
    {
    SetCustomToken (nSelect, GetName (oPC));
    nSelect++;
    oPC = GetNextFactionMember (GetPCSpeaker());
    }

    That would generate a dialogue token for each party member which you could then use as so:

    "The first party member is ."
    "The second party member is ."
    and so on...

    You can do the same thing with your scores. Let's say you have an integer nScore with a value of 6. You could create a token:

    SetCustomToken (5000, IntToString(nScore));

    So you could then have dialogue that did this:

    "'s score is ."

    Brenon Holmes Added:
    An important note... Custom Tokens 0-9 are reserved for game use. Do not use them!... you'll get all sorts of weird data if you try...


    Sleeping NPCs: Hmmm. Looks like somebody changed their mind on the name for that flag but didn't change it in the OnSpawn script. If you want to use it, change 'NW_FLAG_SLEEP' in that statement to 'NW_FLAG_SLEEPING_AT_NIGHT'. I will tell you right now, however, that the NPC sleeps standing up... there's no way to get an NPC onto an actual bed at this point (trust me, I've tried). If you want it to look convincing, use a bedroll placeable object and script them to fall asleep on it (this is what was done in the official campaign, even).

    More:

    Quote: Umm, wouldn't the "knockdown" effect combined with a bed under them achieve this? I know that the tops of beds are illegal positions for objects but...

    That would knock them to the ground... but that still would only sit them on a bedroll and not get them onto a bed in a placeable tile. Tile beds have no walkmesh on them... trying to move or jump an NPC on top of them will not work. Placeable object beds don't work, either... creatures just pass through them.
     
    Last edited by a moderator: Jan 4, 2018
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.