Community Adventure Project
Welcome Adventurer, make yerself at home.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Fix or Improve??
Sat Dec 20, 2014 10:12 pm by Drgnwlkr

» Is there...
Fri Nov 14, 2014 10:39 am by Tavion

» Resetting Journal
Mon Oct 21, 2013 11:38 pm by Subnormal

» Golem Builder By Borojb
Sun Sep 01, 2013 1:32 pm by Tavion

» Hack K & L
Fri Jul 19, 2013 11:43 pm by Tavion

» Help with the haks
Fri May 31, 2013 7:34 pm by Wyrdwolf

» Character Retirement not working
Fri May 03, 2013 3:43 am by MannyJabrielle

» Yankeeyiddos.com
Sat Apr 06, 2013 1:58 am by Drgnwlkr

» The Grimm is back!
Sat Mar 09, 2013 1:41 am by borojb


Drgnwlkr's Questions

Page 1 of 2 1, 2  Next

Go down

Drgnwlkr's Questions

Post  Drgnwlkr on Tue May 08, 2012 1:09 pm

Thought I'd start this thread so it is a collective of my ??? and replies for anyone to mull through. I will try to limit to no more than 3 questions at a time and wait for replies before listing anything new... I did say 'try' Razz


Thus said...

1) How could I add a delay command to the Respawner to have it clean the area say 10 seconds after the PC leaves instead of right as they do?

2) Is there a standard script in NWN to have NPCs equip/unequip a torch according to time? My thinking is to have NPCs, different ones for different areas, rove their towns and euqip a torch when it turns dusk/night.

Okay, pushing my (self imposed) limit so I'll stop here Twisted Evil
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Tue May 08, 2012 8:19 pm

1) I am not at my PC so I cant look at the exact code...
but when I get back to it, I can look it up and post the how to's for it.

2) yes, but again I already have something written up like that so let me get home first...might not be today as I am stuck at work most all night
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Tue May 08, 2012 9:55 pm

That is fine. I do understand you're working. And to answer your other post...yes, I really like it when I actually figure out the problem and get things running smoothly. Matter of fact, think I'll get a burrito and head home to build heheh. I have other things, so very many, to work on until I can check back here tomorrow. I tried Lilac's Script Generator on the torch issue but did something wrong then figured Bioware probably put a standard script in for that anyways, just can't find a reference for it. Don't work too hard tonite Smile

btw...I did look at several scripts last night trying to figure out a DelayCommand and think I kind of understand where it may go just not positive and the exact 'wording' so thought I'd ask instead of creating yet another noncompiling script heheh.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  borojb on Wed May 09, 2012 2:45 am

To equip a torch at nightfall you do something like this:

if (GetIsNight())
{
object oTorch = CreateItemOnObject("NW_IT_TORCH001", oNPC);
AssignCommand(oNPC, ActionEquipItem(oTorch, INVENTORY_SLOT_LEFTHAND));
}

To unequip at daytime, you would do the opposite. (Well something like that Suspect )

The problem is where you actually would put the script. You could put the equip into
the OnSpawn event, but it would only fire at the time of spawning, and then they would
never unequip the torch either. To function properly, you would have to cycle through
all NPC in the Area Heartbeat script, and have them make the distinction based on that
cycle.

I, on the other hand, might just use something like this:
http://nwvault.ign.com/View.php?view=scripts.detail&id=310
But then again, I'm pretty lazy like that.... Embarassed Shocked Cool

LoW might have some better stuff, especially if you are already using his systems
as a backbone, so I'll leave the rest of that to him.


borojb
CAP Squire
CAP Squire

Posts : 75
Join date : 2011-01-08
Age : 48
Location : Downstate Illinois

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Wed May 09, 2012 3:48 pm

Thank you for the insight, borojb! The script I had created was similar but will check this out. And that link sounds like something worthwhile also. Thanks alot! Smile
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Wed May 09, 2012 6:10 pm

Well I use the RS Spawn system, so I put this on their OnSpawn script,

and borojb has it down..
you can use the
GetIsDawn/GetIsDay

GetIsDusk/GetIsNight


make sure of 2 things
1) the npc *actually* has a torch in inventory..I spent days on this one once trying to figure out why they wouldn't equip torches at night, turned out the npc never had one in his inventory to begin with. tongue

2) if you decide on doing this with a heartbeat, some suggestions
a) use a random delay for equipping so every NPC in your world doesnt decide to equip their torches in unison..great if your going for inline gymnastics...not so great if your trying to make your towns seem more natural.
b) Use it sparingly, say out of every 10-15 NPC's you have 1 or 2 custom Torch Equippers.
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Thu May 10, 2012 7:02 pm

Thanks! I had thought about the need for a torch in inventory so made sure of it. I'll try this out. Thought maybe just 1-2 NPCs per area be roving and use a torch or lantern. I'll work on this when I get home. But if I'm not mistaken when I tried to save brorjb's script I got am error...if so I'll ask sometime soon.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Thu May 10, 2012 7:37 pm

thats because you have to assign oNPC

so put a object oNPC = OBJECT_SELF;
so scripts should look like:


object oNPC = OBJECT_SELF;
if (GetIsNight())
{
object oTorch = CreateItemOnObject("NW_IT_TORCH001", oNPC);
AssignCommand(oNPC, ActionEquipItem(oTorch, INVENTORY_SLOT_LEFTHAND));
}


thats should compile now and work fine.
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Thu May 10, 2012 7:52 pm

Heh ... now I feel like a DUH-mmie Shocked Mad Sad
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  borojb on Thu May 10, 2012 10:19 pm

Ya,

Sorry, I guess I glossed over that one Cool

Cause it really depends on where/which event you run the script from
I didn't want to just go all OBJECT_SELF all over you...

borojb
CAP Squire
CAP Squire

Posts : 75
Join date : 2011-01-08
Age : 48
Location : Downstate Illinois

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Fri May 11, 2012 5:11 pm

I thank you for your kindness borojb, I think I'm all out of OBJECT_SELF remover Razz
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Sat May 12, 2012 4:18 pm

I have the stealer script working and its just what I was looking for, thanks! I'm still tinkering with the torch script ... it would seem the NPC still needs the script 'onheartbeat' eventhough I set it in the variables for the spawn point.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  borojb on Sat May 12, 2012 9:30 pm

I don't know the spawn system very well, but if you put it Onspawn, it will
only run the script at the moment of spawning. So unless it is dark at
the time of spawn, the equipping/unequipping won't occur, nor will the
opposite action at the appropriate time.

Thats why you need the heartbeat check scripts...

borojb
CAP Squire
CAP Squire

Posts : 75
Join date : 2011-01-08
Age : 48
Location : Downstate Illinois

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Sat May 12, 2012 10:54 pm

Thanks, I thought about that so will do it on NPC. The 1 town guard has the script and it works but on his hb it causes him to keep checking so he re-equips over and over.

I had talked to LoW before about having issues with some items working when using the Unique Power and some not. I'm not sure what causes this or doesn't allow this to happen. And when I build module I keep getting an error for dmfi_db_biow_inc ...I referenced the settings with a copy of AF SQL and it is exactly the same. It is line 18 that has the error Invalid Value Assigned to Constant but it is the exact same as AF's ...

const int DMFI_DB_TYPE = DMFI_DB_TYPE_BIOWARE;

Any and all help would be greatly appreciated.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Sun May 13, 2012 3:37 pm

yeah that error i cleaned out awhile ago, but sincerely has nothing to do with anything, basically its the DMFI database,which it cannot locate which was/is disabled in the AF core resources.

I had since commented out the offending code so I wouldnt receive the error anymore.
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Mon May 14, 2012 1:51 pm

Ah okay, thanks. I'll do the same since it won't 'break' anything heheh.

Btw, I mis-spoke in another post... although you don't have a specific 'desert tilesset', I spent yesterday working with the Seasonal to create some desert areas. As many os us have said before... you out do yourself!

I eagerly await when you have the chance to upload that quest erf! I tested a commoner spawner yesterday that was not as grand as the RS Spawner. Needs to say, I'm staying with the RS was just trying something that claimed to be random and it just boogered things up. I'll just have to use more RS spawn points. I did like the fact that the other spawner had the NPCs that would spawn, walk around then despawn kinda like how you do on AF.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Tue May 15, 2012 8:32 pm

Okay, I have some more questions, of course... I worked on the mod events and now have managed to fix things where the items that use 'Unique Power' are actually working. I downloaded Urk's stables and found out that there is something messed up with the mount feat. It is listed when I create a new PC and can actually select it but when I log that PC onto the mod the feat is not listed and the horse menu does not appear. I have compared things to AF's but. Any thoughts on this? I apologize upfront if this is vague.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Thu May 17, 2012 5:46 pm

check your module's OnClientEnter event: (default script is: x3_mod_def_enter)

you should have a snippet like this in there:


#include "x3_inc_horse"

void main()
{
object oPC=GetEnteringObject();
ExecuteScript("x3_mod_pre_enter",OBJECT_SELF); // Override for other skin systems
if ((GetIsPC(oPC)||GetIsDM(oPC))&&!GetHasFeat(FEAT_HORSE_MENU,oPC))
{ // add horse menu
HorseAddHorseMenu(oPC);
if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB"))
{ // restore PC horse status from database
DelayCommand(2.0,HorseReloadFromDatabase(oPC,X3_HORSE_DATABASE));
} // restore PC horse status from database
} // add horse menu
if (GetIsPC(oPC))
{ // more details
// restore appearance in case you export your character in mounted form, etc.
if (!GetSkinInt(oPC,"bX3_IS_MOUNTED")) HorseIfNotDefaultAppearanceChange(oPC);
// pre-cache horse animations for player as attaching a tail to the model
HorsePreloadAnimations(oPC);
DelayCommand(3.0,HorseRestoreHenchmenLocations(oPC));
} // more details
}



the parts in red are the most important.
without them, your entering PC's will *not* have the horse mount feat.


you can just add this snippet to your own OnClient Enter
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Thu May 17, 2012 6:15 pm

As I thought, my OnClientEnter has all of that...just checked to make sure Smile
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Fri May 18, 2012 9:56 pm

Okay, moving passed that for now. Like I said, I've got the 'Unique Power' working and put an erf for a teleporting book in the mod. I finally figured what seems to be the correct way to list the onactivate script for the mod but when I use the other items with 'Unique Power' the book fires as well. I'm not sure how to explain it better but could post the script if it would help. Just seems a command is making the book link to what other item I use.
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Sat May 19, 2012 4:49 pm

tag based items work like this:

everytime an item with the same TAG as the name of the script will fire off when:

that item is:
equipped/ and unequipped
aquired / and unaquired
when its activated

so you have to put a check in there and return; the script when it knocks off one of them you dont want:
example:


#include "x2_inc_switches"

void main()
{ if( GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE ) return;
// if anthing OTHER than ACTIVATING item, return out of script
// heres where you script what you want item to do...
// you can also use EVENT_DEACTIVATE,EVENT_AQUIRE,EVENT_UNAQUIRE,etc
}
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  borojb on Wed May 23, 2012 2:46 pm

What is the Tag of the item in question? What is the name of the script for the book
activation?

Look at the script 'x2_it_example' it's a default Bioware script that shows the
simplified structure for a Tag-based item script that LoW was alluding to
structure-wise in his example above. The script 'wrm_mod_acti' in Arbor
Falls is the way to handle items activation if you are not using the Tag-based
scripts. In the case of Arbor Falls, Mr. Worm has had enough forethought
to use the Tag-based scripts, but keep the second one around as a redundancy,
which is helpful if someone changes the Tag-based logical statement from
TRUE to FALSE for instance.

If you had the Tag-based stuff running properly before the erf was added,
then obviously something in the erf changed one of the other settings, which
is why you have to be extremely careful in the selecting of overwritten resources
when one imports the erf.

Hope that helps a little

borojb
CAP Squire
CAP Squire

Posts : 75
Join date : 2011-01-08
Age : 48
Location : Downstate Illinois

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Drgnwlkr on Thu May 24, 2012 2:45 pm

The item in question is called a Ruin Book with a PC can use to either gate or recall to saved locations. It functions perfectly but the activation screen for it comes up when I use other activated items such as ioun stones, sacrifice stone. Here is the information you requested borojb...

item Tag = xs_gate_book_002

script to activate = xs_gate_inc_001 (if I'm thinking right)

actual mod onactivate script =

#include "x2_inc_switches"
#include "i420_s_inc_pstat"
#include "weather_inc"

void GateBook()

void main()
{

object oItem = GetItemActivated();
object oPC = GetItemActivator();

ExecuteScript("cr_gold_act", GetItemActivator());
ExecuteScript("hh_mod_onact", OBJECT_SELF);

if GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem), OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}

if (GetTag(oItem) == "MJ_CAMPFIRE" && GetIsAreaInterior(GetArea(oPC)) != TRUE
MakeCampFire(oPC);

if (GetTag(GetItemActivated()) == "CRoS")
ExecuteScript("cros_onac", OBJECT_SELF);


///Runestone Book section
string sItemTag = GetTag(oItem);
location lActivator = GetLocation (oPC);
object oInArea = GetArea(oPC);

string sTagOfArea=GetTag(oInArea);
SetLocalObject(oPC, "RUNESTONE_BOOK", oItem);
if (sTagOfArea == "vahalla" || sTagOfArea == "home_base" ||
sTagOfArea == "jail" || sTagOfArea == "pikespeak" || sTagOfArea == "ppss")
AssignCommand(0PC, SpeakString ("Teh area seems to be magically blocking this."));
else
AssignCommand(oPC, ActionStartConversation(oPC, "xs_dlg_gate_003", TRUE));

if (sItemTag == "xs_gate_book_002")
GateBook();
///End

if (GetTagItemActivated()) == "i420_i_ac_pstat") ExecuteScript("i420_s_ac_pstat", GetItemActivator());
ProcessPersistnetTime();

}

}
avatar
Drgnwlkr
CAP Knight
CAP Knight

Posts : 128
Join date : 2011-09-03
Age : 53

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Thu May 24, 2012 7:20 pm

Its because you have no IF statement to determine if that was the item that was cast , so ANYTIME you activate an item, that whole script will fire and you can follow the logic that it does this.

if (GetTag(oItem) == "MJ_CAMPFIRE
//if the items tag matches this, then fire this script snippet

if (GetTag(GetItemActivated()) == "CRoS")
ExecuteScript("cros_onac", OBJECT_SELF);

//again, checks items tag, (althoug redundents since you have already defined oItem, so you dont need the GetTag(GetItemActivated)

BUT, then it just does this part of script regardless of the item tag

//
///Runestone Book section
string sItemTag = GetTag(oItem);
location lActivator = GetLocation (oPC);
object oInArea = GetArea(oPC);

string sTagOfArea=GetTag(oInArea);
SetLocalObject(oPC, "RUNESTONE_BOOK", oItem);
if (sTagOfArea == "vahalla" || sTagOfArea == "home_base" ||
sTagOfArea == "jail" || sTagOfArea == "pikespeak" || sTagOfArea == "ppss")
AssignCommand(0PC, SpeakString ("Teh area seems to be magically blocking this."));
else
AssignCommand(oPC, ActionStartConversation(oPC, "xs_dlg_gate_003", TRUE));

if (sItemTag == "xs_gate_book_002")
GateBook();
///End

avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  lord_of_worms on Thu May 24, 2012 7:28 pm

but that all aside, your script needs some changes to make it
1) more understandable (for you but also for any others looking at it)
2) try and keep all your constants at the top, like if you are searching the tag for an item activated..
put the
object oItem = GetItemActivated();
object oPC = GetItemActivatedBy();
location iLoc = GetItemActivatedLocation();
location pLoc = GetLocation(oPC);

this way you can just use oItem,oPC,iLoc,pLoc instead of again reusing GetTag(ItemActivated),etc

I know your just learning and its hard at the beginning, but just keep asking questions and I will do the best I can to help. But if I can suggest something, you should look into some tutorials on nwnwiki for simple scripting so you can understand what it is your after better.

hopefully you understand why that script now is firing everytime you activate an item.
avatar
lord_of_worms
CAP Knight
CAP Knight

Posts : 321
Join date : 2010-01-12
Age : 45
Location : Massachussetts

View user profile

Back to top Go down

Re: Drgnwlkr's Questions

Post  Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum