Games Support Forums BioWare Info My Account Login Community Sign Up Store
Neverwinter Nights 2 Forums

NWN2: Builders - NWN2 Scripting

New Topic    Post Reply

Go to Page ( 1 , 2 Next )

    Add this To My Topics

   Go To Bottom

Author How do I make a key ring?
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Sunday, 08 November 2009 03:39AM
Hi all!

Posted this on the toolset area as well, but...

Want a keyring to keep all keys character has. Was thinking of making a "key" bag of holding, but would rather do it this way.

Any ideas?

Thanks!
_________________
Saint Mac - Patron saint of snow days.
  Profile: Saintmac   Send Message To: Saintmac
Segal
Game Owner
Profile: SegalNWN
NWN: SoU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 17 Oct 2001
From: Houston Texas
Posted: Sunday, 08 November 2009 04:37PM
I wouldnt use any physical items at all.

Store a variable.
Set the door to locked.
On the failtoopen script, check to see if the player has the variable (i.e. has the key).
Open the door if they do.
_________________
Segal
The Depths - An Apocalyptic Fantasy Adventure
Depths Wiki - A Player Resource
  Profile: Segal   Send Message To: Segal
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Sunday, 08 November 2009 11:00PM
AH! Now there's an idea!

Question on it though...so lets say I had a global var (say gv_key_tavern). Were you thinking that this should be boolean (true/false) and how would I assign it to just one character?

Please brain dump your thought oh great one
  Profile: Saintmac   Send Message To: Saintmac
BelSirk
Game Owner
Profile: BelSirkNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 13 Jul 2002
From: Coahuila, México
Posted: Monday, 09 November 2009 08:23AM
well, the boolean var will be a INT var actually (0:FALSE, 1:TRUE) for only one PC you could use another local var on placeable. By example:

At the begin you took a player and put his data on the placeable local var (maybe his name) and use that for identify which is the player, the other a simple item on the player iventory with the curse property
_________________
Broodslayer's Lord Belsirk

- Que los demonios los arrastren al rincon mas oscuros de sus almas y les consumas sus anhelos de vida en la perpetua Flama de la perdicion
  Profile: BelSirk   Send Message To: BelSirk
Shaughn78
Game Owner
Profile: Shaughn78NWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 06 Feb 2004
Posted: Tuesday, 10 November 2009 12:10AM
I posted in the toolset forum on your keyring item. But I will repost here since I suggested scripting ideas. I would have each key have their own on use script that destroys the key and creates a local int on the player. I like locals instead of global, and if you choose to have multiplayer then the player with the key can only unlock the door.

Each key would set a local int true/false on the player. They should have a name that you can use to track what key goes to what door. The on use script should also make sure the player has the keyring before it adds the key to it.

For the door scripts you should be able to use one script for all the doors and just change a local string on each door that is the name of the true/false int.

I would also suggest setting the doors normally with the key field so that if the player doesn't have the keyring or hasn't added it yet they can still unlock the door.
  Profile: Shaughn78   Send Message To: Shaughn78
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Wednesday, 11 November 2009 04:06AM
I'm following your train of thought on this and like the idea. It would also give me a nice way of allowing the player to sell back a house/whatever to a vendor.

The thing that has me scratching my head is I haven't set an int on a player before.

Would it be something like SetLocalInt(o, "Tavern_key", 1); ????

Can you tell me or point me in the direction of where I can find out how?

Thanks!

Edited By Saintmac on 11/11/09 04:23

  Profile: Saintmac   Send Message To: Saintmac
Shaughn78
Game Owner
Profile: Shaughn78NWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 06 Feb 2004
Posted: Wednesday, 11 November 2009 02:28PM
To set a local int you just need to define the PC.

There are templates for the item on use script that will define the PC as the item user.
object oUser = GetItemActivator();

For the fail to open or pick lock
object oUser = GetLastUsedBy();
  Profile: Shaughn78   Send Message To: Shaughn78
_Knightmare_
Game Owner
Profile: _Knightmare_NWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 16 Mar 2004
Posted: Wednesday, 11 November 2009 03:11PM
Quote: Posted 11/11/09 04:06 (GMT) by Saintmac

Can you tell me or point me in the direction of where I can find out how?

You may find my Scripting For Noobs tutorial helpful. There is a section specifically on using variables.

Edited By _Knightmare_ on 11/11/09 15:13

  Profile: _Knightmare_   Send Message To: _Knightmare_
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Thursday, 12 November 2009 01:20AM
Thanks! I will totally check it out! I'm a programmer and dig C, so looking forward to trying my hand at scripting.

Edited By Saintmac on 11/12/09 01:22

  Profile: Saintmac   Send Message To: Saintmac
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Saturday, 14 November 2009 08:12PM
Hey, just want to thank you all for your help. I'm having a ball scripting.

A special thanks for the links and all the effort it took.
_________________
Saint Mac - Patron saint of snow days.
  Profile: Saintmac   Send Message To: Saintmac
_Knightmare_
Game Owner
Profile: _Knightmare_NWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 16 Mar 2004
Posted: Sunday, 15 November 2009 01:35AM
Quote: Posted 11/14/09 20:12 (GMT) by Saintmac

Hey, just want to thank you all for your help. I'm having a ball scripting.

A special thanks for the links and all the effort it took.

NP, and thank you for the comment on the Vault page.

Just realized I got the 13th vote on Friday the 13th - spooooooky. LOL. Things turned out ok though.

Edited By _Knightmare_ on 11/15/09 01:39

  Profile: _Knightmare_   Send Message To: _Knightmare_
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Sunday, 15 November 2009 07:48PM
lol..well, I just put my vote out there and its after the 13th, so you should be good.

(sorry for off topic comment to everyone else)
_________________
Saint Mac - Patron saint of snow days.
  Profile: Saintmac   Send Message To: Saintmac
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Tuesday, 17 November 2009 02:50AM
Ok, so I've been playing! I have this script on the onFailtoOpen on the door.

void main(){

object oPC = GetClickingObject();
if (!GetIsPC(oPC)) return;

if (GetLocalInt(oPC, "tbb_cellar_key") != 0)
{
object oTarget;
oTarget = GetObjectByTag("tbb_cellar_door");
SetLocked(oTarget, FALSE);
}

}

Here's the thing I'm fighting. When the character goes to unlock the door. the word "locked" floats up on the display, the script above fires and Merry Christmas the door unlocks.

Its not the prettiest but it works for now.

I would like to add a floaty display statement to state that the door is now "unlocked". Should I stick in a conversation or is there an other way?
_________________
Saint Mac - Patron saint of snow days.
  Profile: Saintmac   Send Message To: Saintmac
_Knightmare_
Game Owner
Profile: _Knightmare_NWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 16 Mar 2004
Posted: Tuesday, 17 November 2009 02:58AM
Quick idea off top of head - add a float string or something that says "... but you have a key." If timed right, maybe it will say "Locked ... but you have a key."
  Profile: _Knightmare_   Send Message To: _Knightmare_
Saintmac
Game Owner
Profile: SaintmacNWN 2
NWN 2: MotB


Joined: 30 Nov 2008
From: Iowa, USA
Posted: Tuesday, 17 November 2009 03:58AM
lol..well, I'm cool with that, but confused about the speak string.

I've tried ActionSpeakString and and others, but getting this [cellar door] "unlocked"

Not pretty.

What's the proper way to display a string that looked like the onFailtoOpen "locked" ?
_________________
Saint Mac - Patron saint of snow days.
  Profile: Saintmac   Send Message To: Saintmac

Go to Page ( 1 , 2 Next )

New Topic    Post Reply

What do these icons mean?
Where can I learn how to use the forums?

Jump To:

Search Forums | Forums FAQ | Forum Archives

 

 

  Visit the Official Site | Technical Support
Neverwinter Nights 2 Official Support
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

5,036,170 Users
208 Online
66 Logged In

8,767,570 posts in forums

Newest Forum Topics:
1. does dodge actually work (NWN2: General discussion forums for NWN2 (No Spoilers Allowed))

2. on used Script Issue (NWN 1: Scripting)

3. Unlocking skills for new charact... (Mass Effect 1 General Discussion (No spoilers allowed))

4. Morality, (Mass Effect 2 General Discussion (No Spoilers Allowed))

5. The council. Idiots or keeper of... (Mass Effect 2 General Discussion (No Spoilers Allowed))


Current time is: (set time)
Sat, 21 November 2009 04:02AM