Ironworks Gaming Forum

Ironworks Gaming Forum (http://www.ironworksforum.com/forum/index.php)
-   Neverwinter Nights 1 & 2 Also SoU & HotU Forum (http://www.ironworksforum.com/forum/forumdisplay.php?f=16)
-   -   Guess what, scripts! (http://www.ironworksforum.com/forum/showthread.php?t=35204)

Obsidian the Black 01-24-2003 04:15 PM

Ok, a few script questions. Could anyone tell me the EXACT (if possible) things to write down to make a script that when you open a locked door it closes and locks itself again, after about 12 seconds.

How could I add a 'stone of recall' kind of script to an Emote, DM wand, and FX wand script for the on used tab?

Could you give me the script that triggers something when you walk over an area so it strips all immune items, resistance items?

Thanks for the help.

Obsidian the Black 01-24-2003 04:34 PM

Heh, one more. How could I make it that if a PC casts a spell or activates a magically charged item, that some people would appear and give them a good telling off. Then if they do it a second time, the people would appear and take them to jail. And solution is fine, even if you can only make a script that works when they only cast a spell, not use an item. Also, if they hold an item on their person it cancels out the jail and stuff for them.

You see im making an Athkatla mod (nothing to do with BG2), and i want the cowled wizards to appear when spells are cast by PC's too many times, appart from when they hold an item on themselves.

Chewbacca 01-25-2003 04:14 AM

Quote:

void main()
{
DelayCommand(12.0, ActionCloseDoor(OBJECT_SELF));
DelayCommand(12.5, ActionLockObject(OBJECT_SELF));
}
Paste this script in a door's OnOpen script slot and it will close and lock itself 12.5 seconds after being opened.

[ 01-25-2003, 04:15 AM: Message edited by: Chewbacca ]

philip 01-25-2003 04:17 AM

first, i don't have the toolset on this computer so i can only give some general answers to some of your questions.

about the spell casting i think this would do something like it:

object oPC = GetLastSpellCaster();
object oCowledWizardWarning = GetObjectByTag("include tag here");
object oCowledWizardJail = GetObjectByTag("tag");
int nSpellsCast = GetLocalInt(OBJECT_SELF, "SPELLSCAST");
int nTimesWarned = GetLocalInt(OBJECT_SELF, "TIMESWARNED");
object WPJail = GetObjectByTag("the waypoint in your jail");

void main()
{
if (GetIsPC(oPC))
{
SetLocalLocation(oPC, (GetLocation(oPC)));

CreateObjectAtLocation(oCowledWizardWarning, (GetLocalLocation(oPC)));

ActionSpeakString("You're warned once") // or a dialogue start

SetLocalInt(oPC, "nTimesWarned", 1);

DeleteLocalLocation(); //not sure if you have to give a name for this
}

if ((GetIsPC(oPC))&&(nTimesWarned == 1))
{
SetLocalLocation(oPC, (GetLocalLocation(oPC));

CreateObjectAtLocation(oCowledWizardJail, (GetLocalLocation(oPC));

ActionSpeakString("you go to jail now");

ActionJumpToObject("WPJail); // maybe you have to give the creature which
//jumps to that location

DeleteLocalLocation();

SetLocalInt(OBJECT_SELF, "nTimesWarned", 0); // so the pc can start casting
//again and still be arrested

}
}

Maybe i made some errors so it could be not working but if you use the commands in the list you can see what things you have to add inside the '(' and ')'
this is for the spells cast, i don't know how to do it for magic items since i don't know if there's an option which looks which items are magical and which items it'll select as magic then

for the stone of recall wand you have to put lines in the onactivatedscript in the module properties with what to do when the unique power self is used. stone of recall uses more than 1 script (to make the script less large or for ease of use). the scripts are triggered with an ExecuteScript() command

i think you have to paint a trigger region and then add a script which strips the items. I thinkit'll be quite hard to strip only the resistance items

philip 01-25-2003 08:36 AM

BTW you can leave the ActionSpeakString out of the script above since using 2 different cowled wizards is much easier with 2 dialogues. it could be there must be a ActionMoveTo command in the cowled wizard script becasue i don't know if it's possible to start the dialogue if the PC walks away.

you could use this script in the OnHeartbeat of the PC (in module properties) but it's very laggy

Obsidian the Black 01-25-2003 10:02 AM

Thankye ever so much guys. Just a few questions. That lock door script, when it locks will it set it up so it needs a key to open it again? Because the door will be key locked.

And the spell script, I will give you the tags for each of the things, so could you just put them where they would be needed. Cowled Wizard=cowledwizard
Magic Permit=magicpermit Waypoint for Jail=WP_jail and it is every spell cast, so how would I make it that every spell cast triggers it? And do I have to place the script in the OnHeartbeat in module properties? Thanks

Obsidian the Black 01-25-2003 11:05 AM

The lock script doesnt seem to be locking it again

Dreamer128 01-25-2003 11:53 AM

I'm currently using this script for re-locking doors;

void main()
{
DelayCommand (3.0,ActionCloseDoor(OBJECT_SELF) );
DelayCommand (3.0,SetLocked(OBJECT_SELF, TRUE);

}

Be sure to place is in the OnOpen slot of the door.

Chewbacca 01-25-2003 02:24 PM

Quote:

Originally posted by Obsidian the Black:
The lock script doesnt seem to be locking it again
Hmmm odd, I wonder if it has anything to do with the fact that I used this script on doors that were not locked to begin with and only lock and reclose after being opened. I will do some testing and get back to you.

Chewbacca 01-25-2003 02:44 PM

Aha! I found this at the NW Lexicon:

http://www.reapers.org/nwn/reference/
Quote:

ActionLockObject(object)
An action that will cause a creature to lock a door or other unlocked object.

void ActionLockObject(object oTarget);

Parameters
oTarget Door or placeable object that will be the target of the lock attempt.

Description
The action subject will lock oTarget, which can be a door or a placeable object.

Used in the script of a creature (or assigned to a creature) it will move that creature to the door and use its Open Locks skill to attempt to lock the door (or placeable).

Known Bugs
This action must be given to a creature. A crash will occur if you make a door lock itself by assigning this action to it. Use SetLocked() instead.

Ensure that the door has the 're-lockable' property set.


Version
1.22

See Also
functions: ActionCloseDoor | ActionOpenDoor | ActionUnlockObject | SetLocked
categories: Action on Object Functions
So it appears that Dreamer128 has the better script for closing and locking doors.


All times are GMT -4. The time now is 04:44 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved