Illy's lite Companion scripting thread

Post » Fri May 27, 2011 11:40 pm

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

It sounds like a clone is probably the way to go. It can be nice to 'compartmentalize' quests in this way - develop them independently of each other without having to worry about how they the mod will perform when they are combined.

I suggest you add your waypoints to the script and send it back to me (you should have my email address). I will check it over and make adjustments for the 'exit strategies'. If you can provide the journal indices that will correspond to the quest in progress, its successful completion and the player abandonment, I can be certain it will work properly.

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?

Now that I re-read it that is what is sounds like to me. It has been years since I first read it and now I think I misinterpreted JOG's last case. Even if another mod does break all the rules as long as your mod has Tribunal dependency and the user of the mod had Tribunal loaded it sounds as if it should work. That is reassuring from the point of view of the modder since it indicates that we still have control over how our mods will perform.
User avatar
Wane Peters
 
Posts: 3359
Joined: Tue Jul 31, 2007 9:34 pm

Post » Fri May 27, 2011 4:27 pm

Even if another mod does break all the rules as long as your mod has Tribunal dependency and the user of the mod had Tribunal loaded it sounds as if it should work. That is reassuring from the point of view of the modder since it indicates that we still have control over how our mods will perform.

I don't know, I think if another mod declares a DaysPassed variable it will cause trouble for anyone using it normally (I still haven't tested this myself though) - but the way I see it, the offending mod wouldn't even work correctly by itself, and if its bugs affect other mods as well that tends to bring the bug to the user's attention faster - which IMO is a good thing. Much better than playing for weeks and getting into the endgame and *then* discovering your game is totally broken :swear:

@ Illuminel:
Re clones vs global scripts: Personally I'd go for global scripts, but that's mostly because scripting is my favourite part of modding :hehe: Hm, only thing I think is really different in practice is that a gloabl/targeted script can check the player's cell and know immediately if the player has abandoned the NPC. Otherwise they're much the same I think.

Anyway, here's a first draft of a companion-ish script. It's not tested at all except for a quick compile in MWEdit, it's not meant to be a final thing, just wanted to know what you want changed/added/removed etc.
begin illyCompanionLSshort cmbtChk  ;combat checkshort sick  ;check for disease - not sure what you want done about it?            ;...or could just be a dialogue filter if you wantshort doOnce1  ;doonce vars for Grumpy's warping code/save warp destination pointsshort doOnce2float ax  ;position vars for warpingfloat ayfloat bxfloat byfloat bzfloat cxfloat cyfloat czfloat t1  ;temp vars used in warping codefloat t2  ;these "t*" vars can be reused as temp vars in dialogue results if neededfloat t3float t4float coDist  ;distance checks for warpingfloat coDist2float warpTmr  ;time out for warpingfloat sheathe  ;timer for weapon sheathing after combatfloat combatTmr  ;time out for combatfloat rTmr  ;repair check - wait a bit after combat to make sure then repair NPC's gear;heal and restore while sleeping, and;check if NPC is dead/unconscious/paralysed -;no point running the rest if they are!if ( GetHealth < 1 )    returnelseif ( GetPCSleep )  ;I put this before menumode since otherwise the PC    ModCurrentHealth 999  ; has to sleep at least 2 hours for it to trigger    ModCurrentMagicka 999    ModCurrentFatigue 999    returnelseif ( MenuMode )    returnelseif ( GetFatigue < 1 )    returnelseif ( GetParalysis > 0 )    returnendif;check health and run or teleport away if necessary;not sure if you want to do this all the time or just in the escort quest?;just remove this block if you don't want itif ( GetHealthGetRatio < 0.25 )    MessageBox "Insert flee-by-teleport message here"    PlaySound3d "swallow"  ;pretend to take a potion    PlaySound3d "mysticism hit"    PositionCell 10 -58 131 0 "Caldera, Shenk's Shovel"  ;change destination as you like    returnelseif ( GetHealthGetRatio < 0.5 )    if ( GetFlee < 90 )        SetFlee 100        MessageBox "Insert flee-by-running message here if you want one"    endifelseif ( GetFlee > 90 )    SetFlee 10  ;change to whatever your default isendif;this next part checks for combat so they don't warp in the middle of it;and so can force weapon sheathing afterwards if they get stuck like that;plus starts timing for weapon & armor "repair" (really replacement);if your NPC doesn't use magic then you can remove the spell-casting sound checksif ( cmbtChk == 1 )    set warpTmr to 0    set rTmr to 0    set sheathe to ( sheathe - GetSecondsPassed )    if ( GetSoundPlaying "Weapon Swish" )        set sheathe to 5    elseif ( GetSoundPlaying "crossbowShoot" )        set sheathe to 5    elseif ( GetSoundPlaying "bowShoot" )        set sheathe to 5    elseif ( GetSoundPlaying "mysticism cast" )        set sheathe to 5    elseif ( GetSoundPlaying "restoration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "alteration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "illusion cast" )        set sheathe to 5    elseif ( GetSoundPlaying "conjuration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "destruction cast" )        set sheathe to 5    elseif ( GetSoundPlaying "frost_cast" )        set sheathe to 5    elseif ( GetSoundPlaying "shock cast" )        set sheathe to 5    elseif ( sheathe <= 0 )        set cmbtChk to 0        if ( GetSpellReadied )            cast "mark" player        else            equip "chitin dagger"          ;Change this if your NPC actually has one. You            RemoveItem "chitin dagger" 1   ;  should use a 1-handed weapon they *don't* have        endif                                ;  - otherwise it will remove their real weapon!    endifelseif ( GetWeaponDrawn )    set cmbtChk to 1    set sheathe to 5    set warpTmr to 0elseif ( GetSpellReadied )    set cmbtChk to 1    set sheathe to 5    set warpTmr to 0endif;you can remove this block if you want a leaner script;it's just extra checks for combat, makes the check more reliable;alternatively - if you want it even more reliable, you can;check for sounds playing on the PC as wellif ( sheathe >= 4 )    set combatTmr to 5elseif ( GetSoundPlaying "Health Damage" )    set combatTmr to 5elseif ( GetSoundPlaying "destruction hit" )    set combatTmr to 5elseif ( GetSoundPlaying "frost_hit" )    set combatTmr to 5elseif ( GetSoundPlaying "shock hit" )    set combatTmr to 5elseif ( GetSoundPlaying "alteration hit" )    set combatTmr to 5elseif ( GetSoundPlaying "illusion hit" )    set combatTmr to 5elseif ( GetSoundPlaying "Hand To Hand Hit" )    set combatTmr to 5elseif ( GetSoundPlaying "Hand to Hand Hit 2" )    set combatTmr to 5endifif ( rTmr >= 7 )  ;no combat sounds detected for at least 12 seconds    set rTmr to -2  ;negative value so don't start timing again until next combat starts    ;NEED TO ADD:    ;    RemoveItem all armor & weapons    ;    AddItem same armor & weapons (returns them to full health)    ;    if NPC uses marksman weapons then check ammo and replenish if neededelseif ( rTmr >= 0 )    set rTmr to ( rTmr + GetSecondsPassed )endifif ( combatTmr >= 0 )    set warpTmr to 0  ;prevents warping in combat    set combatTmr to ( combatTmr - GetSecondsPassed )    returnendif;this part makes the NPC go into wander mode if the player levitates;since the NPC doesn't have any levitation code to handle this;Or if you want, I can add some levitation code instead?if ( GetCurrentAIPackage == 3 )    if ( player->GetEffect sEffectLevitate == 1 )        AIWander 0 0 0        return    endifelseif ( GetCurrentAIPackage != -1 )  ;no warp if not in follow mode, unless AI is invalid -    set warpTmr to 0        ; they tend to rush off if their AI is messed up, this keeps    return                    ; them closer to the player so can use console fix on themendif                        ; alternatively - if you want, I can script an auto fix?;Grumpy's warping calcsset ax to ( Player->GetPos x )set ay to ( Player->GetPos y )if ( doOnce1 == 0 )    set bx to ( Player->GetPos x )    set by to ( Player->GetPos y )    set bz to ( player->GetPos z )    set doOnce1 to 1endifset t1 to ( ax - bx )set t1 to ( t1 * t1 )set t2 to ( ay - by )set t2 to ( t2 * t2 )set t1 to ( t1 + t2 )set coDist to ( GetSquareRoot t1 )if ( coDist > 360 )    set doOnce1 to 0endifif ( coDist > 180 )    if ( doOnce2 == 0 )        set cx to ( Player->GetPos x )        set cy to ( Player->GetPos y )        set cz to ( player->GetPos z )        set doOnce2 to 1    endifendifset t3 to ( ax - cx )set t3 to ( t3 * t3 )set t4 to ( ay - cy )set t4 to ( t4 * t4 )set t3 to ( t3 + t4 )set coDist2 to ( GetSquareRoot t3 )if ( coDist2 > 360 )    set doOnce2 to 0endifset warpTmr to ( warpTmr + GetSecondsPassed )if ( warpTmr > 6 )    if ( ( GetDistance player ) > 680 )        if ( coDist > 350 )            SetPos x bx            SetPos y by            SetPos z bz            AIFollow Player 0 0 0 0            return        elseif ( coDist2 > 350 )            SetPos x cx            SetPos y cy            SetPos z cz            AIFollow Player 0 0 0 0            return        endif    endifendif;disease can be dealt with in script or dialogue or both as you like;but all this does atm is check for any diseases and set the variable;note: if you use an ability to simulate taking a potion, for blight;disease you may want to add a cure corprus effect to the ability;in case of mods adding that effect to NPCs (I'm sure there's at least one);or alternatively I could check for corprus and it could be dealt with;separately if you wantif ( GetBlightDisease )    set sick to 2elseif ( GetCommonDisease )    set sick to 1else    set sick to 0endif;these are in case your NPC goes swimming - NPCs are too;stupid too keep their heads above water :P;acrobatics is mostly for teleport doors - prevents damage if NPCs is slowfalling etcif ( GetWaterBreathing != 1 )    SetWaterBreathing 1endifif ( GetAcrobatics < 199 )    SetAcrobatics 200endifend


To do a health report in dialogue is easy, just add this in the results for that line (only works if the NPC has these locals - so this might need to be changed for the clones if you use them):
set t1 to ( GetHealth )set t2 to ( ( GetHealthGetRatio ) * 100 )MessageBox "My current Health is %.0f points (%.0f percent)" t1 t2

Obviously, change the message text to something in character if you want.

