Illy's lite Companion scripting thread

Post » Fri May 27, 2011 7:20 pm

Have been making good progress with my Captain's Table mod and have reached a point where I have planned to take an NPC on some quests.

As I want to be doing some different things with several NPC's on quests I'll just try and keep all my questions together in one thread, which makes it easier for me to refer back to.

As anyone who reads my CS posts knows I have some... ah... scripting comprehension issues - however I actually have fairly straightforward follow quests with triggers at certain locations for action to take place.

While a fan of Grumpy's companions I do not want to have a full blown companion mod - instead I just need a lite version which basically enhances the simple follow commands in vanilla Morrowind.

Perhaps if I detail the features I'm not looking for first

I don't want to have comapanion sharing - the NPC is not a guar
I want them to walk and run at normal speed - there is no hurry in these quests - there's not a huge distance to walk anyway.
I don't want them to level up
I don't want them to have a choice of spells, or actions

However - I would like them to complain if the player is not in the correct cells - ideally a force greeting that tells the player that this is not where they should be and that they will wait for you at a designated spot if you want to do the mission again - I then want the result to be goodbye with a script that moves them to Shenk's Shovel in Caldera. The purpose of this is to prevent them being used as a meat shield in general tomb/bandit cave raiding.

I would like them to give a forced greeting if their health goes below 50% that they need help, if the player has a heal companion spell and uses it on them I would like that to raise the disposition of the NPC - alternatively I wondered about a script that checks if the player is carrying an exclusive restore health potion and is given an option in the forced greeting box to give it to the npc - thus removing it from the player's inventory and scripting an increase in the NPC's health.

If the health of the NPC falls to 25% I would like them to force a greeting that says they have to flee and then teleport them to a cell. (In dialogue it is explained that they carry a recall potion for emergencies)

And in case a player turns chicken and runs away leaving my poor NPC to fend for themselves - I need a get me out of here option which teleports them to safety determined never to go travelling with the player again.

When the quest is finished and the journal updated if the NPC is still with the player i.e. they didn't flee I would like them to force a greeeting and teleport to a cell. At this stage I would also like their weapon to be swapped for a new one in case their current one has damage.

Since a fight will be involved I have considered setting the NPC to guard class - but I don't want them to arrest the player or attack them if they attack anyone or anything.

Suggestions or help in putting together a script to do this would be very much appreciated.

Thanks in advance

Illy
User avatar
Chloe Botham
 
Posts: 3537
Joined: Wed Aug 30, 2006 12:11 am

Post » Fri May 27, 2011 7:23 am


I don't want to have comapanion sharing - the NPC is not a guar

That part is simple - just don't include the companion variable.


I want them to walk and run at normal speed - there is no hurry in these quests - there's not a huge distance to walk anyway.

So you want them to just warp to the player when they get stuck or left behind, instead of trying to find a path? Or do you not want them to warp either? Is the escort supposed to be annoying or tedious? (By that I mean: do you want the player to have to stop and slowly guide the NPC round corners, or do you want them to be able to keep up?)


I don't want them to level up

Not a problem.


I don't want them to have a choice of spells, or actions

Sorry, what do you mean by "actions"? Do you mean the player can't tell them to wait??


However - I would like them to complain if the player is not in the correct cells - ideally a force greeting that tells the player that this is not where they should be and that they will wait for you at a designated spot if you want to do the mission again - I then want the result to be goodbye with a script that moves them to Shenk's Shovel in Caldera. The purpose of this is to prevent them being used as a meat shield in general tomb/bandit cave raiding.

Should be easy enough. How do you want them moved to Caldera? Cast recall and disappear? (that's generally easiest).


I would like them to give a forced greeting if their health goes below 50% that they need help,

IMO this is a very bad idea "as-is". You don't want NPCs forcegreeting in the middle of a fight: for one thing, that's just asking for a crash in a heavily modded game. Messagebox would be better, but frankly if it was me I'd prefer just making the NPC flee if at low health (btw: if they flee they'll automatically say flee voices. The player will almost certainly notice if their companion starts yelling things like "Help! I'm under attack!" and runs away :P ). If you really want a forcegreeting I'd recommend you wait until combat is over at least. Up to you of course though, it's your mod.


if the player has a heal companion spell and uses it on them I would like that to raise the disposition of the NPC

To do this you basically just run a timer script from dialogue and check for the restore health effect on the NPC, if it happens within the time limit (whatever you set it as) then you can just modDisposition from the script (you can also modDisposition *down* if the player says they'll cast a spell but doesn't ;) ). Sound OK?



- alternatively I wondered about a script that checks if the player is carrying an exclusive restore health potion and is given an option in the forced greeting box to give it to the npc - thus removing it from the player's inventory and scripting an increase in the NPC's health.

No need for a script, you can filter dialogue for item (that checks if the player's got the item, btw, not the NPC). Of course this will only work for standard potions, but so would a script.


If the health of the NPC falls to 25% I would like them to force a greeting that says they have to flee and then teleport them to a cell. (In dialogue it is explained that they carry a recall potion for emergencies)

Again: forcegreeting is a bad idea in combat. Would a messagebox do? It's a lot easier to set up and less likely to cause problems.


And in case a player turns chicken and runs away leaving my poor NPC to fend for themselves - I need a get me out of here option which teleports them to safety determined never to go travelling with the player again.

This one is where it gets a bit tricky. Really there's no reliable way (even with MWSE) to tell if the player is running away from your NPC and towards an enemy (which could imply they're defending your NPC), or whether they're just running away. You could probably find out if the player is heading *directly* towards an enemy if you use MWSE/MGE, but if they have to go round obstacles or something then no.

Oh, hang on... Did you mean if the player leaves the cell?? If that's what you meant then it's do-able as long as you have a targeted or global script running to check.


When the quest is finished and the journal updated if the NPC is still with the player i.e. they didn't flee I would like them to force a greeeting and teleport to a cell. At this stage I would also like their weapon to be swapped for a new one in case their current one has damage.

Yep, that's all do-able.


Since a fight will be involved I have considered setting the NPC to guard class - but I don't want them to arrest the player or attack them if they attack anyone or anything.

Set alarm to 0 and put their greetings above the guard greetings (in greeting 0) and they'll be fine. Is the NPC supposed to protect the player, then? Or is it the other way round??
User avatar
Lawrence Armijo
 
Posts: 3446
Joined: Thu Sep 27, 2007 7:12 pm

Post » Fri May 27, 2011 5:03 pm

Thanks Melian - that was a helpful post - I didn't know that forcegreeting was problematic.

My goal is to not add too much complexity to the mod which already has taken me a year so far and am concerned that a companion feature for this NPC is both a bit of overkill and too much for me - hence wanting a lite version

The quest involves walking from Caldera to Gnarr Mok following the road and pausing at the roadsigns - since my OP have been rereading escorting NPC's in the MWSFD - and may need to rethink what I'm trying to achieve.

I would of liked to use AIescort - so the player follows the NPC - it's not a big distance so is not too onerous - so warping is not a big issue and the slow pace could of given me the opportunity to use some message boxes along the way for conversation. However it seems that AIEscort prefers pathgrids and there are none on the road to Gnarr Mok. I don't want to put any incase some other mod does that. It would be preferrable if the NPC didn't die along the way - they have a reasonable skill level and protection - the enemies aren't too tough - unless MCA is also loaded I suppose.

I feel trapped between leaving it very simple and just using the follow command and a complain message if outside the cells they are supposed to be in and using one of Grumpy's basic companions like the guard at Asgard and see how she works.

Thanks for the advice though - it is very much appreciated. Oh and one more thing - please can you tell me how do I do a cell check script for my NPC to complain if they are not in the correct cell?
User avatar
LuBiE LoU
 
Posts: 3391
Joined: Sun Jun 18, 2006 4:43 pm

Post » Fri May 27, 2011 2:12 pm

for cell check, you'll have to use GetPCCell or something close to that. so you're testing whatever cell the player is in.
User avatar
Ashley Campos
 
Posts: 3415
Joined: Fri Sep 22, 2006 9:03 pm

Post » Fri May 27, 2011 2:16 pm

Oops, I was imagining named cells... These cells aren't named, so it'll have to be done differently. I'm v. tired atm so take my advice with a grain of salt, but I'm thinking probably you could do this with activators along the road or something like that. Not sure how to do it efficiently though... I suppose you could getpos on the player and do the math... Erm, I'll think about it :embarrass:
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Fri May 27, 2011 10:49 pm

giving it some more thought, maybe you should use aitravel, sort of utilizing multiple waypoints in the script. then checking the distance from player, which would halt the npc until the player approaches. it wouldn't be that complicated, but it would be tedious. you could place hidden activators along the way which could trigger the dialog when the npc approaches, which can also work vaguely like a pathgrid. of course, using aitravel means that you won't have the perks of aifollow or aiescort, though you could easily script those too.

hmm, i'll see what i can think of, there are a lot of possibilities to approach for what you want.
User avatar
Charlotte Henderson
 
Posts: 3337
Joined: Wed Oct 11, 2006 12:37 pm

Post » Fri May 27, 2011 2:58 pm

giving it some more thought, maybe you should use aitravel, sort of utilizing multiple waypoints in the script. then checking the distance from player, which would halt the npc until the player approaches. it wouldn't be that complicated, but it would be tedious. you could place hidden activators along the way which could trigger the dialog when the npc approaches, which can also work vaguely like a pathgrid. of course, using aitravel means that you won't have the perks of aifollow or aiescort, though you could easily script those too.

hmm, i'll see what i can think of, there are a lot of possibilities to approach for what you want.


Thanks abyssmal terror

I had been planning on using activators as I need them regardless of how I get the NPC to get to them - whether using AIescort or a lite companion script - I've been looking at grumpy's Atheri script - she is a guard at Asgard who will follow along - I think I can amend it a little to suit my needs - it seems quite light

Begin AtheriScriptshort Companionshort variablenamefloat myxfloat myyfloat myzfloat timershort p_speedshort p_athleticsSet Companion to 1addtopic "-Together"addtopic "-Worth"addtopic "-Cast a spell."addtopic "-Sheath your weapon"addtopic "-How do you feel?"if ( menumode == 1 )  returnendifif ( Player->GetWeaponType <= 8 )  atheri->setmarksman 0	elseif ( Player->GetWeaponType >=9 )	atheri->setmarksman 1000  endifendifif ( GetCurrentAiPackage == 3 )  set p_speed to ( ( Player->GetSpeed ) + 85 )  set p_athletics to ( ( Player->GetAthletics ) + 85 )  SetSpeed, p_speed  SetAthletics, p_athleticsendifif ( GetCurrentAiPackage == 0 )  SetSpeed, 40  SetAthletics, 40endifif ( GetCurrentAiPackage == 3 )  if ( atheri->GetWeaponDrawn )  elseif ( atheri->GetSpellReadied )  return	elseif ( atheri->GetDistance Player > 800 )	set timer to timer + GetSecondsPassed	  if ( timer > 10 )	  set timer to 0	  set myx to ( Player->GetPos x )	  set myy to ( Player->GetPos y )	  set myz to ( Player->GetPos z )	  atheri->SetPos x myx	  atheri->SetPos y myy	  atheri->SetPos z myz	endif  endifendifif ( GetCurrentAiPackage == 3 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 1 )	  set myz to ( Player->GetPos z )	  SetPos z myz	endif  endifendifif ( GetCurrentAiPackage == 3 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 0 )	AIWander 0 0 0 0	endif  endifendifif ( GetCurrentAIPackage == 0 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 1 )	  AIFollow Player 0 0 0 0	  set myz to ( Player->GetPos z )	  SetPos z myz	 endif  endifendifend


I do have some questions about the code though - here they go

1. seeing as I don't require companion share for this NPC can I just delete the declaration of short Companion and the setting of that to 1?
2. how do the variables p_speed and p_athletics work?
3. the if statements often begin with GetCurrentAiPackage == 3 - what is this package?

Altheri has some dialogue where the player can ask her to levitate or waterwalk - the code in the result box goes

Goodbye cast atheri_levitate player


Is she casting that on herself on the player? If on the player how does she levitate?

It seems getting my NPc to complain when they are not where they should be is more difficult than I thought - in dialogue it seems I can only get named cells as you so rightly point out Melian - um -it's not too big a deal - perhaps I'll add a timelimit script so they can complain if their quest is not done within a couple of days.

As one extra point - I've built this mod so far using GMST vaccine and had no dependency on Tribunal - apart from the companion variable in Altheri's script is there anything else in it that is tribunal dependent?
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Fri May 27, 2011 6:44 pm

Thanks abyssmal terror

I had been planning on using activators as I need them regardless of how I get the NPC to get to them - whether using AIescort or a lite companion script - I've been looking at grumpy's Atheri script - she is a guard at Asgard who will follow along - I think I can amend it a little to suit my needs - it seems quite light

Begin AtheriScriptshort Companionshort variablenamefloat myxfloat myyfloat myzfloat timershort p_speedshort p_athleticsSet Companion to 1addtopic "-Together"addtopic "-Worth"addtopic "-Cast a spell."addtopic "-Sheath your weapon"addtopic "-How do you feel?"if ( menumode == 1 )  returnendifif ( Player->GetWeaponType <= 8 )  atheri->setmarksman 0	elseif ( Player->GetWeaponType >=9 )	atheri->setmarksman 1000  endifendifif ( GetCurrentAiPackage == 3 )  set p_speed to ( ( Player->GetSpeed ) + 85 )  set p_athletics to ( ( Player->GetAthletics ) + 85 )  SetSpeed, p_speed  SetAthletics, p_athleticsendifif ( GetCurrentAiPackage == 0 )  SetSpeed, 40  SetAthletics, 40endifif ( GetCurrentAiPackage == 3 )  if ( atheri->GetWeaponDrawn )  elseif ( atheri->GetSpellReadied )  return	elseif ( atheri->GetDistance Player > 800 )	set timer to timer + GetSecondsPassed	  if ( timer > 10 )	  set timer to 0	  set myx to ( Player->GetPos x )	  set myy to ( Player->GetPos y )	  set myz to ( Player->GetPos z )	  atheri->SetPos x myx	  atheri->SetPos y myy	  atheri->SetPos z myz	endif  endifendifif ( GetCurrentAiPackage == 3 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 1 )	  set myz to ( Player->GetPos z )	  SetPos z myz	endif  endifendifif ( GetCurrentAiPackage == 3 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 0 )	AIWander 0 0 0 0	endif  endifendifif ( GetCurrentAIPackage == 0 )  if ( Player->GetEffect, sEffectLevitate == 1 )	if ( GetEffect, sEffectLevitate == 1 )	  AIFollow Player 0 0 0 0	  set myz to ( Player->GetPos z )	  SetPos z myz	 endif  endifendifend


I do have some questions about the code though - here they go

1. seeing as I don't require companion share for this NPC can I just delete the declaration of short Companion and the setting of that to 1?
2. how do the variables p_speed and p_athletics work?
3. the if statements often begin with GetCurrentAiPackage == 3 - what is this package?

Altheri has some dialogue where the player can ask her to levitate or waterwalk - the code in the result box goes

Goodbye cast atheri_levitate player


Is she casting that on herself on the player? If on the player how does she levitate?

It seems getting my NPc to complain when they are not where they should be is more difficult than I thought - in dialogue it seems I can only get named cells as you so rightly point out Melian - um -it's not too big a deal - perhaps I'll add a timelimit script so they can complain if their quest is not done within a couple of days.

As one extra point - I've built this mod so far using GMST vaccine and had no dependency on Tribunal - apart from the companion variable in Altheri's script is there anything else in it that is tribunal dependent?


1) yes, you can just remove or comment out the companion declaration and initialization.
2) in this instance, it boosts the npc's speed and athletics to the player's + 85 so it can follow effectively
3) package 3 is aifollow

for npcs to script cast on themselves, you still have to state a target, so it's easiest to just use player, so they look at you when casting.

you can check the annoying pilgrim script for that kind of nagging of taking too long.

getweapontype is Tribunal dependant too.
User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am

Post » Fri May 27, 2011 8:01 am

1) yes, you can just remove or comment out the companion declaration and initialization.
2) in this instance, it boosts the npc's speed and athletics to the player's + 85 so it can follow effectively
3) package 3 is aifollow

for npcs to script cast on themselves, you still have to state a target, so it's easiest to just use player, so they look at you when casting.

you can check the annoying pilgrim script for that kind of nagging of taking too long.

getweapontype is Tribunal dependant too.


Excellent - thanks for the pilgrim reminder - I'll go have a look at that

And thanks for explaining how the npc casting works which now makes perfect sense to me

I'll think about whether I need the NPC to use a bow or not - I have them equipped with a sword only so might comment out that part of the script as well

EDIT: extra question

If the companion is in follow mod and I rest will the companion auto regenerate health and fatigue? Or do I need to add that to the script?

If so would it look like this?

if ( GetCurrentAIPackage == 3 )  if (GetPCSleep == 1 )  set p_health to ( Player->Gethealth )  set p_magicka to ( Player-> Getmagicka )  set p_fatigue to ( Player->Getfatigue )  endifendif


assuming I had added a short p_health at the beginning of the script etc

Thanks
User avatar
Andrew Lang
 
Posts: 3489
Joined: Thu Oct 11, 2007 8:50 pm

Post » Fri May 27, 2011 8:14 pm

The simplest method of walking your NPC from Gnaar Mok to Caldera is AIFollow and trusting to the player to guide the NPC as instructed. Making it a timed-quest (such as with the Official quest Viatrix, The Annoying Pilgrim) will prevent the player from abusing your quest. Alternately it might be possible to perform a GetPCCell Check for "Bitter Coast Region" and "West Gash Region". If not true then you know the player has 'gone rogue'. It that does not work, checking GetInterior == 1 will let you know if the player has led your NPC into an interior cell (where the worst mischief tends to occur). If you require actual dialog, you can declare a short variable that is set by the script if the player wanders off-task that can filter the NPC's reproachful greeting.

If you choose either AITravel or AIEscort, you will need to move between intermediate waypoints linking Gnaar Mok and Caldera since pathgrids do not extend across cell boundaries. Which function you choose depends of the effect you want to achieve. AITravel moves independent of the player - the only requirement is that the NPC's cell is currently loaded (the player is near). AIEscort has the NPC lead the player (as opposed to AIFollow), if the player is not very close the NPC will not move at all. Messageboxes (I prefer to ForceGreeting for effect) can prompt the player along, and if the player is uncooperative you can even terminate the quest (Natesse in LGNPC Tel Mora does all this I describe).

If you decide to go with AITravel or AIEscort and are uncertain how to choose waypoints and script the travel, I am happy to help you with that process. I have sketched a new traveling for the update for Traveling Merchants that traverses the very route you describe. I have the waypoints although I had not completed the script at the time I suspended work on the mod last May.
User avatar
Claire Jackson
 
Posts: 3422
Joined: Thu Jul 20, 2006 11:38 pm

Post » Fri May 27, 2011 9:19 pm

The simplest method of walking your NPC from Gnaar Mok to Caldera is AIFollow and trusting to the player to guide the NPC as instructed. Making it a timed-quest (such as with the Official quest Viatrix, The Annoying Pilgrim) will prevent the player from abusing your quest. Alternately it might be possible to perform a GetPCCell Check for "Bitter Coast Region" and "West Gash Region". If not true then you know the player has 'gone rogue'. It that does not work, checking GetInterior == 1 will let you know if the player has led your NPC into an interior cell (where the worst mischief tends to occur). If you require actual dialog, you can declare a short variable that is set by the script if the player wanders off-task that can filter the NPC's reproachful greeting.

If you choose either AITravel or AIEscort, you will need to move between intermediate waypoints linking Gnaar Mok and Caldera since pathgrids do not extend across cell boundaries. Which function you choose depends of the effect you want to achieve. AITravel moves independent of the player - the only requirement is that the NPC's cell is currently loaded (the player is near). AIEscort has the NPC lead the player (as opposed to AIFollow), if the player is not very close the NPC will not move at all. Messageboxes (I prefer to ForceGreeting for effect) can prompt the player along, and if the player is uncooperative you can even terminate the quest (Natesse in LGNPC Tel Mora does all this I describe).

If you decide to go with AITravel or AIEscort and are uncertain how to choose waypoints and script the travel, I am happy to help you with that process. I have sketched a new traveling for the update for Traveling Merchants that traverses the very route you describe. I have the waypoints although I had not completed the script at the time I suspended work on the mod last May.