The script has a kind of place marker for weapon and armor repairs after combat (since without companion share it will be needed) but I don't know the IDs of your companion's gear to put them in. If you let me know I can add those (also, does she use marksman weapons? if so, what's the id for the ammo?) - or you can add them yourself or whatever.

Disease is checked in the script (since there's no dialogue filter for NPC disease) - you can just filter for "sick = 1" for a common disease or "sick = 2" for blight disease (blight takes precedence, so if she's got both it will only register as blight, until/unless that gets cured). Did you want her to cure herself or just do it in dialogue?

There's lots of comments in the script, some things you might well want to change, etc. Just let me know what you want done. :)
User avatar
Robert Jr
 
Posts: 3447
Joined: Fri Nov 23, 2007 7:49 pm

Post » Fri May 27, 2011 8:37 am

*snip*
begin illyCompanionLSshort cmbtChk  ;combat checkshort sick  ;check for disease - not sure what you want done about it?            ;...or could just be a dialogue filter if you wantshort doOnce1  ;doonce vars for Grumpy's warping code/save warp destination pointsshort doOnce2float ax  ;position vars for warpingfloat ayfloat bxfloat byfloat bzfloat cxfloat cyfloat czfloat t1  ;temp vars used in warping codefloat t2  ;these "t*" vars can be reused as temp vars in dialogue results if neededfloat t3float t4float coDist  ;distance checks for warpingfloat coDist2float warpTmr  ;time out for warpingfloat sheathe  ;timer for weapon sheathing after combatfloat combatTmr  ;time out for combatfloat rTmr  ;repair check - wait a bit after combat to make sure then repair NPC's gear;heal and restore while sleeping, and;check if NPC is dead/unconscious/paralysed -;no point running the rest if they are!if ( GetHealth < 1 )    returnelseif ( GetPCSleep )  ;I put this before menumode since otherwise the PC    ModCurrentHealth 999  ; has to sleep at least 2 hours for it to trigger    ModCurrentMagicka 999    ModCurrentFatigue 999    returnelseif ( MenuMode )    returnelseif ( GetFatigue < 1 )    returnelseif ( GetParalysis > 0 )    returnendif;check health and run or teleport away if necessary;not sure if you want to do this all the time or just in the escort quest?;just remove this block if you don't want itif ( GetHealthGetRatio < 0.25 )    MessageBox "Insert flee-by-teleport message here"    PlaySound3d "swallow"  ;pretend to take a potion    PlaySound3d "mysticism hit"    PositionCell 10 -58 131 0 "Caldera, Shenk's Shovel"  ;change destination as you like    returnelseif ( GetHealthGetRatio < 0.5 )    if ( GetFlee < 90 )        SetFlee 100        MessageBox "Insert flee-by-running message here if you want one"    endifelseif ( GetFlee > 90 )    SetFlee 10  ;change to whatever your default isendif;this next part checks for combat so they don't warp in the middle of it;and so can force weapon sheathing afterwards if they get stuck like that;plus starts timing for weapon & armor "repair" (really replacement);if your NPC doesn't use magic then you can remove the spell-casting sound checksif ( cmbtChk == 1 )    set warpTmr to 0    set rTmr to 0    set sheathe to ( sheathe - GetSecondsPassed )    if ( GetSoundPlaying "Weapon Swish" )        set sheathe to 5    elseif ( GetSoundPlaying "crossbowShoot" )        set sheathe to 5    elseif ( GetSoundPlaying "bowShoot" )        set sheathe to 5    elseif ( GetSoundPlaying "mysticism cast" )        set sheathe to 5    elseif ( GetSoundPlaying "restoration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "alteration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "illusion cast" )        set sheathe to 5    elseif ( GetSoundPlaying "conjuration cast" )        set sheathe to 5    elseif ( GetSoundPlaying "destruction cast" )        set sheathe to 5    elseif ( GetSoundPlaying "frost_cast" )        set sheathe to 5    elseif ( GetSoundPlaying "shock cast" )        set sheathe to 5    elseif ( sheathe <= 0 )        set cmbtChk to 0        if ( GetSpellReadied )            cast "mark" player        else            equip "chitin dagger"          ;Change this if your NPC actually has one. You            RemoveItem "chitin dagger" 1   ;  should use a 1-handed weapon they *don't* have        endif                                ;  - otherwise it will remove their real weapon!    endifelseif ( GetWeaponDrawn )    set cmbtChk to 1    set sheathe to 5    set warpTmr to 0elseif ( GetSpellReadied )    set cmbtChk to 1    set sheathe to 5    set warpTmr to 0endif;you can remove this block if you want a leaner script;it's just extra checks for combat, makes the check more reliable;alternatively - if you want it even more reliable, you can;check for sounds playing on the PC as wellif ( sheathe >= 4 )    set combatTmr to 5elseif ( GetSoundPlaying "Health Damage" )    set combatTmr to 5elseif ( GetSoundPlaying "destruction hit" )    set combatTmr to 5elseif ( GetSoundPlaying "frost_hit" )    set combatTmr to 5elseif ( GetSoundPlaying "shock hit" )    set combatTmr to 5elseif ( GetSoundPlaying "alteration hit" )    set combatTmr to 5elseif ( GetSoundPlaying "illusion hit" )    set combatTmr to 5elseif ( GetSoundPlaying "Hand To Hand Hit" )    set combatTmr to 5elseif ( GetSoundPlaying "Hand to Hand Hit 2" )    set combatTmr to 5endifif ( rTmr >= 7 )  ;no combat sounds detected for at least 12 seconds    set rTmr to -2  ;negative value so don't start timing again until next combat starts    ;NEED TO ADD:    ;    RemoveItem all armor & weapons    ;    AddItem same armor & weapons (returns them to full health)    ;    if NPC uses marksman weapons then check ammo and replenish if neededelseif ( rTmr >= 0 )    set rTmr to ( rTmr + GetSecondsPassed )endifif ( combatTmr >= 0 )    set warpTmr to 0  ;prevents warping in combat    set combatTmr to ( combatTmr - GetSecondsPassed )    returnendif;this part makes the NPC go into wander mode if the player levitates;since the NPC doesn't have any levitation code to handle this;Or if you want, I can add some levitation code instead?if ( GetCurrentAIPackage == 3 )    if ( player->GetEffect sEffectLevitate == 1 )        AIWander 0 0 0        return    endifelseif ( GetCurrentAIPackage != -1 )  ;no warp if not in follow mode, unless AI is invalid -    set warpTmr to 0        ; they tend to rush off if their AI is messed up, this keeps    return                    ; them closer to the player so can use console fix on themendif                        ; alternatively - if you want, I can script an auto fix?;Grumpy's warping calcsset ax to ( Player->GetPos x )set ay to ( Player->GetPos y )if ( doOnce1 == 0 )    set bx to ( Player->GetPos x )    set by to ( Player->GetPos y )    set bz to ( player->GetPos z )    set doOnce1 to 1endifset t1 to ( ax - bx )set t1 to ( t1 * t1 )set t2 to ( ay - by )set t2 to ( t2 * t2 )set t1 to ( t1 + t2 )set coDist to ( GetSquareRoot t1 )if ( coDist > 360 )    set doOnce1 to 0endifif ( coDist > 180 )    if ( doOnce2 == 0 )        set cx to ( Player->GetPos x )        set cy to ( Player->GetPos y )        set cz to ( player->GetPos z )        set doOnce2 to 1    endifendifset t3 to ( ax - cx )set t3 to ( t3 * t3 )set t4 to ( ay - cy )set t4 to ( t4 * t4 )set t3 to ( t3 + t4 )set coDist2 to ( GetSquareRoot t3 )if ( coDist2 > 360 )    set doOnce2 to 0endifset warpTmr to ( warpTmr + GetSecondsPassed )if ( warpTmr > 6 )    if ( ( GetDistance player ) > 680 )        if ( coDist > 350 )            SetPos x bx            SetPos y by            SetPos z bz            AIFollow Player 0 0 0 0            return        elseif ( coDist2 > 350 )            SetPos x cx            SetPos y cy            SetPos z cz            AIFollow Player 0 0 0 0            return        endif    endifendif;disease can be dealt with in script or dialogue or both as you like;but all this does atm is check for any diseases and set the variable;note: if you use an ability to simulate taking a potion, for blight;disease you may want to add a cure corprus effect to the ability;in case of mods adding that effect to NPCs (I'm sure there's at least one);or alternatively I could check for corprus and it could be dealt with;separately if you wantif ( GetBlightDisease )    set sick to 2elseif ( GetCommonDisease )    set sick to 1else    set sick to 0endif;these are in case your NPC goes swimming - NPCs are too;stupid too keep their heads above water :P;acrobatics is mostly for teleport doors - prevents damage if NPCs is slowfalling etcif ( GetWaterBreathing != 1 )    SetWaterBreathing 1endifif ( GetAcrobatics < 199 )    SetAcrobatics 200endifend


To do a health report in dialogue is easy, just add this in the results for that line (only works if the NPC has these locals - so this might need to be changed for the clones if you use them):
set t1 to ( GetHealth )set t2 to ( ( GetHealthGetRatio ) * 100 )MessageBox "My current Health is %.0f points (%.0f percent)" t1 t2

Obviously, change the message text to something in character if you want.

The script has a kind of place marker for weapon and armor repairs after combat (since without companion share it will be needed) but I don't know the IDs of your companion's gear to put them in. If you let me know I can add those (also, does she use marksman weapons? if so, what's the id for the ammo?) - or you can add them yourself or whatever.

Disease is checked in the script (since there's no dialogue filter for NPC disease) - you can just filter for "sick = 1" for a common disease or "sick = 2" for blight disease (blight takes precedence, so if she's got both it will only register as blight, until/unless that gets cured). Did you want her to cure herself or just do it in dialogue?

There's lots of comments in the script, some things you might well want to change, etc. Just let me know what you want done. :)


Thanks Melian - you write good comments

There are a number of topics I will add for the NPC following Grumpy's method - so for Health I'll have one that asks Are you all right? Then filter it using Function Health Percent eg: <30 will say "[Her eyes fill with pain as she blinks back tears] Please help me %PCName." While <90 >=60 will say "[You notice she has a dislocated finger which she promptly hides behind her back when she see's you looking] I'm all right %PCName, are you okay?"

I had the same in mind for water walking or levitating - where the topic will be Drink a potion - she will ask what I have in mind and in the results box I have choices for waterwalk, levitate and dispel - possibly a good place to include cure disease - though was thinking of having a seperate topic with a backstory that she has has been poisoned and needs to take a regular medicine - which accounts for her at times grumpy mood - I like how you added the variable to filter on though and definitely will want to make use of that in dialogue - it is a mod designed for speechcraft users and role players. As for corpus disease I'm not sure - I don't want her to catch it at all and would want a check in the script that if she caught it she would self cure it rather than through dialogue seeing as it is supposed to be an incurable disease.

She doesn't use magic at all - only potions.

She only uses a longblade - currently equipped with a steel katana - however I was planning via dialogue to give her an upgraded weapon later - just using the remove item and additem via the results box - was thinking of doing the same with her weapon - using a check your blade topic - which swaps her weapon for a new one, I guess this would need to sort her armour as well - had forgotten about that - however the goal of this lite companion is that the player needs to care for her if she is to survive so I'd rather address the issue via dialogue than companion share.

I like the flee option you added - she definitely is not a warrior and will want to exit if hurt - in one quest she is designed to run away in terror and it is up to the player to try and find her and either talk her back into completing her apprenticeship or giving her a piece of their mind - either choice will have consequences - so this fits perfectly

It looks really good - thanks so much

@Cyrano - I emailed the draft of the scout script to you I suspect I'll need to rework it as I still wasn't clear on the x y z coordinates as you had them preceded by a 0 and ending in a 0 - doesn't matter if I got it wrong - that's how I learn via frustrating mistakes no gain without pain :)

I checked the charguard AIescort scripts and noticed sometimes there are 4 coordinates eg
AIEscort Player, 12, -9944, -72481, 126	;next to door
how does this work?
User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm

Post » Fri May 27, 2011 10:11 am

Hmm... So I've loaded the script in and added a topic via a greeting that allows for a yes I'm ready to come no I'm not scenario (http://img638.imageshack.us/img638/4810/lairah01.jpg)

If selecting yes the results box has this

Journal CT_GoingPostal 3StartScript CT_PostalServiceClearinfoactor


I also removed the short nolore - as i don't mind her having those topics - it fits with her storyline

I added an extra waypoint between the first 2 just in case the first one was out of site.

However now when i go talk to her she won't take off - do i need to set her AI wander to 0 and set the starting coordinates to her position in the CS?

Here's the beginning of the walk script

; START WALKING - travel codeelseif ( state == 10 ); set through dialog	SetHello 0; prevent idle greetings	AIEscort player 0 -14187 22004 1449 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 -15381 23814 1227 0; point 2 - down road	set state to ( state + 10 )elseif ( state == 40 )	if ( GetAIPackageDone == 1 ); NPC at point 2		set state to ( state + 10 )	endifelseif ( state == 50 )	AIEscort player 0 -16483 25525 1233 0; point 3 - first bend	set state to ( state + 10 )elseif ( state == 60 )	if ( GetAIPackageDone == 1 ); NPC at point 3		set state to ( state + 10 )	endif


I'm sure if I can just get her between the first 2 waypoints then I'll be fine to track her walking path through the test - that is adjusting for anytime she gets stuck or can't see a waypoint

Oh and Cyrano - can you please tell me whay the x y z coordinates are bracketed by 0's - what do these do?

I think via dialogue I'll use gamehour to say whether it's getting dark or not and it's best to wait till morning
User avatar
Sunny Under
 
Posts: 3368
Joined: Wed Apr 11, 2007 5:31 pm

Post » Fri May 27, 2011 8:08 pm

This looks bad ass. Keep it up
User avatar
Queen Bitch
 
Posts: 3312
Joined: Fri Dec 15, 2006 2:43 pm

Post » Fri May 27, 2011 6:36 pm

Oh and Cyrano - can you please tell me whay the x y z coordinates are bracketed by 0's - what do these do?

I can answer that...

The first one is duration. In this context 0 means "indefinitely", ie it's saying "do the escort until you reach your destination, or until you're given another AI command by script" - no time limit, in other words.

The second is called "reset" in the official description but nobody knows what it's for. So as far as anyone knows, it doesn't do anything much (I'm assuming here it's the same as reset for AIFollow, which is likely, but I haven't tested AIEscort myself).

---

A couple of questions about the companion script:

- Do you want her nolored for that?
- Travelling spells (waterwalk etc) will still need some scripting, even if it's not like a normal companion's (e.g. most companions will levitate until the player stops levitating, but even if you want it time-limited she'll need to get down somehow before it runs out, if she's still in the air). And if you do it via dialogue like that it's a little more complicated since the player might not be waterwalking or whatever when they ask. So, how do you want that handled? If you can set some script variables from the dialogue it should work OK either way I think.

Corprus can be taken care of silently in the script, that shouldn't be a problem.

If you're going to handle the armor as well as the weapon repairs via dialogue that would actually be good, it can kind of pause the game for a moment when you do the remove/add so doing it in menus would make that less noticeable. And any player familiar with companions will know to check their gear regularly.

PS I really like Lairah's appearance! It really suits the character as you've described her. Is that one of your faces?
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Fri May 27, 2011 12:27 pm

I can answer that...

The first one is duration. In this context 0 means "indefinitely", ie it's saying "do the escort until you reach your destination, or until you're given another AI command by script" - no time limit, in other words.

The second is called "reset" in the official description but nobody knows what it's for. So as far as anyone knows, it doesn't do anything much (I'm assuming here it's the same as reset for AIFollow, which is likely, but I haven't tested AIEscort myself).

---

A couple of questions about the companion script:

- Do you want her nolored for that?
- Travelling spells (waterwalk etc) will still need some scripting, even if it's not like a normal companion's (e.g. most companions will levitate until the player stops levitating, but even if you want it time-limited she'll need to get down somehow before it runs out, if she's still in the air). And if you do it via dialogue like that it's a little more complicated since the player might not be waterwalking or whatever when they ask. So, how do you want that handled? If you can set some script variables from the dialogue it should work OK either way I think.

Corprus can be taken care of silently in the script, that shouldn't be a problem.

If you're going to handle the armor as well as the weapon repairs via dialogue that would actually be good, it can kind of pause the game for a moment when you do the remove/add so doing it in menus would make that less noticeable. And any player familiar with companions will know to check their gear regularly.

PS I really like Lairah's appearance! It really suits the character as you've described her. Is that one of your faces?


Thanks melian - yes Lairah is from my redguard faces mod. She is a little fiesty but can be quite loyal if looked after.

I've been thinking about the scripting for waterwalking and levitating - she has no magicka and relies on carrying a small collection of potions with her each day - I really want her to be a little limited in her use of travel - almost nomified in that she has to stop and restock regularly.

What do you think about having a variable that counts how many potions she has - these wouldn't be actual potions but rather the number of times she levitates or waterwalks in a day?

In dialogue I can warn the player she only has a limited number of potions to use - when she gets to her last use for the day a message box could inform the player she only has one more potion left. I guess in dialogue I could do a check if the player is carrying any exclusive potions - and provide a choice if they wish to share them otherwise she'll be stuck

Am only playing with ideas and interested in your thoughts

As a scout Lairah has been around a bit and quickly finds out what is going on in towns - so her dialogue is allowed to get cluttered - though if you put the nolore option in and comment it out I can then reuse the code for another NPC later on in the story.

Thanks for the info on the coordinates am trying desperately to expand my understanding of how things work- I still haven't been able to get her to start walking yet - but am sure it is just a matter of eliminating possible causes - besides I made some fresh faces for character generation and long with my new class signs - I quite enjoy doing rinse and repeat at the moment :)
User avatar
Lew.p
 
Posts: 3430
Joined: Thu Jun 07, 2007 5:31 pm

Post » Fri May 27, 2011 7:38 am

Yes, that sounds fine I think... I've done something similar with certain potion types with a companion mod I'm working on. They have companion share but there's no room in the script to check for all the potions they can use (they won't cast spells unless they have the skills and magicka to do it), so there's a dialogue option for the player to give them some potions and the number just gets stored in a local variable.

Another thought is enchanted items - if you want, you could have a dialogue option for the player to give her an amulet of waterwalking or something.

A messagebox if she's run out of potions and can't levitate is definitely a good idea - I didn't have that, and I left a mage behind when she'd run out of magicka but by the time I noticed I'd run out myself and couldn't get back to her :o

So... When should Lairah restock, and with how many potions? Other than being given them in dialogue, I mean (the dialogue can just increment the variables). The good ol' day-change check would probably be easiest, if you don't mind her restocking on the stroke of midnight. :hehe:
User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am

Post » Fri May 27, 2011 10:35 pm

Yes, that sounds fine I think... I've done something similar with certain potion types with a companion mod I'm working on. They have companion share but there's no room in the script to check for all the potions they can use (they won't cast spells unless they have the skills and magicka to do it), so there's a dialogue option for the player to give them some potions and the number just gets stored in a local variable.

Another thought is enchanted items - if you want, you could have a dialogue option for the player to give her an amulet of waterwalking or something.

A messagebox if she's run out of potions and can't levitate is definitely a good idea - I didn't have that, and I left a mage behind when she'd run out of magicka but by the time I noticed I'd run out myself and couldn't get back to her :o

So... When should Lairah restock, and with how many potions? Other than being given them in dialogue, I mean (the dialogue can just increment the variables). The good ol' day-change check would probably be easiest, if you don't mind her restocking on the stroke of midnight. :hehe:


Hi Melian - I've got to admit it is nice to be able to talk about making a mod with someone else rather than beavering away on one's own :) For one thing it helps me clarify what I'd like to achieve.

Perhaps a little more background - Lairah doesn't have much of an income - and while a member of House Telvanni - she hasn't got a home of her own, she shares a dormitory with a small group of apprentices. Her clothes and armour are meagre and she won't accept charity - successful bribes will lower her disposition and make her want to leave - so she doesn't own any amulets.

She can't afford to keep buying potions - she restocks when she returns to Guide Hall - a place where she is an apprentice. Similar to the Mage Guild there is a chest provided for members to restock their potions - this doesn't apply to the player as they can't join as an apprentice - they get to purchase the potions from an NPC at the Hall. So I had in mind when returning to that location via dialogue Lairah could be reminded - which in the results box would just reset her to full potions?

So I had her in mind restocking when in a certain cell - I can do that via reminder dialogue unless you suggest something different?

She always carries a potion of recall and via dialogue can transport the player and herself back to Guide Hall - this has to work via dialogue as in a couple of quests she gets lost and will need the player to help her get back.

Lairah is quite a practical girl and always carries a decent book with her when adventuring - apparently the larger biographies were printed on soft paper - so I had in mind her adding a suitable complaint if her stocks of potions get used up too fast.

In regard to the 72 hour bug - she says upfront she has trouble with names and will likely forget the player's within a few days - however I'll likely set a few random greetings that are based on a journal check that use the player's name to avoid the who are you syndrome

I understand some players lose their companions - mine normally stayed with me until I got killed (I remember being really shocked when Laura got me killed trying to sort out her peeping tom issues)

Anyway it is important not to have a ring to call her back to the player - I'd rather do that via dialogue by asking her trainer if he has seen her - depending on the journal entry he can say yes or no and then transport her into another part of the building - what do you think?

I had only envisioned her simulating the use of potions for water walking, levitating, recall and dispel - a seperate one for cure common disease and possibly one for restore health. Did you have in mind more?
User avatar
Sam Parker
 
Posts: 3358
Joined: Sat May 12, 2007 3:10 am

Post » Fri May 27, 2011 3:38 pm

Hi Melian - I've got to admit it is nice to be able to talk about making a mod with someone else rather than beavering away on one's own :) For one thing it helps me clarify what I'd like to achieve.

No worries B) This looks like it's going to be great fun to play!