Thank you so much for offerring to help Cyrano - I really appreciate it very much

I would like to learn how to use activators and AIescort - I also haven't used messageboxes yet so would find it very useful to learn how to incorporate those

This quest is fairly well along in the mod and I provide plenty of outs for the player previously so I suspect if they get to this point then they are committed to finding out what happens.

AI Escort seems the best way to not take the NPC off on a treasure hunt - I think a timer will still be useful to get teh job done and I have been wanting to do a timer mission later on so this would be excellent practice for setting that up.

I would like the dialogue to begin in an interior cell where the NPC asks if you are ready to accompany then or not - I suspect the easiest task is to say they will meet the player in Caldera and have them waiting by the correct gate. I was thinking their greeting could be simple - are you ready yes/no and if yes then begin the AIEscort script

Since the path will take them by the Naked Nord - I'd like to do a journal check near him and make a dialogue comment - I need to get them to the signposts and stop at each one

Any recommendations on what I do first?
User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Fri May 27, 2011 3:56 pm

This is something best approached in stages. I assume this is a one-way journey (that will affect how the travel script should be structured). I can create a template script for you and once you have the waypoint coordinates you can insert them into the template and expand the code to accommodate all of your waypoints. After you do that we can insert the code that will time the quest and give the player reminders to keep up and how much time they have to complete the journey. Starting the quest from Caldera's gate, but it can also be started from an interior cell in Caldera with little extra trouble should you wish (this was done with Natessa). Wherever it begins, dialog will set a local variable in the travel script that will initiate the AIEscort.

What you need to do is get the waypoints for the journey from Caldera to Gnaar Mok. I suggest you do this in-game. Load your player up with torches (my preference for this process):

player->AddItem "torch" 30

That is just for a start - my route between Gnaar Mod and Caldera has 61 waypoints. I suggest you make yourself invisible so you will not be molested by creatures and such as you cross the wilderness:

player->SetInvisible 1

Move to the starting point of your journey and drop a torch at your feet. Grab the coordinates of the torch. Select it through the console and type:

GetPos x
GetPos y
GetPos z


Record these values for point 1, and very briefly describe the location (e.g. Caldera gate). Follow the path you want the NPC to take. From time to time drop another torch and find its coordinates as before. Identify each point in your journey sequentially and briefly describe it (e.g. signpost - Caldera, large boulder, base of rise, top of rise, turn in path, naked Nord, etc.). The distance between waypoints best not exceed approximately 2000 units (straight path, no obstacles), but you may require closer spacing when maneuvering around obstacles or where there are turns in the path. Each waypoint will result in the NPC pausing very briefly before continuing to the next point so long smooth courses are nice. The benefit of using torches to mark your route is you can more easily look back on the traverse and see if there is anything that you would like to change. Make a note of waypoints for which you want something special to happen so the code for that event can be added to for filtered for the correct point.

While you are doing that, I will put together a script for a template including rescue code in case the AIEscort is interrupted. If I have not made my instructions clear, please let me know.
User avatar
Yonah
 
Posts: 3462
Joined: Thu Aug 02, 2007 4:42 am

Post » Fri May 27, 2011 9:24 am

*snip*
Move to the starting point of your journey and drop a torch at your feet. Grab the coordinates of the torch. Select it through the console and type:

GetPos x
GetPos y
GetPos z


While you are doing that, I will put together a script for a template including rescue code in case the AIEscort is interrupted. If I have not made my instructions clear, please let me know.


Sorry cyran0 my first problem is with the GetPos not working in the console - maybe I'm doing something wrong here - I open up the console type in each of those commands while pointing at the torch and nothing happens - made sure i typed it exactly as shown in the previous post - if I just place an NPC in the construction set and use the f key to drop it to the ground level will that do? I think I can read the coordinates from there.

On a positive note I enjoyed spending some time testing my mod and did some dialogue and scenery checks - it was great to see the characters come to life so to speak.
User avatar
Shiarra Curtis
 
Posts: 3393
Joined: Thu Jan 04, 2007 3:22 pm

Post » Fri May 27, 2011 6:56 pm

It sounds (from what you write) as if you are hovering the mouse over the torch while the console is open. You need to 'select' it while the console is open - click on the torch so that its ID is displayed at the top of the console window. Then the console functions will apply to that object and return its coordinates. This process must be completed for each torch dropped or the console will continue to return the coordinates of the previously selected torch.

Also, please confirm if this is a one-way journey.
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Fri May 27, 2011 7:27 am

It sounds (from what you write) as if you are hovering the mouse over the torch while the console is open. You need to 'select' it while the console is open - click on the torch so that its ID is displayed at the top of the console window. Then the console functions will apply to that object and return its coordinates. This process must be completed for each torch dropped or the console will continue to return the coordinates of the previously selected torch.

Also, please confirm if this is a one-way journey.


My apologies cyran0 - I'll go try that - and yes it is a onw way trip at the end - if the NPC survives they will disappear - am using a clone so will use a globa state to disable enable via dialogue

Will post the waypoints later today
User avatar
Stefanny Cardona
 
Posts: 3352
Joined: Tue Dec 19, 2006 8:08 pm

Post » Fri May 27, 2011 8:56 pm

Um are you sure you want me to post the waypoints - there are so many (25 * 3) and I'd hate you to have the tedium of typing them in - I'm not so fond of the tedium myself but keen to do it. I've used waypoints in space games before so had a good idea of how to keep it smooth - there are a few curves on the back road I took but it seemed to work ok - there was one cliffracer that took me on - which made me wonder what happens to the NPC if they see me attacked? they will have the guard status so if their walk is interrupted how will they get going again?

Will i need to put an activator precisely on the waypoint or just near it?

Before you do anything can you have a look at what I wanted to do withe quest and check whether the AIEscort may in fact be too problematic and whether i should stick to a companion style trip

The intent of the quest was to help a scout

Their job is to inspect the signposts along the road from Caldera to Gnarr Mok - once they get to the first signpost by the Naked Nord they were to stop make a comment and then carry on - at the next signpost again they were to pause comment and move on - as you round the hill and head down to the bittercoast there is a sign outside the Band egg Mine - ideally i wanted a small altercation with some to occur here

There is now a long walk between here and Gnarr Mok - i was keen to do some conversation along here at the signs at Gnarr Mok I wanted another ambush - however if the player has high enough speechcraft skills they can talk their way out of it otherwise it's all on - if the scout survives the fight then I want them to thank the player and say they will find their own way back.

What concerns me with AIescort is the number of interrupts to the walk and therefore how the NPC gets back on track after being interrupted?
User avatar
Bitter End
 
Posts: 3418
Joined: Fri Sep 08, 2006 11:40 am

Post » Fri May 27, 2011 6:57 pm

I will leaving for work soon so I cannot reply in detail, but I will clarify a few things. It is not my intention that you post your waypoints, I will post the template script for you to insert the waypoint yourself.

I do not know what your activator is intended to do so I do not know where it should be placed. I cannot imagine too many instances where an activator would need to be place on a waypoint. If this is just an invisible scriptholder then it can be place anywhere in the cell.

AIEscort can be used with the scenario you described. At those waypoints that correspond to a signpost, we can add code that will make your scout appear to inspect the signpost. An additional piece of information might be helpful - the facing of the NPC when standing at the waypoint looking in the direction of the signpost. Actually, better would be the coordinates of the signpost so I can use the script function Face.

The ambush can be scripted. If there will be a journal entry associated with it, the scout's travel script can check that before continuing, or it can check for the dead count of the ambusher's. Alternately, you might trigger dialog (ForcedGreeting) after the assailants are killed that can trigger the continuation of the journey through dialog results.

The interruptions are not a problem so long at the interrupts are anticipated. When you want the journey to continue the travel script will issue AIEscort to the next waypoint. Should the player initiate dialog along the journey, there will be a delay after dialog is closed (just as when the player passes near an NPC in town and triggers an idle greeting. You need not worry about the latter occurring with your scout - the script will set Hello to 0 for the journey.

To make the long walk more interesting, you could script some messagebox comments at various places remarking on the surroundings, or the scout's mission or the weather. Keep a note of where you would like such 'spontaneous' comment to occur along the journey (like with Natesse). If you really want to get crazy, you could add voiced comments!
User avatar
R.I.P
 
Posts: 3370
Joined: Sat Dec 01, 2007 8:11 pm

Post » Fri May 27, 2011 1:10 pm

I will leaving for work soon so I cannot reply in detail, but I will clarify a few things. It is not my intention that you post your waypoints, I will post the template script for you to insert the waypoint yourself.


Oh thank goodness i didn't type them in then :)

I do not know what your activator is intended to do so I do not know where it should be placed. I cannot imagine too many instances where an activator would need to be place on a waypoint. If this is just an invisible scriptholder then it can be place anywhere in the cell.


That's ok I don't know what I'm talking about - was just trying to understand how AIescort used the x,y,z refereneces

AIEscort can be used with the scenario you described. At those waypoints that correspond to a signpost, we can add code that will make your scout appear to inspect the signpost. An additional piece of information might be helpful - the facing of the NPC when standing at the waypoint looking in the direction of the signpost. Actually, better would be the coordinates of the signpost so I can use the script function Face.


I'm not sure that is an issue - I don't mind if the NPC is not looking at the signposts as long as they are in close proximity to them - and I dropped the torch when I could read the sign.

The ambush can be scripted. If there will be a journal entry associated with it, the scout's travel script can check that before continuing, or it can check for the dead count of the ambusher's. Alternately, you might trigger dialog (ForcedGreeting) after the assailants are killed that can trigger the continuation of the journey through dialog results.


Yes that was what I had in mind

The interruptions are not a problem so long at the interrupts are anticipated. When you want the journey to continue the travel script will issue AIEscort to the next waypoint. Should the player initiate dialog along the journey, there will be a delay after dialog is closed (just as when the player passes near an NPC in town and triggers an idle greeting. You need not worry about the latter occurring with your scout - the script will set Hello to 0 for the journey.


Oh good I was worried about that

To make the long walk more interesting, you could script some messagebox comments at various places remarking on the surroundings, or the scout's mission or the weather. Keep a note of where you would like such 'spontaneous' comment to occur along the journey (like with Natesse). If you really want to get crazy, you could add voiced comments!


I think the message boxes would work - though ideally i would prefer ones with the ability to select a choice as a return comment?

Oh and thanks for helping - it's very generous of you to do so.
User avatar
Jamie Lee
 
Posts: 3415
Joined: Sun Jun 17, 2007 9:15 am

Post » Fri May 27, 2011 7:44 pm

Here is the travel script to attach to your scout. However I have been thinking it might be more efficient for this sort of information to be passed as an attachment on an email so the formatting (tabs) can be preserved. If you would prefer to that approach send me an email address via personal message. An alternative would be for me to upload the file if email is problematic.

I added the short variable escortPlayer for a dialog filter - it might be more convenient than a journal index in some cases. Its value can be set through dialog.

The float variable playerDistance may not be as important in this relatively simple travel script, but there are a few times when there might be multiple distances checks per frame so this is more efficient.

The float variable pauseTimer is used to time how long the scout will muse over the signpost. I know you do not regard it as necessary, but it is a small matter to have the scout face the signpost. I have a few different idle animations called for short duration: scratching head, crouching to look at base of signpost (ForceSneak) and then shifting weight between legs. You can alter my durations as you wish or disregard them altogether. If you think other animations would be appropriate it is easy to modify the code to accommodate them.

Since there are multiple signposts along the way, I made a sort of subroutine for them. Once the scout reaches the waypoint of a signpost, the current state is stored and then it is set to 1000 (an arbitrary value for now - it will have to be set higher than your last normal travel state). There it cycles through the scripted business at the signpost and then returns to the place in the normal travel code that it left.

The float variable npcX stored the scout's position and checks it five seconds later (using the float variable stallTimer) to see if the scout has moved. If not, this indicates that the player is not close enough for scout to continue to next waypoint and triggers a messagebox prompt to the player. The short playerAdmonished keeps track of how many times the player needs to be reminded. The first is a kindly warning, the second asks the player if he/she wants to part ways. This communicate is made only if the player is within reasonable speaking distance. To answer your question, yes messageboxes can allow the player to make a decision. I do not know if you want this particular choice for the player or how you would want to resolve the matter if the player abandons the quest (however unlikely). This code must be prevented from processing while scout is inspecting signposts.

The short debugOn toggles messages that display every three seconds returning values for the critical travel code variables to help troubleshoot problems with the script. It is strictly for testing and is set through the console when necessary.

We have spoken of timing the quest to keep the player on task. With AIEscort (or AITravel) that is not as much of an issue. The quest can still be timed, but using a local script to keep track of time is problematic with the Morrowind Code Patch Calendar Fix. Either a global script or reliance on the unreliable global variable DaysPassed is necessary. I have scripted a provision to terminate the quest if the player is more than 5000 units away (abandons the scout). Any way that is triggered there still needs to be a way to disable the scout at the conclusion (or premature termination) of the quest. I like CellChanged, but since we are already checking distance with this script that works as well (a combination is even safer). Disabling on CellChanged or at great distance preserves immersion.

One advantage of using AITravel over AIEscort (and it is not too late to change) is the scout could continue on his/her way should the player leave (or fall behind). The code can still prompt the player to keep up if the quest is still active.

To edit the basic travel code, replace the coordinates x y z for the AIEscort instructions (and update the comment for point number and description). The travel code occurs in pairs: one state issues the travel instructions (AIEscort) and the second checks to see if the NPC has arrived (GetAIPackageDone). This block of two are duplicated for each waypoint that you have.

Where you have special instructions (such as messageboxes or signpost examination) additional code need be inserted. I have an example of the signpost code for the entry state == 500 but that is an arbitrary value just used as an example. Substitute that code in place of the usual GetAIPackageDone code wherever it is needed. That directs to the subroutine and then the next block is business as usual.

I expect you will have questions, and there are modifications that will need to be made to accommodate other actions you want scripted. As I wrote earlier, it might be more efficient to do that sort of thing through email or personal message where I can send you formatted code.

I know you are grateful for the help and you are most welcome. We scripters are problem-solvers and we love to solve puzzles. That is one of the reasons we enjoy helping others with their scripting challenges - the other reason is we look forward to the day that we can play your wonderful mod. We are a selfish lot after all. ;)


Begin IllyTravel; Attached to NPC scout.; Directs travel from Caldera to Gnaar Mok.short noLore; dialog filtershort escortPlayer; dialog filter (optional);	-1 = quest completed;	0 = quest not initiated;	1 = quest active - currently traveling togethershort stateshort saveStatefloat timerfloat timeoutfloat playerDistancefloat pauseTimerfloat npcX; stores NPC's position float stallTimershort playerAdmonishedshort buttonshort debugOn; toggles debug codefloat debugTimerif ( menumode == 1 ); if menu is open do not process	returnendifset playerDistance to ( GetDistance player ); for efficiency; NAG PLAYER TO KEEP UPif ( GetCurrentAIPackage == 2 ); check to see if player is keeping up	if ( state < 1000 ); not inspecting signpost		set stallTimer to ( stallTimer + GetSecondsPassed )		if ( stallTimer >= 5 )			set stallTimer to 0			if ( ( GetPos X ) == npcX ); has not moved for 5 seconds				if ( playerDistance < 1500 ); within speaking distance					if ( playerAdmonished == 0 )						set playerAdmonished to 1; 						Messagebox "Please, ^PCName... try to keep up."; prompt player to follow					elseif ( playerAdmonished == 1 )						set playerAdmonished to 2; 						Messagebox "I cannot wait on you forever, ^PCName. Are you still interested in accompanying me?" "Yes, I am sorry for the delay - I am coming." "Perhaps it is better that we part ways."					endif				endif			endif		endif		set npcX to ( GetPos X ); store current position	endifendifif ( playerAdmonished = 2 )	set button to GetButtonPressed	if ( button == -1 ); no button pressed		return	elseif ( button == 0 ); player chooses to continue		set playerAdmonished to 0; reset		Messagebox "Then let's continue."	elseif ( button == 1 ); player leaves		set playerAdmonished to -1; its over		AIWander 512 5 0 0 20 10 10 10 20 0 0 0; adjust idles to suit		set state to 3000	endifendif; DEBUG MESSAGES - displays values of local variables for troubleshootingif ( debugOn == 1 ); set through console - display messages	set debugTimer to ( debugTimer + GetSecondsPassed )	if ( debugTimer >= 3 )		MessageBox "Debug: state = %.0f saveState = %.0f timer = %.2f timeout = %.2f" state, saveState, timer, timeout		set debugTimer to 0	endifendif; STALLED SCRIPT RESCUE - Recovers script after leaving a cell or resting.if ( playerDistance < 5000 )	if ( GetCurrentAIPackage == -1 )		set timeout to ( timeout + GetSecondsPassed )		if ( timeout >= 3 )			set state to ( state - 10 ); stall occurs at AIPAckageDone - re-issue AIEscort			set timeout to 0		endif	else		set timeout to 0	endifelse;	abort? player has walked away.endifif ( state <= -20 ); stall rescue failed	set state to 990; set to highest relevant (travel) stateendifif ( state == 0 ); not yet traveling	returnendif; START WALKING - travel codeelseif ( state == 10 ); set through dialog	SetHello 0; prevent idle greetings	AIEscort player 0 x y z 0; point 1 - Caldera gate	set state to ( state + 10 )elseif ( state == 20 )	if ( GetAIPackageDone == 1 ); NPC at point 1		set state to ( state + 10 )	endifelseif ( state == 30 )	AIEscort player 0 x y z 0; point 2 - turn	set state to ( state + 10 )elseif ( state == 40 )	if ( GetAIPackageDone == 1 ); NPC at point 1		set state to ( state + 10 )	endif; duplicate state == 30 and state == 40 blocks for each waypointelseif ( state == 500 )	if ( GetAIPackageDone == 1 ); NPC at point x - signpost		Face x y		set saveState to state; store current state		set state to 1000	endifelseif ( state == 510 ); set by return from signpost inspection	AIEscort player 0 x y z 0; point y	set state to ( state + 10 )elseif ( state == 1000 ); check out signpost	AIWander 0 0 0 0 0 0 100 0 0 0 0 0; scratches head	set state to 1010elseif ( state == 1010 )	set pauseTimer to ( timer + GetSecondsPassed )	if ( pauseTimer < 5 )		return	endif	set pauseTimer to 0; reset for next time	AIWander 0 0 0 100 0 0 0 0 0 0 0 0; standing	ForceSneak; inspects base of signpost	set state to 1020elseif ( state == 1020 )	set pauseTimer to ( timer + GetSecondsPassed )	if ( pauseTimer < 3 )		return	endif	set pauseTimer to 0; reset for next time	ClearForceSneak	AIWander 0 0 0 100 0 0 0 0 0 0 0 0; shifting weight	set state to 1030elseif ( state == 1030 )	set pauseTimer to ( timer + GetSecondsPassed )	if ( pauseTimer < 10 )		return	endif	set pauseTimer to 0; reset for next time	set state to ( saveState + 10 ); continue journey from previous pointelseif ( state == 2000 ); arbitrary terminal state	if ( GetAIPackageDone == 1 ); NPC at point x - Gnaar Mok		SetHello 30; normal idle greetings		AIWander 512 5 0 0 20 10 10 10 20 0 0 0; adjust idles to suit		set state to 2010	endifendif; this is end of travel elseifsif ( state == 2010 ); action upon reaching Gnaar Mokendifif ( state == 3000 ); player abandons	set state to 3010endifEnd IllyTravel

User avatar
Blaine
 
Posts: 3456
Joined: Wed May 16, 2007 4:24 pm

Post » Fri May 27, 2011 11:48 pm

So I've re-read this a few times and maybe need to break it down with you into more digestable pieces to begin with

Some more background on the scout

I intended her to be able to several quests with the player hence the topic lite companion

The postal route is the first quest and is intended for her to take the lead - if successful she will have another quest where she takes the lead - she then has another quest but this time it is up to the player to decide whether to take the lead or leave her behind a simple AI follow would work - however after that I would like her to move into lite companion mode where the player can take her with him/her if they wish

My first question is for the initial quests would it be easier for me to use clones using a global state to enable/disable them at appropiate points - or do I have a master script that references each of the other travel scripts?

Second question - I'm still foggy about where I enter the waypoints into the script? this section was unclear to me

; START WALKING - travel codeelseif ( state == 10 ); set through dialog	SetHello 0; prevent idle greetings	AIEscort player 0 x y z 0; point 1 - Caldera gate	set state to ( state + 10 )elseif ( state == 20 )	if ( GetAIPackageDone == 1 ); NPC at point 1		set state to ( state + 10 )	endifelseif ( state == 30 )	AIEscort player 0 x y z 0; point 2 - turn	set state to ( state + 10 )elseif ( state == 40 )	if ( GetAIPackageDone == 1 ); NPC at point 1		set state to ( state + 10 )	endif; duplicate state == 30 and state == 40 blocks for each waypoint


I really like the idles you thought up and the message box is good - though I suspect if the player abandons her I think I would prefer to disable her once the player leaves the cell - a journal entry will come later saying she came to a sticky end on her own.

Also if my waypoint crosses between cells eg westgash into bittercoast - will that impact the NPC?
User avatar
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm

Post » Fri May 27, 2011 12:12 pm

@ Cyrano:
Sorry to butt in again, just wanted to ask: Why would DaysPassed be unreliable? :unsure:

@ Illuminiel:
Sorry about earlier - I was kinda offering to draft a companion script, only I didn't make that clear and then I just wandered off. But since you decided to use travel/escort Cyrano is a much better helper anyway, so I guess that's OK B)

On topic... If you plan to have the NPC as possibly a "normal" companion later, I'd put all the once-off quest stuff (like quest escorts script) as separate scripts, not in the local script. IMO it's just so much easier to manage (even with "lite" companions ;) ), plus it may well end up being be more efficient, depending on the scripts. Another advantage is that if this escort isn't in the local script, you can know if the player is in a different cell than the NPC, and disable the NPC if you want. A local script won't run when the player isn't there, so it can't do that so easily.

Clones would be a good alternative if you want the scripts as local scripts - the scripts can still be broken up into separate quests that way (so they'd each have a different script).

PS You'd enter the waypoints here (the bits in bold):
AIEscort player 0 x y z 0

User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Fri May 27, 2011 10:12 pm

Illuminiel: I received your personal message and email address. Should we need to pass the travel script between us an email attachment will be much more efficient.

My first question is for the initial quests would it be easier for me to use clones using a global state to enable/disable them at appropiate points - or do I have a master script that references each of the other travel scripts?

Both are valid approaches as melian confirms. The travel script for this one adventure will be so long that it may not be possible to script the second AIEscort adventure this way. I think clones can be problematic where dialog is concerned - particularly if that dialog toggles local variables. It might involve having to duplicate more dialog than you would like. The travel script can be run as a global however its local variables cannot be used as dialog filters. However such local filters can be declared on your scout's local script and their values set remotely by the global travel script if necessary. Another matter is that all instructions referencing the scout will have to be explicit using a fix - it cannot be implied as it is currently. This mean:

set playerDistance to ( GetDistance player ) ; for efficiency BECOMES
set playerDistance to ( "Scout_ID"->GetDistance player ) ; for efficiency

if ( GetCurrentAIPackage == 2 ) ; check to see if player is keeping up BECOMES
if ( ( "Scout_ID"->GetCurrentAIPackage ) == 2 ) ; check to see if player is keeping up

if ( GetCurrentAIPackage == -1 ) BECOMES
if ( ( "Scout_ID"->GetCurrentAIPackage ) == -1 )

SetHello 0 ; prevent idle greetings BECOMES
"Scout_ID"->SetHello 0 ; prevent idle greetings

AIEscort player 0 x y z 0 ; point 1 - Caldera gate BECOMES
"Scout_ID"->AIEscort player 0 x y z 0 ; point 1 - Caldera gate

if ( GetAIPackageDone == 1 ) ; NPC at point 1 BECOMES
if ( ( "Scout_ID"->GetAIPackageDone ) == 1 ) ; NPC at point 1

Face x y BECOMES
"Scout_ID"->Face x y

AIWander 0 0 0 0 0 0 100 0 0 0 0 0 ; scratches head BECOMES
"Scout_ID"->AIWander 0 0 0 0 0 0 100 0 0 0 0 0 ; scratches head

ForceSneak ; inspects base of signpost BECOMES
"Scout_ID"->ForceSneak ; inspects base of signpost

ClearForceSneak BECOMES
"Scout_ID"->ClearForceSneak

...and all over such instances throughout the script. (Perhaps is it about time you revealed the ID of the scout so I can reverence it directly.) The only concern I have it the effect these extra instructions have on the size of the script. It could become so large that it may bump its head on the script buffer size - I suppose we will deal with that if it happens.

It is not possible to toggle the local short debugOn remotely, but it could be declared as a global variable or simply discard the debug code. The good news is that the global script can accurately monitor the passage of time should you choose to make this a timed quest.

Second question - I'm still foggy about where I enter the waypoints into the script? this section was unclear to me

I could not have put it any better than melian:

AIEscort player 0 x y z 0

I really like the idles you thought up and the message box is good - though I suspect if the player abandons her I think I would prefer to disable her once the player leaves the cell - a journal entry will come later saying she came to a sticky end on her own.

Not a problem - even more reliable as a global script. It should be coupled with a distance check since the player and the scout will cross several cell boundaries during their journey together. Using the current code's playerDistance will be adequate in most instances. I already have a section of code for you to insert the journal update and disable the scout:

if ( playerDistance < 5000 )else	Journal "Journal_ID" 200; or whatever the index is	"Scout_ID"->Disable	StopScript "IllyTravel"; or whatever it will be namedendif

A positive check for interior cell would also be an indication of the player abandoning the scout (and a good way to disable the scout after the quest is completed if that is appropriate):

if ( GetInterior == 1 ); player indoors	if ( ( GetJournalIndex "Journal_ID" ) < 100 ); quest not completed successfully		Journal "Journal_ID" 200; or whatever the index is	endif	"Scout_ID"->Disable	StopScript "IllyTravel"; or whatever it will be namedendif

If you still want to have a time limit, I will have to add some additional code but I will not speculate about that until you confirm how you want to handle it (it will be easy).

Also if my waypoint crosses between cells eg westgash into bittercoast - will that impact the NPC?

This will not be a problem. Pathgrids do not cross cell boundaries, but AITravel and AIEscort can take you any where so long as there is a clear line of sight between waypoints (or a working pathgrid).

@ Cyrano:
Sorry to butt in again, just wanted to ask: Why would DaysPassed be unreliable?

DaysPassed is not a reliable keeper of the passage of time. It will work in some circumstances and not in others, and it is pretty much impossible to know when that is going to be. It depends on the combination of master and plugin files that are running when your mod is being used. Here is an explanation from JOG from the old forum.

A Mod that requires Bloodmoon won't work when you don't have Bloodmon.

If you need to use Dayspassed (there are other ways to count days) you need to use Tribunal.ESM as Master File.

The Bloodmoon and Tribunal Master-Files are nothing but Plugins, the functionality of the global variables Gamehour, Day, Dayspassed, Month and Year is hard-coded in Morrowind.EXE. But since Dayspassed didn't exist before Tribunal, the variable is included in Tribunal.ESM and only this one works reliable. A new global variable defined in a non-tribunal mod, won't conflict with existing Dayspassed-Scripts but won't work either. (At least not reliable)

And a few posts later?

Once the script is compiled, variables aren't accessed by their name but by an internal index-number, thus the compiled scripts in a Tribunal mod and those in a non-Tribunal mod use different variables.

Dayspassed works fine with v1.0 - v1.2 (Vanilla Morrowind) You don't even need to declare it if you just want to read it. If you actually want to change the current day, you have to declare it, though. (Remember? I was the one who found this "hidden global" while working on Haldenshore two months before Tribunal came out...)

Dayspassed also works fine with v1.3 and v1.4 (Tribunal only) when your mod IS dependent on Tribunal.esm. No need to declare it.

The variable also works with v1.5 and v1.6 (Bloodmoon only, Tribunal NOT installed) as long as you declare it. It will no longer work when you don't declare the variable.

And finally it also works fine with v 1.5 and v1.6 (Tribunal AND Bloodmoon installed) as long as your mod IS dependent on Tribunal.esm. (No need to declare the variable)

So... when is Dayspassed NOT working or at least not reliable? Well, this happens with v1.3 - v1.6 when you HAVE Tribunal installed, but your mod IS NOT dependent on Tribunal.esm:
? If you don't declare the variable MW crashes or returns an left-eval error when you try to use it in the script (the Construction set accepts the script without problems)
? If you declare the variable in an ESP that is not dependent on Tribunal.esm, the script works but the Dayspassed-Variable that is used by your scripts will never be count up
? If you declare the variable in an ESM that is not dependent on Tribunal.esm, the Dayspassed-Variable from your mod is count up but the one used by Tribunal and Tribunal-dependent ESP's isn't.
? If another non-tribunal ESM declares the variable, and this other mod has a later file-date than your own, then your mod will share Tribunal's fate, and the Dayspassed variable used by your scripts will also cease to work.

In short, if you want to know for certain that your script will reckon time accurately, then you had better use a workaround rather than DaysPassed. The easiest is a global script that checks for when the Day value is not the same as a stored value, sets them equal and updates a counter. Or you can store the current day, month and year in your local script, and compare them to the current values when the player returns to the cell.

The former might look something like this (it sounds like you are inserting this into an existing script). However for this to work reliably, the script must process the whole time (i.e., it must be global or always in the same cell as the player if local). If you need self-terminating global script to update your variable then post again if you need help.

short daysElapsedif ( currentDay == Day )   returnendifset daysElapsed to ( daysElapsed + 1 )if ( daysElapsed >= 4 ); 3 days passed since count starts at 1   set yourVariable to 2endif

You can also incorporate a GameHour check if you want your three days to actually be 72 hours.
User avatar
Tanika O'Connell
 
Posts: 3412
Joined: Fri Jan 26, 2007 1:34 am

Post » Fri May 27, 2011 12:50 pm

Re DaysPassed:
As I read it, JOG is just saying that a script using DaysPassed has to depend on Tribunal.esm. Or did I miss something there?

It didn't occur to me before that you couldn't declare your own DaysPassed though. I've never really thought much about it to be honest, but it makes sense. Hm, I wonder if it would keep the correct id if you added the var by loading Tribunal.esm with your mod, then delete and undelete dayspassed and remove the Tribunal dependency after you save...? Or easier, drag and drop in MWEdit... :unsure:

Back on topic: Illuminel, if you want a normal companion script, I can do one for you if you want. Companion share is easy btw: if you want it enabled after the quests that's not a problem (and if you don't want it that's fine too). I like scripting companions, I just hate the dialogue part ;)
User avatar
Soraya Davy
 
Posts: 3377
Joined: Sat Aug 05, 2006 10:53 pm

Post » Fri May 27, 2011 11:00 pm

Re DaysPassed:
As I read it, JOG is just saying that a script using DaysPassed has to depend on Tribunal.esm. Or did I miss something there?

It didn't occur to me before that you couldn't declare your own DaysPassed though. I've never really thought much about it to be honest, but it makes sense. Hm, I wonder if it would keep the correct id if you added the var by loading Tribunal.esm with your mod, then delete and undelete dayspassed and remove the Tribunal dependency after you save...? Or easier, drag and drop in MWEdit... :unsure:

Back on topic: Illuminel, if you want a normal companion script, I can do one for you if you want. Companion share is easy btw: if you want it enabled after the quests that's not a problem (and if you don't want it that's fine too). I like scripting companions, I just hate the dialogue part ;)


Thanks Melian - that's very kind - I am interested in a lite version - there is a developing story line for this NPC - http://img207.imageshack.us/img207/6151/rgf01scout.png is a telvanni scout apprentice - she's not heavily armed or armoured but proud of what she does own

I never really wanted to do a companion mod in the sense of taking someone around Vvardenfell but rather to have her available for certain missions of her own - as the story develops I wanted to switch her into follow mode for some ruins and mine exploration quests.

Grumpy's script for his Asgard guard seems to be where I want to go - via dialogue to do a health check, stay or follow and return to base teleportation. I would like her to be able to recover her health from resting and had in mind a piece of dialogue that allows her to get rid of any disease she may of picked up.

Am still unsure whether to clone her for the first quest that Cyrano is helping me on or not - via dialogue it is easy for me not to add her companion topics till later

Would be delighted to get your advice. Something of which I cannot get enough when modding :)

@Cyrano - am still reading through the last post you made - and will reply soon
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am

Post » Fri May 27, 2011 11:00 pm

Illuminiel: I received your personal message and email address. Should we need to pass the travel script between us an email attachment will be much more efficient.


Both are valid approaches as melian confirms. The travel script for this one adventure will be so long that it may not be possible to script the second AIEscort adventure this way. I think clones can be problematic where dialog is concerned - particularly if that dialog toggles local variables. It might involve having to duplicate more dialog than you would like. The travel script can be run as a global however its local variables cannot be used as dialog filters. However such local filters can be declared on your scout's local script and their values set remotely by the global travel script if necessary. Another matter is that all instructions referencing the scout will have to be explicit using a fix - it cannot be implied as it is currently.
*snip*


I don't mind clones and have used them earlier in the mod - it actually helps me to get rid of redundant topics :)

However happy to follow your recommendation

If you still want to have a time limit, I will have to add some additional code but I will not speculate about that until you confirm how you want to handle it (it will be easy).


I might just keep this a bit simpler and drop the time limit - the pre-quest dialogue gives an opportunity to opt out - so if the player wishes to go they are likely to be more committed to seeing it through - however if she gets abandoned I'd like to have her disabled.

Currently her id is CT_Lairah - if a clone then it will be CT_Lairah01
User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Next

Return to III - Morrowind