Re potion restock: Cell is even easier than the day check :). You can do it via dialogue if you want or I can put it in the script - it would only be a few lines (I'd need to know the cell ID and how many of each potion she should get).

For more potions, I'd say cure blight and restore attribute (doesn't matter which attribute, you might not be able to tell which one's damaged anyway). Or if you prefer, I could script it so her attribs are restored when the player sleeps.

How important is to stop the player being able to teleport her? Just thinking there's mods like Improved Teleportation and my teleport mod that could be used to do that anyway. You can block my teleport mod pretty easily if you want, it's more difficult with IT but you could kinda mostly do it. That leaves the player with no way of fishing her out of lava pits though. (Which makes me realise I should have allowed for a partial block that lets the player summon the companion within the same cell, but not if they're in a different cell. Never thought of that...)
Anyway, if you want to block my teleport mod, all you have to do is give her a certain spell (which she'll never cast, it's just to communicate with the script) and that's it.

72-hours bug probably shouldn't be much of an issue with Lairah, I think. Unless you've got dialogue filtered for "talked to pc" of course... But other than that, would it matter if her stats & skills are reset to editor levels?

BTW: Companions can get lost for a number of reasons, mostly game bug type reasons - e.g. messed-up AI (makes them rush off in a particular direction - if they do it when your back's turned they can be well away before you realise it), or teleport doors (even if you're not levitating or slowfalling they can just vanish at doors sometimes, though they'll usually reappear when you go through a door again).

PS It's entirely possible to control an NPC's disposition so they won't be affected by any disp modifiers unless you specifically allow for it. If you want to do that I can tell you how it works (I used it for Comes-By-Road). The big catch is that everything that *should* affect disposition - including the player's personality score - has to be allowed for, so if there are lots of things you want to affect it then it can get rather complicated.
User avatar
Krista Belle Davis
 
Posts: 3405
Joined: Tue Aug 22, 2006 3:00 am

Post » Fri May 27, 2011 7:54 am

No worries B) This looks like it's going to be great fun to play!

Re potion restock: Cell is even easier than the day check :). You can do it via dialogue if you want or I can put it in the script - it would only be a few lines (I'd need to know the cell ID and how many of each potion she should get).


Thanks Melian - I think 3 potions of each is amble for a supply - and when I say potions I do mean that she simulates taking a potion but in reality casts the spell - just checking we are on same track as the intention is to avoid dinkum's excellent script with a different way of handling the situation - the intention is to not make her a little more limited in use than other companions - someone who needs to be cared for a little bit more than usual - that said it would be good via dialogue to allow an exchange of exclusive potions to restock her while out in the wild.



For more potions, I'd say cure blight and restore attribute (doesn't matter which attribute, you might not be able to tell which one's damaged anyway). Or if you prefer, I could script it so her attribs are restored when the player sleeps.



I thought I'd do this via dialogue where she gets reminded to take her medicine once a day - though I suppose that could become irritating after a while - I know there is no check for blight or attributes but I don't want it to be too easy for her either - perhaps if she has it scripted that each day she has to take a cure blight restore attributes potion and only has 5 days supply - after 4 days she can warn via message box that she's running low on medicine and will have to return for more after the 5th is used she would teleport home and wait there - actually if that could be set like a state it would make an excellent side mission for me to find a cure for her - once I gain the cure she could have the restoration done automatically - what do you think?

How important is to stop the player being able to teleport her? Just thinking there's mods like Improved Teleportation and my teleport mod that could be used to do that anyway. You can block my teleport mod pretty easily if you want, it's more difficult with IT but you could kinda mostly do it. That leaves the player with no way of fishing her out of lava pits though. (Which makes me realise I should have allowed for a partial block that lets the player summon the companion within the same cell, but not if they're in a different cell. Never thought of that...)
Anyway, if you want to block my teleport mod, all you have to do is give her a certain spell (which she'll never cast, it's just to communicate with the script) and that's it.



Well I had planned on using clones for the non-teleport missions so that may not be an issue - if she fallls in a lava pit - sigh - via dialogue I'd want to tell her to go home now and go see a healer. I don't want to summon her to me though - either she gets picked up from Guide hall and taken then and there or left behind - again if she gets lost then I can use a dialogue with one of the NPC's at guide Hall to bring her back to another room within the buidling

72-hours bug probably shouldn't be much of an issue with Lairah, I think. Unless you've got dialogue filtered for "talked to pc" of course... But other than that, would it matter if her stats & skills are reset to editor levels?


Correct - she is set to level 16

PS It's entirely possible to control an NPC's disposition so they won't be affected by any disp modifiers unless you specifically allow for it. If you want to do that I can tell you how it works (I used it for Comes-By-Road). The big catch is that everything that *should* affect disposition - including the player's personality score - has to be allowed for, so if there are lots of things you want to affect it then it can get rather complicated.


I think I'll just stick to dialogue to raise or lower her disposition - by the time the player gets to meet Lairah hopefully they will feel comfortable enough with how I've handled dialogue so far that they don't see the need to play with the bribery or persuasion responses I'll follow a Grumpy route where the player can tell her how well she is doing or not - I'd like a variable to filter for in dialogue so that if she gets berated too much she'll go home and will need to be apologised to before she comes out again (likely there will be a random penalty like making the player strip and run through Vivic and hassle 3 ordinators or donate 1000 gold to the Fighters Guild orphan fund) - this mod requires a medium speechcraft level to progress through it rather than disposition - however players can of course do what they want with NPC's

Oh and I'm still stuck in getting my first script that Cyrano wrote for me to work - though will try setting a shorter distance for the first waypoint again to see what happens.
User avatar
Jay Baby
 
Posts: 3369
Joined: Sat Sep 15, 2007 12:43 pm

Post » Fri May 27, 2011 7:31 am

and when I say potions I do mean that she simulates taking a potion but in reality casts the spell - just checking we are on same track as the intention is to avoid dinkum's excellent script with a different way of handling the situation

Yep, the way I was imagining was: play a drink sound and a restoration hit sound on her, decrement the variable for that potion type and apply potion effects by script. That OK?

BTW, if we're keeping all potion types in variables then you can use a messagebox in dialogue results to tell the player how many she's got left of each type if you want (so e.g. the player could ask how many levitation potions she's got, see the results and give her more if needed). Of course you can do that anyway, but keeping them as variables makes it a one-liner (no need to check item count).

I know there is no check for blight or attributes but I don't want it to be too easy for her either - perhaps if she has it scripted that each day she has to take a cure blight restore attributes potion and only has 5 days supply - after 4 days she can warn via message box that she's running low on medicine and will have to return for more after the 5th is used she would teleport home and wait there - actually if that could be set like a state it would make an excellent side mission for me to find a cure for her - once I gain the cure she could have the restoration done automatically - what do you think?

Hm, I don't know really... You could check for a blight disease in dialogue (a script var can be used as filter) or go the quest route (would also work fine I think). Another local variable could be used for the medicine supply if you want - the script can give a messagebox when she's down to 1, that's no problem.

Re teleporting & extraction from lava pits... When I wrote that I'd kind of forgotten she'll bail out if she's at low health - so it's no so much an issue for her (most companions will just stand there until they die, so if you can't get to them you'd need some way of summoning them).

Preventing the player from using teleport mod summoning on the clones is probably a good idea I think - because unless they're completely removed from the game it will find them and teleport them to the player, which would mess things up in a big way... and if they *are* completely removed from the game it will give the player a warning message when it can't find them - plus my mod uses the ID in the warning since it won't know the name unless it can get a reference, so it won't say it can't find Lairah, it will say it can't find Illy_LairahClone00000000 or whatever the ref ID is, which looks pretty bad. (And now that I consider this some more, I realise I should have stored the NPC's name as well as the ref ID :banghead:). CDCooley's companion teleporting will probably say she's dead if it can't find the NPC (it's not MWSE-dependent so it can't store or find refs). Not sure what his MWSE version would do...

Erm, now that I see all that written down together, I'm beginning to realise why players tend to have difficulty with that type of mod... :blink:

Anyway:
If you want to disable teleporting with my mod, add this spell to your mod (exactly as it is, including ID and casting cost):
http://img190.imageshack.us/img190/6090/cap1i.jpg
Just give the spell to your NPCs that you don't want teleported and the mod will detect it. If the player tries to add them to their teleport list they'll just be told they can't do that now. And if you want to enable teleporting for an NPC later you can just remove the spell the usual way.

For CDCooley's mods (both) you'll need a global variable cdc_teleportation (leave it at the defaults ie short, default 0). Decide which dialogue lines should remove the companion if they've been added (wait dialogues or end quests or whatever) and copy them. Add an extra filter to the top copy for "global cdc_teleportation != 0" (this will detect if one of the teleport mods is running) and in the results add this:
set cdc_companion_call_script.remove to 1StartScript cdc_companion_call_script


Of course it's up to you whether you want to add this or not, it's just a suggestion.

likely there will be a random penalty like making the player strip and run through Vivic and hassle 3 ordinators or donate 1000 gold to the Fighters Guild orphan fund

:lol: I love it!

Oh and I'm still stuck in getting my first script that Cyrano wrote for me to work - though will try setting a shorter distance for the first waypoint again to see what happens.

I'm kind of hoping Cyrano will turn up again to deal with that! I've never actually used AIEscort myself, and when I tried to get a creature to AITravel across a cell boundary I ended up using SetPos instead (she just wouldn't move! :embarrass: ).
User avatar
no_excuse
 
Posts: 3380
Joined: Sun Jul 16, 2006 3:56 am

Post » Fri May 27, 2011 4:54 pm

I hadn't thought about trying to counteract companion teleporting mods - perhaps I'll talk that with you through a bit more later as I need to think through how to handle it - if she has some sort of anti teleporting ring would that work?

As for the medicine i would liek that handled as per the other potions - however if possible can I have a varaible that allows her to be cured so she will no longer have that reminder and it will auto reset to 5 when it gets to 1? I bet that sounds as clear as mud :) -

Keep telling myself avoid scope creep - resist Melian's enticing temptations of scripting goodness.

Hehe - in the end Lairah is supposed to be vulnerable - she runs if in trouble - is ashamed of running when she does and requires encouragement to continue with the player - as the story goes if some emotional attachment can be made to her by the player in a non-romantic way then I'll feel I'll have achieved something worthwhile

Edit - forgot to add I've got my clone walking now with the AIEscort - however just need to drastically reduce the distance between waypoints to make it work - sigh - it took forever doing the first lot of waypoints - well not forever but I was losing my smile by the time to got to the 25th x yz coordinate - still it looked awesome when she took off as planned
User avatar
CxvIII
 
Posts: 3329
Joined: Wed Sep 06, 2006 10:35 pm

Post » Fri May 27, 2011 12:15 pm

Sigh - my NPC will walk correctly to the first waypoint then just stops - I've tried putting a much closer waypoint for her second one but she just won't budge - any thoughts?

Here's the first 2 waypoints code

; START WALKING - travel codeelseif ( state == 10 ); set through dialog	SetHello 0; prevent idle greetings	AIEscort player 0 -14624 22840 1196; 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 -14993 23354 1215 0; point 2 - down road	set state to ( state + 10 )elseif ( state == 40 )	if ( GetAIPackageDone == 1 ); NPC at point 2		set state to ( state + 10 )	endif

User avatar
lisa nuttall
 
Posts: 3277
Joined: Tue Jun 20, 2006 1:33 pm

Post » Fri May 27, 2011 10:05 am

I apologize for taking so long to reply, I was out of town for the weekend. I have tested the script with your updated waypoints and have experienced the same problem you have described. It took me a little while to isolate, but for some reason GetCurrentAIPackage is returning true continuously rather than for the one frame that it is supposed to. This appears to be a problem with AIEscort and not AITravel in this instance, although I have other scripts using AIEscort successfully. I worried that it might be a pathgrid issue, but the scout does walk a little beyond Caldera's pathgrid (and nearly to the coordinates specified before GetAIPackageDone returns true and the script quickly cycles to the end. Out of curiosity, I moved the scout well outside of Caldera, added some appropriate waypoints and she escorted me just as intended. I do not understand it since Nartisse uses AIEscort entirely along the pathgrid in Tel Mora. Perhaps it is moving from the pathgrid to wilderness that is upsetting the AI.

I believe your choice may be to convert from AIEscort to AITravel (as least until you are well beyond Caldera) or begin the journey further down the road than you first intended. After you have decided and updated the script (if you need assistance you only have to ask) send me a copy to test. I can detect problems and their causes much more efficiently that you can, or can be done through posts or personal messages.
User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

Post » Fri May 27, 2011 10:22 am

I apologize for taking so long to reply, I was out of town for the weekend. I have tested the script with your updated waypoints and have experienced the same problem you have described. It took me a little while to isolate, but for some reason GetCurrentAIPackage is returning true continuously rather than for the one frame that it is supposed to. This appears to be a problem with AIEscort and not AITravel in this instance, although I have other scripts using AIEscort successfully. I worried that it might be a pathgrid issue, but the scout does walk a little beyond Caldera's pathgrid (and nearly to the coordinates specified before GetAIPackageDone returns true and the script quickly cycles to the end. Out of curiosity, I moved the scout well outside of Caldera, added some appropriate waypoints and she escorted me just as intended. I do not understand it since Nartisse uses AIEscort entirely along the pathgrid in Tel Mora. Perhaps it is moving from the pathgrid to wilderness that is upsetting the AI.

I believe your choice may be to convert from AIEscort to AITravel (as least until you are well beyond Caldera) or begin the journey further down the road than you first intended. After you have decided and updated the script (if you need assistance you only have to ask) send me a copy to test. I can detect problems and their causes much more efficiently that you can, or can be done through posts or personal messages.


Please don't apologize there was plenty of other things for me to do in the mod in between messages - I'm relieved it wasn't just me getting the stalled NPC - having thought it through I think this is going to work out well - I'll have the player teleported via dialogue to a position outside of Caldera - one of the guide apprentices at Guide Hall is blind and causes chaos in later quests with sending the player and companions to the wrong places - this dialogue can also set the state for enabling the clone and disabling the real Lairah

So I'll redo the waypoints from a little closer to the Naked Nord signposts and resend the script to you

Speaking of disable and enable - i've previously used a global on my other NPC and clone who does this - that script is attached to each character - do i end up having a master script on the Lairah clone that includes the postalservice script and the disable/enable?
User avatar
Heather M
 
Posts: 3487
Joined: Mon Aug 27, 2007 5:40 am

Post » Fri May 27, 2011 2:04 pm

Okay - here's a problem something is firing in the script before I get a chance to talk to the NPC - I have a journal entry which says the player is tired of following the NPC but I can't work out what is triggering it as i haven't been able to get to the NPC to even get the quest started

Begin CT_PostalService; Attached to CT_Lariah01.; Directs travel from Caldera to Gnaar Mok.short 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 positionfloat stallTimershort playerAdmonishedshort buttonshort debugOn ; toggles debug codefloat debugTimerif ( menumode == 1 ) ; if menu is open do not process    returnendifif ( GetHealth <= 1 ) ; I don't this one is going to make it    if ( ( GetJournalIndex "CT_GoingPostal" ) < 9 )        SetHealth 0 ; just to be certain        Journal "CT_GoingPostal" 9    endif    returnendifif ( state == 3010 )    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 >= 10 )            set stallTimer to 0            if ( ( GetPos X ) == npcX ) ; has not moved for 10 seconds                if ( playerDistance < 1500 ) ; within speaking distance                    if ( playerAdmonished == 0 )                        set playerAdmonished to 1 ; first warning                        Messagebox "Am I going too fast for you ^PCName? Please... try to keep up."; prompt player to follow                    elseif ( playerAdmonished == 1 )                        set playerAdmonished to 2 ; second warning                        Messagebox "Is there a problem ^PCName? Are you going to abandon me?" "Sorry Lairah, I was a bit distracted, here I come." "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 "[Sighs] Come on then."    elseif ( button == 1 ) ; player leaves        set playerAdmonished to -1 ; its over        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    set state to 3000endifif ( state <= -20 ) ; stall rescue failed    set state to 490 ; 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 -14624 22840 1196 ; 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 -14993 23354 1215 0 ; point 2 - down road    set state to ( state + 10 )elseif ( state == 40 )    if ( GetAIPackageDone == 1 ) ; NPC at point 2        set state to ( state + 10 )    endifelseif ( state == 50 )    AIEscort player 0 -15693 24354 1265 0 ; point 3    set state to ( state + 10 )elseif ( state == 60 )    if ( GetAIPackageDone == 1 ) ; NPC at point 3        set state to ( state + 10 )    endifelseif ( state == 70 )    AIEscort player 0 -16260 25440 1205 0 ; point 4     set state to ( state + 10 )elseif ( state == 80 )    if ( GetAIPackageDone == 1 ) ; NPC at point 4        set state to ( state + 10 )    endifelseif ( state == 90 )    AIEscort player 0 -16636 25647 1211 0 ; point 5     set state to ( state + 10 )elseif ( state == 100 )    if ( GetAIPackageDone == 1 ) ; NPC at point 5        set state to ( state + 10 )    endifelseif ( state == 110 )    AIEscort player 0 -17637 25694 1157 0 ; point 6     set state to ( state + 10 )elseif ( state == 120 )    if ( GetAIPackageDone == 1 ) ; NPC at point 6        set state to ( state + 10 )    endifelseif ( state == 130 )    AIEscort player 0 -18894 25950 1146 0 ; point 7 - back to road    set state to ( state + 10 )elseif ( state == 140 )    if ( GetAIPackageDone == 1 ) ; NPC at point 7        set state to ( state + 10 )    endifelseif ( state == 150 )    AIEscort player 0 -20196 26134 1196 0 ; point 8     set state to ( state + 10 )elseif ( state == 160 )    if ( GetAIPackageDone == 1 ) ; NPC at point 8    endifelseif ( state == 170 )    AIEscort player 0 -21714 26050 1146 0 ; point 9     set state to ( state + 10 )elseif ( state == 180 )    if ( GetAIPackageDone == 1 ) ; NPC at point 9       set state to ( state + 10 )    endifelseif ( state == 190 )    AIEscort player 0 -23882 25879 1320 0 ; point 10 first sign    set state to ( state + 10 )elseif ( state == 200 )    if ( GetAIPackageDone == 1 ) ; NPC at point 10        Face -24026 25916 ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 210 )    AIEscort player 0 -23969 25351 1153 0 ; point 11 back to road    set state to ( state + 10 )elseif ( state == 220 )    if ( GetAIPackageDone == 1 ) ; NPC at point 11        set state to ( state + 10 )    endifelseif ( state == 230 )    AIEscort player 0 -30868 21458 1521 0 ; point 12 - top of road    set state to ( state + 10 )elseif ( state == 240 )    if ( GetAIPackageDone == 1 ) ; NPC at point 12        set state to ( state + 10 )    endifelseif ( state == 250 )    AIEscort player 0 -30364 19514 2032 0 ; point 13 - by large rocks    set state to ( state + 10 )elseif ( state == 260 )    if ( GetAIPackageDone == 1 ) ; NPC at point 13        set state to ( state + 10 )    endifelseif ( state == 270 )    AIEscort player 0 -31871 18055 2314 0 ; point 14 - by menhir    set state to ( state + 10 )elseif ( state == 280 )    if ( GetAIPackageDone == 1 ) ; NPC at point 14        set state to ( state + 10 )    endifelseif ( state == 290 )    AIEscort player 0 -33779 18238 1755 0 ; point 15 - by fence going down now    set state to ( state + 10 )elseif ( state == 300 )    if ( GetAIPackageDone == 1 ) ; NPC at point 15        set state to ( state + 10 )    endifelseif ( state == 310 )    AIEscort player 0 -35943 20052 1300 0 ; point 16 - third signpost (?)    set state to ( state + 10 )elseif ( state == 320 )    if ( GetAIPackageDone == 1 ) ; NPC at point 16;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 330 )    AIEscort player 0 -37486 22329 821 0 ; point 17 - big tree    set state to ( state + 10 )elseif ( state == 340 )    if ( GetAIPackageDone == 1 ) ; NPC at point 17        set state to ( state + 10 )    endifelseif ( state == 350 )    AIEscort player 0 -38448 26078 1286 0 ; point 18 - oh look another big tree    set state to ( state + 10 )elseif ( state == 360 )    if ( GetAIPackageDone == 1 ) ; NPC at point 18        set state to ( state + 10 )    endifelseif ( state == 370 )    AIEscort player 0 -39766 27987 1446 0 ; point 19 -  stump before bridge    set state to ( state + 10 )elseif ( state == 380 )    if ( GetAIPackageDone == 1 ) ; NPC at point 19        set state to ( state + 10 )    endifelseif ( state == 390 )    AIEscort player 0 -41861 28914 621 0 ; point 20 - on bridge (inspect bridge)    set state to ( state + 10 )elseif ( state == 400 )    if ( GetAIPackageDone == 1 ) ; NPC at point 20;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 410 )    AIEscort player 0 -45528 30145 631 0 ; point 21 - at bend    set state to ( state + 10 )elseif ( state == 420 )    if ( GetAIPackageDone == 1 ) ; NPC at point 21        set state to ( state + 10 )    endifelseif ( state == 430 )    AIEscort player 0 -46199 31945 612 0 ; point 22 - its a big bend    set state to ( state + 10 )elseif ( state == 440 )    if ( GetAIPackageDone == 1 ) ; NPC at point 22        set state to ( state + 10 )    endifelseif ( state == 450 )    AIEscort player 0 -49059 31943 296 0 ; point 23 - open space    set state to ( state + 10 )elseif ( state == 460 )    if ( GetAIPackageDone == 1 ) ; NPC at point 23        set state to ( state + 10 )    endifelseif ( state == 470 )    AIEscort player 0 -50837 29167 471 0 ; point 24 - stump by sea    set state to ( state + 10 )elseif ( state == 480 )    if ( GetAIPackageDone == 1 ) ; NPC at point 24        set state to ( state + 10 )    endifelseif ( state == 490 )    AIEscort player  0 -56257 29666 230 0 ; point 25 - big tree by sign    set state to ( state + 10 )elseif ( state == 500 )    if ( GetAIPackageDone == 1 ); NPC at point 25        set state to ( state + 10 )    endifelseif ( state == 510 )    AIEscort player 0 -56504 30140 283 0 ; point 26 - fourth sign, end of the line    set state to ( state + 10 )elseif ( state == 520 )    if ( GetAIPackageDone == 1 ) ; NPC at point 26;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 530 )    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 520 ; prevents further action    ForceGreeting ; this might be a good time to thank the player    returnelseif ( 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 pointendif; this is end of travel elseifsif ( state == 3000 ) ; player abandons    AIWander 512 5 0 0 20 10 10 10 20 0 0 0 ; adjust idles to suit    Journal "CT_GoingPostal" 8    Disable    set state to 3010endifEnd CT_PostalService


At the end of the script there is a section that states

if ( state == 3000 ); player abandons	AIWander 512 5 0 0 20 10 10 10 20 0 0 0; adjust idles to suit	Journal "CT_GoingPostal" 8


So I assume the NPC's state is being set to 3000 but what could be triggering that?
User avatar
Alex Blacke
 
Posts: 3460
Joined: Sun Feb 18, 2007 10:46 pm

Post » Fri May 27, 2011 9:28 pm

That's my bad.

I think it is the rescue code that is breaking things - it detects that Lariah does not have a travel package and starts cycling through all possible states to find a condition that she can satisfy. Eventually it does and Lariah wants to start moving. Since the player is not near the script interprets that to be abandonment and reacts accordingly. The script is very protective of Lariah. ;)

Move the if ( state == 0 ) block above the if ( state == 3010 ) block and change the line: if ( state <= -20 ) ; stall rescue failed line in the rescue code to read: if ( state <= 10 ) ; stall rescue failed otherwise the script may not process beyond if ( state == 0 ) should the AI stall.

State is set to 3000 near the end of the if ( playerAdmonished == 2 ) block of code. Not knowing how many waypoints you might end up having, I set these non-travel conditions well outside what I thought you might need. You can assign a different state to them, but they should be fine as they are.
User avatar
Add Me
 
Posts: 3486
Joined: Thu Jul 05, 2007 8:21 am

Post » Fri May 27, 2011 9:07 am

That's my bad.

I think it is the rescue code that is breaking things - it detects that Lariah does not have a travel package and starts cycling through all possible states to find a condition that she can satisfy. Eventually it does and Lariah wants to start moving. Since the player is not near the script interprets that to be abandonment and reacts accordingly. The script is very protective of Lariah. ;)

Move the if ( state == 0 ) block above the if ( state == 3010 ) block and change the line: if ( state <= -20 ) ; stall rescue failed line in the rescue code to read: if ( state <= 10 ) ; stall rescue failed otherwise the script may not process beyond if ( state == 0 ) should the AI stall.

State is set to 3000 near the end of the if ( playerAdmonished == 2 ) block of code. Not knowing how many waypoints you might end up having, I set these non-travel conditions well outside what I thought you might need. You can assign a different state to them, but they should be fine as they are.


Thanks Cyrano - that seems to have worked - although I wasn't sure why the script was firing at all n the first place as in dialogue I have it activating via a results box?

Anyway i got to her and selected the correct response to get her into action and off she took - but completely ignored the waypoints I had sent up - she did some cross - country bashing and we went over the hills down to the sea where she took me for a lovely swim - thank goodness there were no slaughterfish around and finally we got to the last waypoint where she obediently stopped and began scratching her head as if she had a bad case of dandruff :) At least we got there and passed through a couple of cells with out hardship

I guess I'll try redoing the first 3 waypoints and see if she can at least get to those instead of taking the most direct route to the finish line

It was great to follow her though - I did notice a few things that might need adjusting - she goes quite quickly and it is easy to fall behind - I might need to adjust her nag commands so there is a bit more sistance between you - also is there a way to get her to pause so you can catch up eg under attack and need some time to get cliffracer off your back?
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Fri May 27, 2011 8:22 am

As I posted earlier - the rescue code began cycling through all possible travel states until it came to one that could be satisfied. By placing the return on state = 0 this is prevented.

I am not certain I understand you, but I think you are reporting that Lariah is moving west without attempting to reach any of the waypoints you designated. It sounds like a problem with what I call 'latent AI', but it is not something I expected with a clone. Is it possible that this same version of Lariah starts in another cell and has been moved to the location west of Caldera? If it is what I suppose your describe, the behavior is associated with re-positioning an NPC that was performing some AI package other than AIWander. If so, try adding the AIWander package before moving Lariah. Otherwise affected NPCs exhibit a single-minded drive to return to their former location (or last point instructed to move) rivaled only by spawning salmon. A time-honored method of waking up an NPC from this sleepwalking is to trigger combat for a few frames - it seems to wipe out the old AI.

On the subject of combat, that really should not be an issue when the player is traveling with Lariah. In AIEscort (as with AIFollow) the NPC will fight alongside the player. This suspends the travel AI until combat is concluded. If you did not find this to be the case it may be another indication that Lariah is running a former AI package that was interrupted by Position.

As you have discovered, testing traveling NPCs is a long and challenging process. If you are not already, you really should utilize the debug code I included in the script. Activate Lariah through the console and type: set debugOn to 1 . This will generate messages every three seconds that will let you know the current value of state and a few other variables that control AI. I would be very interested to know the value returned by GetCurrentAIPackage when Lariah goes on her march to the coast. If she is being directed by her script it should return a value of 2 (AIEscort). A value of 3 is AIFollow, a value of 1 is AITravel and a value of 0 is AIWander. GetCurrentAIPackage is not returned by the debug code - you will have to enter it through the console after having selected Lariah.

You can increase the time before Lariah admonishes the player, but I suggest reducing her speed. If she is walking faster than the player can comfortably keep up then she must be moving very quickly. I have not had this problem with AIEscort.

I agree it is a bit a thrill to watch your NPCs perform the choreography you prepared for them, but it does take a lot of time or more insight than you probably have yet to test if the NPC is performing as intended. It may be more efficient for me to test and debug the script directly. I have pretty good instincts about travel bugs and I know how to use the information returned by the debug code. If you agree you can either send me the script (personal message or my email) and tell me where to place the NPC, or sent me the esp.
User avatar
Shianne Donato
 
Posts: 3422
Joined: Sat Aug 11, 2007 5:55 am

Post » Fri May 27, 2011 4:40 pm

...It sounds like a problem with what I call 'latent AI'...

I prefer 'Wall-and-Lava-Pit Inspection Mode', but I have to admit your description is more concise :P

Illuminiel, I don't think Cyrano mentioned this, but if GetCurrentAIPackage returns -1 that's when you need the combat fix (so it is detectable in script, and can be worked around). It's really only a big problem for creatures (b/c guards will attack any creature in combatmode).

I have another draft script (or set of scripts, now) for you - it's not tested (not even a quick compile) - just want to know what you think, what else needs doing, etc.

Companion local script:
begin illyCompanionLSshort followNow  ;simple check for follow mode - if you have a follow variable		;that's set from dialogue it would be more reliable so replace this if you have oneshort counter  ; added b/c script is filling up a bit now -                ;  stuff that doesn't need to be done every frame can go at end of scriptshort oldCell  ;type of previous cell, interior=1, exterior=0short curCell  ;type of current cell (as above)short matchZ  ;warp needed on z-axis? for levitation/swimmingshort cmbtChk  ;combat checkshort wwChk  ;do-once for taking waterwalking potionshort swimChk  ;does the cell have water? (if so then will check for swimming)short sick  ;check for disease, 0=healthy 1=common disease 2=blight diseaseshort attrDmgshort doorFix  ;state variable for load-door fixshort doOnce1  ;doonce vars for Grumpy's warping code/save warp destination pointsshort doOnce2short tmpS  ;just a temp var (can use in dialogue results calcs)short storeDay  ;simple day change check for medication once-per-day                    ; - remove this if doing it in dialogue instead;potion storage vars;these will need spells set up to apply the effects, except for;  restore health (which is better done in code alone);spells should all be type ability;to use these in dialogue:;if using one of the NPC's potions (ie one stored in these vars):;check that the relevant variable is > 0 (ie that she's actually got some) and if so:;			set variable to ( variable - 1 );			AddSpell "spell ID";			set cureTmr to 1;(that last line will trigger the script to remove the ability once it's done its job);of course replace placeholder ids with the real idsshort pv_lev  ;levitationshort pv_cureC  ;cure common diseaseshort pv_health  ;restore healthshort pv_wwalk  ;water walkingshort pv_dispel  ;dispel (note: beware mischievous players telling her to take a dispel potion while levitating/waterwalking!)short pv_meds  ;daily medicine (2 associated spells needed for this one: cure blight and restore all attributes)float ax  ;position vars for warpingfloat ayfloat bxfloat byfloat bzfloat cxfloat cyfloat czfloat t1  ;temp vars used in warping codefloat t2  ;these "t*" vars can be reused as temp vars in dialogue results if neededfloat t3float t4float coDist  ;distance checks for warpingfloat coDist2float pcDist  ;distance to player - GetDistance is slow, it's cheaper to check once per framefloat warpTmr  ;time out for warpingfloat wndrTmr  ;time out for wander (door fix etc) - can be used in dialogue eg step aside option;to use a step aside option, put in dialogue results:;		set wndrTmr to 3;		AIWander 1000 0 0 0 0 0 0 0 0 0 0 0;		goodbye;the timer should (I hope) put her back in follow mode when it's done (if she was in follow;  mode to start with)float sheathe  ;timer for weapon sheathing after combat (otherwise sheathing would                ;   trigger when combat target is distant or when switching combat targets)float levTmr  ;levitation time-outfloat cureTmr  ;timer for cure/restore abilities to simulate potion usefloat prevX  ;check for change in x-position - more reliable than cellChangedfloat currXfloat swimLvl  ;used to check if swimmingfloat playZfloat myZ  ;current z-positionfloat tmpF  ;just a temp var (can be used for calcs in dialogue results);heal and restore while sleeping, and;check if NPC is dead/unconscious/paralysed -;no point running the rest if they are!if ( GetHealth < 1 )    returnelseif ( GetPCSleep )  ;I put this before menumode since otherwise the PC    ModCurrentHealth 999  ; has to sleep at least 2 hours for it to trigger    ModCurrentMagicka 999    ModCurrentFatigue 999    returnelseif ( GetPCTraveling )	set doorFix to 1 ;wander to get out of pile-up after fast travel	returnelseif ( MenuMode )    returnelseif ( GetFatigue < 1 )    returnelseif ( GetParalysis > 0 )    returnendifif ( wndrTmr < 500 )elseif ( doorFix != 0 )elseif ( GetCurrentAIPackage == 3 )	set followNow to 1elseif ( GetCurrentAIPackage != -1 )  ;if AI is invalid, this assumes the last valid package	set followNow to 0				;is still the correct one	set warpTmr to 0endif;check for cell change - need to know if one or both; cells are interior. This triggers the door-fix wander;Problem is that on game load the x-pos is wrong value first time;  so also check for game load via startscriptset tmpS to 0set prevX to currXset currX to ( GetPos x )set tmpF to ( currX - prevX )if ( doorFix == -1 )  ;just warped, false alarm	set doorFix to 0elseif ( doorFix == 0 )	if ( followNow == 0 )	elseif ( mel_reload == 1 )  ;game load = false alarm	elseif ( tmpF > 512 )		set tmpS to 1	elseif ( tmpF < -512 )		set tmpS to 1	endifendifif ( tmpS >= 1 )	set oldCell to curCell	set curCell to ( GetInterior )	set swimChk to 0	if ( oldCell == 1 )  ;if a cell is interior, do the fix		set doorFix to 1	elseif ( curCell == 1 )		set doorFix to 1	elseif ( tmpS == 1 )  ;this will kick in with e.g. scripted teleports		set doorFix to 1	endifendifset pcDist to ( GetDistance player )set warpTmr to ( warpTmr + GetSecondsPassed )if ( wndrTmr < 500 )	set wndrTmr to ( wndrTmr - GetSecondsPassed )	set warpTmr to 0	if ( wndrTmr <= 0 )		set wndrTmr to 512		if ( followNow == 1 )			AIFollow player 0 0 0 0		else			AIWander 256 0 0 30 35 5 10 5 10 5 0 0  ;replace idles and distance with your defaults/whatever you want		endif	endifendifif ( doorFix > 0 )	if ( mel_reload != 0 )  ;if it got past the first check, catch it here		set wndrTmr to 0.1  ;this should hopefully put her back in follow mode		set doorFix to 0		return	elseif ( doorFix > 7 )		if ( wndrTmr > 500 )			set doorFix to 0  ;all done			return		endif	elseif ( doorFix == 4 )		if ( pcDist < 800 )  ;don't need to warp			set doorFix to 6		elseif ( ScriptRunning illy_loaddoorfix == 0 )			set doorFix to 5			StartScript illy_loaddoorfix  ;warp companion back to player if she's got lost		endif	elseif ( doorFix == 5 )		if ( pcDist > 800 )  ;wait for script to do its job			return		elseif ( ScriptRunning illy_loaddoorfix == 0 )			set doorFix to 6		endif	elseif ( doorFix == 6 )		AIWander 512 0 0 0  ;this also helps get companion out of the post-door pile-up		set wndrTmr to 2		set doorFix to 7	else		set doorFix to ( doorFix + 1 )	endif	set warpTmr to 4	returnendif;remove spell abilities when doneif ( cureTmr >= 0 )	set cureTmr to ( cureTmr + GetSecondsPassed )	if ( cureTmr >= 2 )		set cureTmr to -2		RemoveSpell "illy_cureBlight"		RemoveSpell "illy_restoreAttribs"		RemoveSpell "illy_cureCommon"		RemoveSpell "illy_dispel"	endifendif;check health and run or teleport away if necessary;just remove this block if you don't want itif ( GetHealthGetRatio < 0.25 )    MessageBox "Insert flee-by-teleport message here"    PlaySound3d "swallow"  ;pretend to take a potion    PlaySound3d "mysticism hit"    PositionCell 10 -58 131 0 "Caldera, Shenk's Shovel"  ;change destination as you like    returnelseif ( GetHealthGetRatio < 0.5 )    if ( GetFlee < 90 )        SetFlee 100        MessageBox "Insert flee-by-running message here if you want one"  ;or you could use say for a voice file instead    endifelseif ( GetFlee > 90 )    SetFlee 10  ;change to whatever your default isendif;give her a health potion if health is low;change health percent value to whatever you wantif ( GetHealthGetRatio < 0.7 )	if ( pv_health > 0 )     ;are these going to be Exclusive potions??		set pv_health to ( pv_health - 1 )		PlaySound3d "swallow"		PlaySound3d "restoration hit"		ModCurrentHealth 200  ;if not Exclusive, change this value to match potion total health increase	endifendif;this next part checks for combat so they don't warp in the middle of it;and so can force weapon sheathing afterwards if they get stuck like that;removed spellcast sound checks, so now there's room to put hit checks in same blockif ( cmbtChk )	set warpTmr to -2	set sheathe to ( sheathe - GetSecondsPassed )	if ( GetSoundPlaying "Weapon Swish" )		set sheathe to 5	elseif ( GetSoundPlaying "crossbowShoot" )		set sheathe to 5	elseif ( GetSoundPlaying "bowShoot" )		set sheathe to 5	elseif ( GetSoundPlaying "Health Damage" )		set sheathe to 5	elseif ( GetSoundPlaying "destruction hit" )		set sheathe to 5	elseif ( GetSoundPlaying "frost_hit" )		set sheathe to 5	elseif ( GetSoundPlaying "shock hit" )		set sheathe to 5	elseif ( GetSoundPlaying "alteration hit" )		set sheathe to 5	elseif ( GetSoundPlaying "illusion hit" )		set sheathe to 5	elseif ( GetSoundPlaying "Hand To Hand Hit" )		set sheathe to 5	elseif ( GetSoundPlaying "Hand to Hand Hit 2" )		set sheathe to 5	elseif ( sheathe <= 0 )		set cmbtChk to 0        if ( GetSpellReadied )            cast "mark" player        else            equip "chitin dagger"          ;Change this if your NPC actually has one. You            RemoveItem "chitin dagger" 1   ;  should use a 1-handed weapon they *don't* have        endif                                ;  - otherwise it will remove their real weapon!    endifelseif ( GetWeaponDrawn )	set cmbtChk to 1	set sheathe to 5	set warpTmr to -2elseif ( GetSpellReadied )	set cmbtChk to 1	set sheathe to 5	set warpTmr to -2endif;check for attribute damage;note this isn't all that reliable (but she'll get restored each day regardless so not a big deal)if ( GetEffect sEffectRestoreAttribute )	set attrDmg to 0elseif ( GetEffect sEffectDamageAttribute )	set attrDmg to 1elseif ( attrDmg == 1 )	set attrDmg to 2endifif ( followNow == 1 )	if ( GetForceSneak )		if ( cmbtChk )  ;take her out of sneak mode if in combat			ClearForceSneak		elseif ( player->GetEffect sEffectInvisibility )		elseif ( player->GetEffect sEffectChameleon )		elseif ( GetPCSneaking == 0 )			ClearForceSneak		endif	elseif ( cmbtChk )	elseif ( GetPCSneaking == 1 )		ForceSneak  ;sneak when the player is sneaking, except in combat	endif		if ( player->GetEffect sEffectWaterWalking )		if ( wwChk == 1 )		elseif ( pv_wwalk > 0 )			set pv_wwalk to ( pv_wwalk - 1 )  ;take a waterwalking potion			set wwChk to 1			PlaySound3d "swallow"			PlaySound3d "alteration hit"			AddSpell "efb_bf_wwalkA"		endif	elseif ( wwChk == 1 )		RemoveSpell "efb_bf_wwalkA"		set wwChk to 0	endif		;this bit will make her sneak when the player uses chameleon or	;invisiblity spells - just remove it if you don't want it,	;it shouldn't affect anything else much		if ( cmbtChk )	elseif ( player->GetEffect sEffectInvisibility )		if ( GetForceSneak == 0 )			ForceSneak		endif	elseif ( player->GetEffect sEffectChameleon )		if ( GetForceSneak == 0 )			ForceSneak		endif	endif		;levitation works on a timer, so she has time to get down	;after player's levitation runs out	;note: it's all in follow mode block, so if player tells her to wait	;while levitating she'll just stay there in the air indefinitely!	;this can be changed if you want (can add a slowfall ability and get	;down that way)		if ( player->GetEffect sEffectLevitate == 1 )		if ( levTmr > 1 )			set levTmr to 1		elseif ( levTmr <= 0 )			if ( pv_lev > 0 )				set pv_lev to ( pv_lev - 1 )  ;take a levitation potion				PlaySound3d "swallow"				PlaySound3d "alteration hit"				AddSpell "illy_levitateA"				set levTmr to 1			elseif ( GetEffect sEffectLevitate == 0 )  ;in case player casts on her or something				AIWander 0 0 0  ;don't try to follow if can't levitate				MessageBox "do you want a warning when she's out of levitation potions??"			endif		endif	elseif ( levTmr > 10 )		RemoveSpell "illy_levitateA"		set levTmr to 0	elseif ( levTmr > 0 )		set levTmr to ( levTmr + GetSecondsPassed )	endif	elseif ( followNow == 0 )	set warpTmr to 0endifif ( swimChk == 0 )  ;we don't know if there's water in this cell or not	if ( curCell == 0 )  ;exterior always has water		set swimChk to 1	elseif ( GetWindSpeed > 0.001 )  ;interior as exterior		set swimChk to 1	elseif ( GetSoundPlaying "FootWaterLeft" == 1 )  ;in true interiors, can only know if		set swimChk to 1							;there's water when you've stepped in it	elseif ( GetSoundPlaying "FootWaterRight" == 1 )		set swimChk to 1	elseif ( GetSoundPlaying "DefaultLandWater" == 1 )		set swimChk to 1	endifendif;Grumpy's warping calcsset playZ to ( player->GetPos z )set myZ to ( GetPos z )set ax to ( Player->GetPos x )set ay to ( Player->GetPos y )if ( doOnce1 == 0 )	set bx to ( Player->GetPos x )	set by to ( Player->GetPos y )	set bz to playZ	set doOnce1 to 1endifset t1 to ( ax - bx )set t1 to ( t1 * t1 )set t2 to ( ay - by )set t2 to ( t2 * t2 )set t1 to ( t1 + t2 )set coDist to ( GetSquareRoot t1 )if ( coDist > 360 )	set doOnce1 to 0endifif ( coDist > 180 )	if ( doOnce2 == 0 )		set cx to ( Player->GetPos x )		set cy to ( Player->GetPos y )		set cz to playZ		set doOnce2 to 1	endifendifset t3 to ( ax - cx )set t3 to ( t3 * t3 )set t4 to ( ay - cy )set t4 to ( t4 * t4 )set t3 to ( t3 + t4 )set coDist2 to ( GetSquareRoot t3 )if ( coDist2 > 360 )	set doOnce2 to 0endif;the actual warping bitif ( warpTmr > 6 )	if ( pcDist > 680 )		if ( coDist > 350 )			set doorFix to -1			set warpTmr to 0			SetPos x bx			SetPos y by			SetPos z bz			AIFollow Player 0 0 0 0			return		elseif ( coDist2 > 350 )			set doorFix to -1			set warpTmr to 0			SetPos x cx			SetPos y cy			SetPos z cz			AIFollow Player 0 0 0 0			return		endif	endifendifif ( cmbtChk != 0 )elseif ( doorFix != 0 )elseif ( followNow == 0 )elseif ( wndrTmr < 500 )elseif ( GetEffect sEffectLevitate )  ;check geteffect again in case the pc casts on her	set matchZ to 1elseif ( swimChk == 1 )	set swimLvl to ( ( GetWaterLevel ) - 119.7 )  ;check if actually *in* the water, not just wading	if ( myZ <= swimLvl )	;we're swimming		set swimLvl to ( swimLvl - 12 )		set tmpF to ( swimLvl - 20 )		if ( myZ <= swimLvl )	;companion is underwater			set matchZ to 1		elseif ( playZ < tmpF )	;player underwater			set matchZ to 1		endif	endifendif;this bit moves the companion gradually towards the player's z-axis position;still has same issue as Grumpy's companions in that it can't detect collision;so can end up stuck in stairs etc - but that fixes itself soon enoughif ( matchZ == 1 )	set matchZ to 0	set tmpF to ( myZ - playZ )	if ( tmpF != 0 )		if ( tmpF >= 5 )			set myZ to ( myZ - 5 )		elseif ( tmpF <= -5 )			set myZ to ( myZ + 5 )		else			set myZ to playZ		endif		SetPos z myZ	endifendifif ( cmbtChk == 1 )	set counter to 0	returnelseif ( counter < 20 )            ;  ---------- COUNTER ----------	set counter to ( counter + 1 )	returnendifset counter to 0if ( GetPCCell "cell where you want potions to restock" )  ;need to add id here!; or if you prefer dialogue for this just delete the block; all the if-checks are in case you ever want to set the vars higher; this way they won't be reduced, only increased    if ( pv_lev < 3 )        set pv_lev to 3    endif    if ( pv_cureC < 3 )        set pv_cureC to 3    endif    if ( pv_health < 3 )        set pv_health to 3    endif    if ( pv_wwalk < 3 )        set pv_wwalk to 3    endif    if ( pv_dispel < 3 )        set pv_dispel to 3    endif    if ( pv_meds < 5 )        set pv_meds to 5    endifendif;in theory Day should be less accurate here than DaysPassed; - but Day doesn't require any particular master file (don't know; if this is tribunal-dependent?); - plus the inaccuracy is very unlikely to happen, and the player probably; won't notice even if it does!if ( pv_meds == 0 )    ;don't do anything yet - this will let her take a potion as soon as she gets oneelseif ( storeDay != Day )    set storeDay to Day    set pv_meds to ( pv_meds - 1 )    AddSpell "illy_cureBlight"  ;placeholder ids    AddSpell "illy_restoreAttribs"    set cureTmr to 1    if ( pv_meds == 1 )        MessageBox "insert message warning player there's only 1 dose left"    endifendifif ( GetEffect sEffectCorpus )  ;note that GetBlightDisease will return true before GetEffect can detect corprus    RemoveEffects 132  ;effect ID for corprus - this needs testing btw, might have to use an ability-type spell instead	set sick to 0                   ;   (note: if the above doesn't work, SfD will need updating!)elseif ( sick == 2 )    if ( ( GetJournalIndex "cure quest ID" ) >= value )  ;PLACEHOLDER - assuming here that cure quest (if you do one) will have a journal        AddSpell "illy_cureBlight"  ;placeholder ID, change as you like        set cureTmr to 1    endif   ;assuming nothing should be done here otherwise? (wait for daily medicine dose?)elseif ( sick == 1 )    if ( pv_cureC > 0 )        set pv_cureC to ( pv_cureC - 1 )        PlaySound3d "swallow"        PlaySound3d "restoration hit"        AddSpell "illy_cureCommon"  ;another placeholder ID        set cureTmr to 1            ;   all these spells should all be type ability    endifendif;disease check - can be dealt with in script or dialogue or both as you likeif ( GetBlightDisease )    set sick to 2elseif ( GetCommonDisease )    set sick to 1else    set sick to 0endif;these are in case your NPC goes swimming - NPCs are too;stupid to keep their heads above water :P;acrobatics is mostly for teleport doors - prevents damage if NPC is slowfalling etcif ( GetWaterBreathing != 1 )    SetWaterBreathing 1endifif ( GetAcrobatics < 199 )    SetAcrobatics 200endifModCurrentFatigue 10  ;companions run a lot while in follow mode, this keeps their						;fatigue up (but won't take effect in combat);emergency warp straight to player position;should only happen when there's no valid warp point storedif ( followNow == 0 )elseif ( pcDist > 1024 )	if ( warpTmr > 9 )		set doorFix to -1		SetPos x ax		SetPos y ay		SetPos z playZ		AIFollow player 0 0 0 0		return	endifendifend


Load door fix/warp (this is called from the companion local script when you go through a loaddoor, use fast travel, teleport with the companion, etc)
begin illy_loaddoorfix;quick warp, used for teleport door fix when companion ends up too far away (disappears);must be targeted script as local script setPos is not reliable here;this script can be used for other followers as well (but if there are many followers at;  once I'd have a few different scripts, since they'll have to wait til one's available)short statefloat timerfloat warpxfloat warpyfloat warpzif ( MenuMode == 1 )	returnelseif ( GetHealth < 1 )  ;mostly a check for script losing its target (GetHealth	set state to 0        ;   will return 0 if that happens)	set timer to 0	StopScript illy_loaddoorfix	returnelseif ( state == 0 )	if ( timer < 0.2 )		set timer to ( timer + GetSecondsPassed )		return	endif	set timer to 0	set warpx to ( player->GetPos x )	set warpy to ( player->GetPos y )	set warpz to ( player->GetPos z )	set state to 10elseif ( state == 10 )	SetPos x warpx	SetPos y warpy	SetPos z warpz	disable	enable	AIFollow player 0 0 0 0	set state to 20	returnelseif ( state == 20 )	if ( timer < 0.1 )		set timer to ( timer + GetSecondsPassed )		return	endif	set state to 0	set timer to 0	if ( ( GetDistance player ) > 2048 )  ;if still too far away, try again		if ( ( GetDistance player ) < 999999 )  ;but give up if actually in a different cell!			return		endif	endif	StopScript illy_loaddoorfixendifend


Game load detection (to stop companion wandering on game load as well). For this you need to add a global variable (called "mel_reload" here, you can use that or change it if you want). The variable should just have default settings (short, default 0).
begin mel_checkloadfloat timerif ( timer < 0.5 )	set timer to ( timer + GetSecondsPassed )	if ( mel_reload == 0 )		set mel_reload to 1	endifelse	set timer to 0	set mel_reload to 0	StopScript mel_checkloadendifend


So, let me know what you want done with it etc. And good luck with the escort!
User avatar
Sakura Haruno
 
Posts: 3446
Joined: Sat Aug 26, 2006 7:23 pm

Post » Fri May 27, 2011 2:38 pm

Wow - thanks Melian - what awesome work - I'll just finish up the escort mission then begin installing and testing the scripts I'll let you know how it goes

Cyrano you were quite right - I deleted the original clone from Caldera gates and then dropped a fresh one onto the spot I wanted her to start from in West Gash something funny had gone on with her dialogue as she was saying the greeting correctly but then no other topics were appearing so i wondered what was going on.

I'll do some surgery on her this evening and then try the debug on her - the esp is a bit big to send as I have a ton of new faces, clothes, biks and other assorted meshes added - not that I mind sharing with you at all :)

Once I get her doing the walk can we talk about getting her to stop at some of the signposts and making comments - at two of them I'd like some univited visitors to turn up and annoy her - however I need her to stop the walk cycle at this point so the player can either talk thier way out or slug it out - once the action is over I need Lairah to have her script reactivated and go to the next sign - am okay with handling the action via dialogue and either baffling the intruders or iniating combat I suspect she might get a state set by a journal update which stops her and then via dialogue reset the state to get her going again - is that how you would see it?

Anyway off to have a look at her Ai latentcy

ps - i loved the salmon anology - when she was swimming I was hoping like crazy she wouldn't drown herself - nice animation to watch though :)
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Fri May 27, 2011 8:06 pm

Update - So I rest Lairah and made some minor adjustments to the script like removing the nolore - here's what happened

Once more she took off and ignored her first waypoint which is just metres away - so I hit her with the console to debug and sure enough her state has set to 380 which is the last stop of the trip

I checked her AI package as you recommended Cyrano and it was set to 0 when i first meet her - and then when she takes off it is set to 2 which I believe is correct - so I checked my results box to make sure I had set the state correctly there it reads

Begin CT_PostalService; Attached to CT_Lairah01.; Directs travel from 2nd signpost past Naked Nord to Gnaar Mok.short 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 positionfloat stallTimershort playerAdmonishedshort buttonshort debugOn ; toggles debug codefloat debugTimerif ( menumode == 1 ) ; if menu is open do not process    returnendifif ( GetHealth <= 1 ) ; I don't this one is going to make it    if ( ( GetJournalIndex "CT_GoingPostal" ) < 9 )        SetHealth 0 ; just to be certain        Journal "CT_GoingPostal" 9    endif    returnendifif ( state == 3010 )    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 ; first warning                        Messagebox "Please, ^PCName... try to keep up."; prompt player to follow                    elseif ( playerAdmonished == 1 )                        set playerAdmonished to 2 ; second warning                        Messagebox "I cannot wait on you forever, ^PCName. Are you coming or not?" "Sorry Lairah I'll with you in a moment." "Actually I'm going to do something else."                    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        Messagebox "Oh? Well... all right then."	   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 ( state == 0 ) ; not yet traveling    returnendifif ( 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    set state to 3000endifif ( state <= 10 ) ; stall rescue failed    set state to 370 ; set to highest relevant (travel) stateendif; START WALKING - travel codeelseif ( state == 10 ) ; set through dialog    SetHello 0 ; prevent idle greetings    AIEscort player 0 -25709 23389 1243 0 ; point 1 - first signpost    set state to ( state + 10 )elseif ( state == 20 )    if ( GetAIPackageDone == 1 ) ; NPC at point 1;        Face -25807 23266 ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 30 )    AIEscort player 0 -26045 23669 1153 0 ; point 2 - back to middle of road    set state to ( state + 10 )elseif ( state == 40 )    if ( GetAIPackageDone == 1 ) ; NPC at point 2        set state to ( state + 10 )    endifelseif ( state == 50 )    AIEscort player 0 -28195 22730 1323 0 ; point 3 - at turn off to kudanat    set state to ( state + 10 )elseif ( state == 60 )    if ( GetAIPackageDone == 1 ) ; NPC at point 3        set state to ( state + 10 )    endifelseif ( state == 70 )    AIEscort player 0 -30327 22468 1225 0 ; point 4 - by Rockpile    set state to ( state + 10 )elseif ( state == 80 )    if ( GetAIPackageDone == 1 ) ; NPC at point 4        set state to ( state + 10 )    endifelseif ( state == 90 )    AIEscort player 0 -30868 21458 1521 0 ; point 5 - top of road    set state to ( state + 10 )elseif ( state == 100 )    if ( GetAIPackageDone == 1 ) ; NPC at point 5        set state to ( state + 10 )    endifelseif ( state == 110 )    AIEscort player 0 -30364 19514 2032 0 ; point 6 - by large rocks    set state to ( state + 10 )elseif ( state == 120 )    if ( GetAIPackageDone == 1 ) ; NPC at point 6        set state to ( state + 10 )    endifelseif ( state == 130 )    AIEscort player 0 -31871 18055 2314 0 ; point 7 - by menhir    set state to ( state + 10 )elseif ( state == 140 )    if ( GetAIPackageDone == 1 ) ; NPC at point 7        set state to ( state + 10 )    endifelseif ( state == 150 )    AIEscort player 0 -33779 18238 1755 0 ; point 8 - by fence going down now    set state to ( state + 10 )elseif ( state == 160 )    if ( GetAIPackageDone == 1 ) ; NPC at point 8        set state to ( state + 10 )    endifelseif ( state == 170 )    AIEscort player 0 -35943 20052 1300 0 ; point 9 - second signpost (?)    set state to ( state + 10 )elseif ( state == 180 )    if ( GetAIPackageDone == 1 ) ; NPC at point 9;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 190 )    AIEscort player 0 -37486 22329 821 0 ; point 10 - big tree    set state to ( state + 10 )elseif ( state == 200 )    if ( GetAIPackageDone == 1 ) ; NPC at point 10        set state to ( state + 10 )    endifelseif ( state == 210 )    AIEscort player 0 -38448 26078 1286 0 ; point 11 - oh look another big tree    set state to ( state + 10 )elseif ( state == 220 )    if ( GetAIPackageDone == 1 ) ; NPC at point 11        set state to ( state + 10 )    endifelseif ( state == 230 )    AIEscort player 0 -39766 27987 1446 0 ; point 12 -  stump before bridge    set state to ( state + 10 )elseif ( state == 240 )    if ( GetAIPackageDone == 1 ) ; NPC at point 12        set state to ( state + 10 )    endifelseif ( state == 250 )    AIEscort player 0 -41861 28914 621 0 ; point 13 - on bridge (inspect bridge)    set state to ( state + 10 )elseif ( state == 260 )    if ( GetAIPackageDone == 1 ) ; NPC at point 13;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 270 )    AIEscort player 0 -45528 30145 631 0 ; point 14 - at bend    set state to ( state + 10 )elseif ( state == 280 )    if ( GetAIPackageDone == 1 ) ; NPC at point 14        set state to ( state + 10 )    endifelseif ( state == 290 )    AIEscort player 0 -46199 31945 612 0 ; point 15 - its a big bend    set state to ( state + 10 )elseif ( state == 300 )    if ( GetAIPackageDone == 1 ) ; NPC at point 15        set state to ( state + 10 )    endifelseif ( state == 310 )    AIEscort player 0 -49059 31943 296 0 ; point 16 - open space    set state to ( state + 10 )elseif ( state == 320 )    if ( GetAIPackageDone == 1 ) ; NPC at point 16        set state to ( state + 10 )    endifelseif ( state == 330 )    AIEscort player 0 -50837 29167 471 0 ; point 17 - stump by sea    set state to ( state + 10 )elseif ( state == 340 )    if ( GetAIPackageDone == 1 ) ; NPC at point 17        set state to ( state + 10 )    endifelseif ( state == 350 )    AIEscort player  0 -56257 29666 230 0 ; point 18 - big tree by sign    set state to ( state + 10 )elseif ( state == 360 )    if ( GetAIPackageDone == 1 ); NPC at point 18        set state to ( state + 10 )    endifelseif ( state == 370 )    AIEscort player 0 -56504 30140 283 0 ; point 19 - fourth sign, end of the line    set state to ( state + 10 )elseif ( state == 380 )    if ( GetAIPackageDone == 1 ) ; NPC at point 19;        Face x y ; requires the x and y coordinate of signpost to work        set saveState to state; store current state        set state to 1000    endifelseif ( state == 390 )    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 400 ; prevents further action    ForceGreeting ; this might be a good time to thank the player    returnelseif ( 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 pointendif; this is end of travel elseifsif ( state == 3000 ) ; player abandons    AIWander 512 5 0 0 20 10 10 10 20 0 0 0 ; adjust idles to suit    Journal "CT_GoingPostal" 8    Disable    set state to 3010endifEnd CT_PostalService


If I can just get her to go the first couple of waypoints i'm sure she will be fine - if she has some AI blight disease do I need to delete her using Tesame and then create a new version of her?
User avatar
Mrs Pooh
 
Posts: 3340
Joined: Wed Oct 24, 2007 7:30 pm

Post » Fri May 27, 2011 6:42 pm

Replacing the NPC is not the issue, but yes there is a character limit to messagebox content (either 256 or 512 - perhaps dictated by whether or not the expansions are loaded, I can't remember right now). If you want longer messages there is a workaround I can share.

I did find the bug - my quick fix for the rescue code created a new problem. Many of the waypoints did not track well so I remapped the route. I am testing starting at Caldera also, and it is working except for one AIEscort instruction. At the moment I replaced it with AITravel so I could finish the route. Facing is not working at the signposts as expected and a little variety in behavior would be nice. I would like to fiddle with this one more day so see if I can resolve a few of the lingering issues (if I cannot it is still satisfactory). I would like to send the new script as an MS Word document to preserve formatting (tabs - I hate indenting with spaces in scripts). Will that be acceptable or do you require a .txt document?
User avatar
Danii Brown
 
Posts: 3337
Joined: Tue Aug 22, 2006 7:13 am

Post » Fri May 27, 2011 6:58 pm

Replacing the NPC is not the issue, but yes there is a character limit to messagebox content (either 256 or 512 - perhaps dictated by whether or not the expansions are loaded, I can't remember right now). If you want longer messages there is a workaround I can share.

I did find the bug - my quick fix for the rescue code created a new problem. Many of the waypoints did not track well so I remapped the route. I am testing starting at Caldera also, and it is working except for one AIEscort instruction. At the moment I replaced it with AITravel so I could finish the route. Facing is not working at the signposts as expected and a little variety in behavior would be nice. I would like to fiddle with this one more day so see if I can resolve a few of the lingering issues (if I cannot it is still satisfactory). I would like to send the new script as an MS Word document to preserve formatting (tabs - I hate indenting with spaces in scripts). Will that be acceptable or do you require a .txt document?


You are a modding treasure Cyrano and have done far more than I ever expected - am feeling both guilty and happy - I hope I can create something for you in return some day - word is fine and there is no hurry - am currently playing with Max AKA Nobodies schedule tool to try and bring my small community a little more alive

One thing I noted in the nag script was that it doubled up quite quickly - so Lairah would produce 2 messageboxes very quickly

The essence of this quest is to gain her trust - she doesn't really want the player tagging along especially if they are non-Telvanni - however despite her rather bluff exterior she has some self doubts and fears - I wanted to have each signpost as an opportunity to pause and talk - if a fight breaks with NPC's out I'd rather have her flee than try and help - as the follow up quest will be to find her and help her overcome her feelings of shame for abandoning you - am debating an option of the player being able to give her a blast - but I suspect if they have chosen to go find her then the intent is to get her on side rahter than push her over the edge.

Just wanted to give some more background into how this quest fits into her relationship with the player.

Thanks again so much for helping - am looking forward to replicating the way the script goes for another travel quest with her later.
User avatar
Donatus Uwasomba
 
Posts: 3361
Joined: Sun May 27, 2007 7:22 pm

PreviousNext

Return to III - Morrowind