Problems with Fliggerty's slave mod

Post » Thu Jun 30, 2016 12:29 am

Hello,

so I recently started a new game and I decided to start using slaves with Fliggerty's slave mod, but I ran into some issues. Sometimes slaves follow exactly how they should, i.e. with high speed, but sometimes they follow slowly, like vanilla npcs. They also do not warp and when player enters door too far from them, they will not enter with player. As far as I know all of this should work with latest Grumpy's companion template. So I would like to ask if there is some updated version of the mod, or if someone here has improved personal version he would be willing to share?


Thanks in advance ??
User avatar
josh evans
 
Posts: 3471
Joined: Mon Jun 04, 2007 1:37 am

Post » Wed Jun 29, 2016 1:25 pm

There is http://www.nexusmods.com/morrowind/mods/43999/?, but I didn't try it.

User avatar
Lizbeth Ruiz
 
Posts: 3358
Joined: Fri Aug 24, 2007 1:35 pm

Post » Wed Jun 29, 2016 11:28 pm


Ive never had the problem you're describing...are you sure the slaves you're trying to get to follow are from the mod/vanilla slaves, and that you don't have installed any other mods that modify slaves or the slave script? In my experience, non-vanilla slaves have problems unless compatibility is built into them (for example, the slaves added in Uvirith's Legacy, which later incorporated compatibility). Also, are you running the mod in OpenMW? It might not have been optimized for it.

User avatar
Michelle davies
 
Posts: 3509
Joined: Wed Sep 27, 2006 3:59 am

Post » Wed Jun 29, 2016 8:52 pm


It's because Fliggerty used Grumpy's Companion 3.1 script, which doesn't have a door check. If the player is running faster than the slaves can keep up and not checking before entering every door, they end up not close enough to come in with you. The problem isn't as bad as with the Improved Followers mod, which uses and even earlier version of Grumpy's follow scripting, but it's still not fixed. I use a doorfix variable in all my major companions, which I got from Melian's companion scripting.

User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Wed Jun 29, 2016 11:59 pm

Thank you all for responses!





The mod looks nice, but I do not like the fact that only 3 slaves can follow you at a time.





Vanilla slaves (from the first cave in Seyda Neen). No other mod that would interfere. No OpenMW. But they just don't warp.





I will have to check your scripts, since it is really getting annoying.

User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Wed Jun 29, 2016 12:27 pm

Okay, now I know the reason why warping did not work. For some reason my slaves often stay in combat mode after fight is over. And in combat mode warping is turned off. However I have no idea why they stay in combat mode. There was no fight for quite some time, yet the slave is next to me in combat stance, obviously equipping and deequipping dagger by the sound (this seems to be forced by the companion script, although I'm not sure why it is there). Save-load game does not help. The only way I was able to force him back to normal was by ordering him to stay and leaving the cell and then returning there.



EDIT:


It seems that the problem is somewhere here in the script:



if ( soundPlayed == 1 )
equip "silver dagger"
removeitem "silver dagger" 1
; messagebox "Working"
set soundPlayed to 0
set combatCheck to 0
set combatDone to 1
endif

if ( combatDone == 1 )
set timer to timer + GetSecondsPassed
if ( timer > 6 )
set timer to 0
set combatDone to 0
set warp to 0
endif
endif

since I can hear the equip/unequip sound, but slave stays in combat stance and warp is not 0 (tested with messagebox).



EDIT2:


Is there any particular reason why this



if ( combatCheck == 1 )
set sheathetimer to sheatheTimer + GetSecondsPassed
if ( GetSoundPlaying, "Weapon Swish" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, crossbowShoot == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, bowShoot == 1 )
set sheatheTimer to 0
return
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "Weapon Swish" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "crossbowShoot" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
elseif ( sheatheTimer > 4 )
if ( GetSoundPlaying "bowShoot" == 0 )
set sheatheTimer to 0
set soundPlayed to 1
endif
endif
endif
endif
endif

cannot be written as



if ( combatCheck == 1 )
set sheathetimer to sheatheTimer + GetSecondsPassed
if ( GetSoundPlaying, "Weapon Swish" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, crossbowShoot == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, bowShoot == 1 )
set sheatheTimer to 0
return
elseif ( sheatheTimer > 4 )
set sheatheTimer to 0
set soundPlayed to 1
endif
endif

???

User avatar
gemma
 
Posts: 3441
Joined: Tue Jul 25, 2006 7:10 am

Post » Wed Jun 29, 2016 6:44 pm

If that's in Addamasartus cave, there's a set of back caverns where a rat normally spawns. The slaves my be "in combat" with the rat they can't reach, and you can't see. If so, then you either need to open the gate behind the rocks in the room with the crates, and swim to one of the two back rooms, or else enter that back room via jumping to the opening in the rocks to the right of the slave cage (to the left if you're exiting the cage).



I also had numerous issues with spawned sea creatures (mainly slaughterfish) affecting followers, using Abot's Water Life. Essentially, odds are that the slaves are "in combat" with some sort of wildlife or vermin.



I had bigger issues with followers in general if I gave them ranged weapons (which I did to stop them from charging straight at something far more powerful than themselves and dying in one hit). As soon as an adversary was spotted, they'd inevitably shoot me in the back. Giving weapons to slaves is probably a bad idea just on principle, but other followers shouldn't be that annoying. Ultimately, I had to load them down with items and equipment so they'd run a lot slower than my character, rather than having them reaching the opponent first.

User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Thu Jun 30, 2016 1:02 am

Ummm no. I just meant the slaves are the ones from the cave. I left the cave long time ago. Right now I'm at Ra'Virr's shop in Balmora with one of the slaves and he is still in combat mode.



EDIT: And they actually have no weapons at all.

User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Wed Jun 29, 2016 10:55 pm

Any thoughts, anyone please? :)

User avatar
Phillip Brunyee
 
Posts: 3510
Joined: Tue Jul 31, 2007 7:43 pm

Post » Wed Jun 29, 2016 2:06 pm

IF you have the MCP "Equip command shows weapon" option enabled, try disabling it, it is incompatible with most companion sheathing fix code
None IMO
User avatar
D LOpez
 
Posts: 3434
Joined: Sat Aug 25, 2007 12:30 pm

Post » Wed Jun 29, 2016 11:44 pm

Thanks! Yes, I do have it installed. I will try to disable it and see if it fixes the problem.



EDIT: Uninstalling MCP "Equip command shows weapon" fixed the issue, thanks again!



I also tried to improve the script a bit. I shrinked the sound detection part i mentioned above and also added warping that should be compatible with Ultimate galleon. The script is here:




Spoiler


begin slaveScript

;Slave Status... each slave has a status as follows
;0 = Owned ( default state... does not indicate who they are owned by )
;1 = For Sale ( someone in the game can "sell" this slave via dialogue )
;2 = Owned By the Player ( the player has purchased this slave and the slave follows the player )
;3 = Freed ( the player has freed this slave, the slave eventually disables himself)
;4 = Freed but loyal to Player
;dead = not in slave status, but a state one should check for

short slaveStatus
short NoLore
short loyalty
short OnPCHitMe

float ax
float ay
float bx
float by
float bz
float cx
float cy
float cz
float t1
float t2
float t3
float t4
float coDist
float coDist2
float playz
float timer
float sheatheTimer
float moveTimer
float h_check
short doOnce
short doOnce2
short combatDone
short weapUse
short combatCheck
short soundPlayed
short flyCheck
short wwCheck
short oneTimeMove
short compMove
short c_move
short warp
short c_marksman
short c_speed
short c_athletics
short companion
short nohello
short counter
short addOnce
short p_Check


;doOnce stuff
if ( addOnce == 0 )
AddTopic "-- slave care"
AddTopic "-- slave combat"
AddTopic "-- slave follow"
AddTopic "-- slave commands"
StartScript fs_compLevel
set companion to 1
set addOnce to 1
endif

;slave status stuff
if ( slaveStatus == 0 )
if ( OnPCHitMe == 1 )
StartCombat player
ModPCCrimeLevel 500
set OnPCHitMe to 0
endif
set companion to 0
return
endif

if ( slaveStatus == 1 )
if ( OnPCHitMe == 1 )
StartCombat player
ModPCCrimeLevel 500
set OnPCHitMe to 0
endif
set companion to 0
return
endif

if ( slaveStatus == 2 )
set companion to 1
endif

if ( slaveStatus == 3 )
if ( GetCurrentAIPackage == 3 )
AIWander 512 0 0 0 0 0 0 0 0 0 0 0
endif
if ( GetItemCount Slave_Bracer_Left > 0 )
Drop Slave_Bracer_Left 1
endif
if ( GetItemCount Slave_Bracer_Right > 0 )
Drop Slave_Bracer_Right 1
endif
if ( CellChanged == 1 )
Disable
endif
set companion to 0
Return
endif

if ( slaveStatus == 4 )
set companion to 1
if ( GetItemCount Slave_Bracer_Left > 0 )
Drop Slave_Bracer_Left 1
endif
if ( GetItemCount Slave_Bracer_Right > 0 )
Drop Slave_Bracer_Right 1
endif
endif

;companion script
if ( MenuMode == 1 )
if ( GetPCSleep == 0 )
return
endif
endif

if ( weapUse == 1 )
if ( Player->GetWeaponType <= 8 )
setmarksman 0
elseif ( weapUse == 1 )
if ( Player->GetWeaponType >= 9 )
setmarksman 200
endif
endif
endif

if ( OnPCHitMe == 1 )
if ( GetDisposition < 10 )
if ( GetFight < 80 )
MessageBox "That's the last straw!"
SetFight 100
set OnPCHitMe to 0
AIWander 0 0 0 0
endif
else
if ( loyalty > 0 )
set loyalty to ( loyalty -1 )
endif
ModDisposition -5
set OnPCHitMe to 0
endif
endif

if ( combatCheck == 1 )
set sheathetimer to sheatheTimer + GetSecondsPassed
if ( GetSoundPlaying, "Weapon Swish" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, "crossbowShoot" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, "bowShoot" == 1 )
set sheatheTimer to 0
return
elseif ( sheatheTimer > 4 )
set sheatheTimer to 0
set soundPlayed to 1
endif
endif

if ( soundPlayed == 1 )
equip "silver dagger"
removeitem "silver dagger" 1
; messagebox "Working"
set soundPlayed to 0
set combatCheck to 0
set combatDone to 1
endif

if ( combatDone == 1 )
set timer to timer + GetSecondsPassed
if ( timer > 6 )
set timer to 0
set combatDone to 0
set warp to 0
endif
endif

if ( GetCurrentAIPackage == 3 )
if ( GetPCSleep == 1 )
StartScript fs_compLevel
endif

if ( GetPCSneaking == 1 )
ForceSneak
elseif ( GetPCSneaking == 0 )
ClearForceSneak
endif

if ( Player->GetEffect sEffectLevitate == 1 )
if ( flyCheck == 0 )
cast fs_comp2_lev_bog player
addspell fs_comp2_lev
set flyCheck to 1
endif
endif

if ( Player->GetEffect sEffectLevitate == 0 )
if ( flyCheck == 1 )
removespell fs_comp2_lev
set flyCheck to 0
endif
endif

if ( Player->GetEffect sEffectWaterWalking == 1 )
if ( wwCheck == 0 )
cast fs_comp2_ww_bog player
addspell fs_comp2_ww
set wwCheck to 1
endif
endif

if ( Player->GetEffect sEffectWaterWalking == 0 )
if ( wwCheck == 1 )
removespell fs_comp2_ww
set wwCheck to 0
endif
endif

if ( flyCheck == 1 )
if ( GetWeaponDrawn == 0 )
set playz to ( Player->GetPos z )
SetPos z playz
elseif ( flyCheck == 1 )
if ( GetCurrentAIPackage != 3 )
if ( GetWeaponDrawn == 0 )
set playz to ( GetPos z )
SetPos z playz
endif
endif
endif
endif

if ( GetWeaponDrawn == 1 )
if ( flyCheck == 0 )
set combatCheck to 1
set timer to 0
set warp to 1
return
elseif ( GetWeaponDrawn == 1 )
if ( flyCheck == 1 )
set combatDone to 1
set timer to 0
set warp to 1
return
endif
endif
endif

set ax to ( Player->GetPos x )
set ay to ( Player->GetPos y )

if ( doOnce == 0 )
set bx to ( Player->GetPos x )
set by to ( Player->GetPos y )
set bz to ( Player->GetPos z )
set doOnce to 1
endif

set 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 doOnce to 0
endif

if ( 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
endif
endif

set 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 0
endif

; if ( warp == 0 )
; if ( coDist > 350 )
; if ( GetDistance Player > 680 )
; SetPos x bx
; SetPos y by
; SetPos z bz
; AiFollow Player 0 0 0 0
; elseif ( warp == 0 )
; if ( coDist2 > 350 )
; if ( GetDistance Player > 680 )
; SetPos x cx
; SetPos y cy
; SetPos z cz
; AiFollow Player 0 0 0 0
; endif
; endif
; endif
; endif
; endif

; New warp, compatible with the Ultimate Galleon door
if ( warp == 0 )
if ( GetDistance player > 680 )
if ( coDist > 300 )
if ( coDist < 680 ) ; this prevents the "warping back" effect
SetPos X, bx
SetPos Y, by
SetPos Z, bz
AiFollow player 0 0 0 0
endif
elseif ( coDist2 > 300 )
if ( coDist2 < 680 ) ; this prevents the "warping back" effect
SetPos X, cx
SetPos Y, cy
SetPos Z, cz
AiFollow player 0 0 0 0
endif
endif
endif
endif

endif

;IF ADDITIONS ARE DESIRED, PLEASE ADD THEM BELOW HERE...

if ( GetCurrentAIPackage == 3 )
if ( compMove == 1 )
if ( c_move == 0 )
if ( GetDistance Player < 70 )
AIWander 300 0 0 0 0
set c_move to 1
endif
endif
endif
endif

if ( c_move == 1 )
if ( GetDistance Player > 100 )
AIFollow Player 0 0 0 0
set c_move to 0
endif
endif

if ( oneTimeMove == 1 )
set moveTimer to moveTimer + GetSecondsPassed
if ( moveTimer > 4 )
set moveTimer to 0
AiFollow Player 0 0 0 0
set oneTimeMove to 0
endif
endif

;AND ABOVE HERE.

;ADDITIONS CAN ALSO BE ADDED TO THIS FOLLOWING SECTION, BUT BEWARE OF THE COUNTER.
;Counter can pooch some functions if they need to be checked every frame.

if ( counter < 20 )
set counter to counter + 1
return
endif

set counter to 0

if ( GetCurrentAIPackage == 3 )
if ( GetDistance Player < 300 )
setSpeed 15
setAthletics 15
elseif ( GetDistance Player > 300 )
set c_speed to ( ( Player->GetSpeed ) * 2.25 )
set c_athletics to ( ( Player->GetAthletics ) * 2.25 )
setSpeed c_speed
setAthletics c_athletics
endif

if ( GetItemCount p_restore_health_b >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_c >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_e >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_q >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_s >= 1 )
set p_Check to 1
else
set p_Check to 0
endif
endif

if ( GetCurrentAIPackage != 3 )
setspeed 40
endif

;ADD ADDITIONAL TOPICS IN THIS SECTION IF REQUIRED.

end slaveScript




If anyone have any ideas on further fixes or improvements to the script, please let me know, as I will eventually incorporate the fixes to A Lord's Men companions.

User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Thu Jun 30, 2016 2:06 am



The modified script looks really nice to me. I was going to add the new warp section to a companion script that I've recently modified for my personal use, but then I realised it was already there and I remembered borrowing that portion of the code from Lothavor's Legacy.

User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Thu Jun 30, 2016 2:54 am

Thank you for your feedback, Erg!



I went ahead and did more tweaks to the script.


I simplified two or three if blocks that seemed to be overly complicated and substitued them with equivalent but better ones (marked with word SIMPLIFIED, for original refer to my previous post). I removed calculation of GetSquareRoot and instead used values powered by 2, as the command is pretty slow AFAIK. I also changed the warp check for coDistance to 350 instead of 300, as most other companions out there seem to use 350. I would have a question and that is whether I need to change the value also somewhere else besides the warp block?



Also the script uses GetPlayerDistance several times, so I think it would be better to compute it once and then use this value. Question is where to compute it. It seems that the value is used only in follow mode, so best place seems to be in the first block that checks if Current AI package is 3. Opinions?



Also I remember there was something about 34th variable not working. Was this meant as any 34th variable in script, or was it 34th short variable, 34th float variable, etc.? Since this script uses more than 34 variables.



Here is the script again:




Spoiler


begin slaveScript

;Slave Status... each slave has a status as follows
;0 = Owned ( default state... does not indicate who they are owned by )
;1 = For Sale ( someone in the game can "sell" this slave via dialogue )
;2 = Owned By the Player ( the player has purchased this slave and the slave follows the player )
;3 = Freed ( the player has freed this slave, the slave eventually disables himself)
;4 = Freed but loyal to Player
;dead = not in slave status, but a state one should check for

short slaveStatus
short NoLore
short loyalty
short OnPCHitMe

float ax
float ay
float bx
float by
float bz
float cx
float cy
float cz
float t1
float t2
float t3
float t4
float coDist
float coDist2
float playz
float timer
float sheatheTimer
float moveTimer
float h_check
short doOnce
short doOnce2
short combatDone
short weapUse
short combatCheck
short soundPlayed
short flyCheck
short wwCheck
short oneTimeMove
short compMove
short c_move
short warp
short c_marksman
short c_speed
short c_athletics
short companion
short nohello
short counter
short addOnce
short p_Check


;doOnce stuff
if ( addOnce == 0 )
AddTopic "-- slave care"
AddTopic "-- slave combat"
AddTopic "-- slave follow"
AddTopic "-- slave commands"
StartScript fs_compLevel
set companion to 1
set addOnce to 1
endif

;slave status stuff
if ( slaveStatus == 0 )
if ( OnPCHitMe == 1 )
StartCombat player
ModPCCrimeLevel 500
set OnPCHitMe to 0
endif
set companion to 0
return
endif

if ( slaveStatus == 1 )
if ( OnPCHitMe == 1 )
StartCombat player
ModPCCrimeLevel 500
set OnPCHitMe to 0
endif
set companion to 0
return
endif

if ( slaveStatus == 2 )
set companion to 1
endif

if ( slaveStatus == 3 )
if ( GetCurrentAIPackage == 3 )
AIWander 512 0 0 0 0 0 0 0 0 0 0 0
endif
if ( GetItemCount Slave_Bracer_Left > 0 )
Drop Slave_Bracer_Left 1
endif
if ( GetItemCount Slave_Bracer_Right > 0 )
Drop Slave_Bracer_Right 1
endif
if ( CellChanged == 1 )
Disable
endif
set companion to 0
Return
endif

if ( slaveStatus == 4 )
set companion to 1
if ( GetItemCount Slave_Bracer_Left > 0 )
Drop Slave_Bracer_Left 1
endif
if ( GetItemCount Slave_Bracer_Right > 0 )
Drop Slave_Bracer_Right 1
endif
endif

;companion script

;if we are in menu and player does not sleep, return
if ( MenuMode == 1 )
if ( GetPCSleep == 0 )
return
endif
endif

;block for fight settings "use weapon I use"
;sets marksman to 0 if player uses Melee weapon
;sets marksman to 200 if player uses Ranged weapon
;SIMPLIFIED
if ( weapUse == 1 )
if ( Player->GetWeaponType <= 8 )
setmarksman 0
elseif ( Player->GetWeaponType >= 9 )
setmarksman 200
endif
endif

;player hit this slave
;if disposition is too low, slave revolts
;otherwise lower disposition
if ( OnPCHitMe == 1 )
if ( GetDisposition < 10 )
if ( GetFight < 80 )
MessageBox "That's the last straw!"
SetFight 100
set OnPCHitMe to 0
AIWander 0 0 0 0
endif
else
if ( loyalty > 0 )
set loyalty to ( loyalty -1 )
endif
ModDisposition -5
set OnPCHitMe to 0
endif
endif

;combat check - some kind of test whether combat is over?
if ( combatCheck == 1 )
set sheathetimer to sheatheTimer + GetSecondsPassed
if ( GetSoundPlaying, "Weapon Swish" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, "crossbowShoot" == 1 )
set sheatheTimer to 0
return
elseif ( GetSoundPlaying, "bowShoot" == 1 )
set sheatheTimer to 0
return
elseif ( sheatheTimer > 4 )
set sheatheTimer to 0
set soundPlayed to 1
endif
endif

;again something with combat, no idea what exactly is it good for
if ( soundPlayed == 1 )
equip "silver dagger"
removeitem "silver dagger" 1
; messagebox "Working"
set soundPlayed to 0
set combatCheck to 0
set combatDone to 1
endif

;if combat is over, toggle warping
if ( combatDone == 1 )
set timer to timer + GetSecondsPassed
if ( timer > 6 )
set timer to 0
set combatDone to 0
set warp to 0
endif
endif

;if slave is in follow mode
if ( GetCurrentAIPackage == 3 )
;if player sleeps, adjust slave skill values
if ( GetPCSleep == 1 )
StartScript fs_compLevel
endif

;force sneak if player is sneaking
if ( GetPCSneaking == 1 )
ForceSneak
elseif ( GetPCSneaking == 0 )
ClearForceSneak
endif

;if player levitates, also levitate
if ( Player->GetEffect sEffectLevitate == 1 )
if ( flyCheck == 0 )
cast fs_comp2_lev_bog player
addspell fs_comp2_lev
set flyCheck to 1
endif
endif

;levitation stop
if ( Player->GetEffect sEffectLevitate == 0 )
if ( flyCheck == 1 )
removespell fs_comp2_lev
set flyCheck to 0
endif
endif

;if player water walks, also water walk
if ( Player->GetEffect sEffectWaterWalking == 1 )
if ( wwCheck == 0 )
cast fs_comp2_ww_bog player
addspell fs_comp2_ww
set wwCheck to 1
endif
endif

;water walk stop
if ( Player->GetEffect sEffectWaterWalking == 0 )
if ( wwCheck == 1 )
removespell fs_comp2_ww
set wwCheck to 0
endif
endif

;SIMPLIFIED, adjusts z position according to player in levitate mode
if ( flyCheck == 1 )
if ( GetWeaponDrawn == 0 )
set playz to ( Player->GetPos z )
SetPos z playz
endif
endif

;SIMPLIFIED, fight start
if ( GetWeaponDrawn == 1 )
set combatCheck to 1
set timer to 0
set warp to 1
return
endif

set ax to ( Player->GetPos x )
set ay to ( Player->GetPos y )

if ( doOnce == 0 )
set bx to ( Player->GetPos x )
set by to ( Player->GetPos y )
set bz to ( Player->GetPos z )
set doOnce to 1
endif

set 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 t1

if ( coDist > 129600 ) ;360*360 to avoid using GetSquareRoot
set doOnce to 0
endif

if ( coDist > 32400 ) ;180*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
endif
endif

set 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 t3

if ( coDist2 > 129600 ) ;360*360
set doOnce2 to 0
endif

; New warp, compatible with the Ultimate Galleon door
if ( warp == 0 )
if ( GetDistance player > 680 )
if ( coDist > 122500 ) ;350*350
if ( coDist < 462400 ) ;680*680,this prevents the "warping back" effect
SetPos X, bx
SetPos Y, by
SetPos Z, bz
AiFollow player 0 0 0 0
endif
elseif ( coDist2 > 122500 ) ;350*350
if ( coDist2 < 462400 ) ;680*680,this prevents the "warping back" effect
SetPos X, cx
SetPos Y, cy
SetPos Z, cz
AiFollow player 0 0 0 0
endif
endif
endif
endif

endif

;IF ADDITIONS ARE DESIRED, PLEASE ADD THEM BELOW HERE...

if ( GetCurrentAIPackage == 3 )
if ( compMove == 1 )
if ( c_move == 0 )
if ( GetDistance Player < 70 )
AIWander 300 0 0 0 0
set c_move to 1
endif
endif
endif
endif

if ( c_move == 1 )
if ( GetDistance Player > 100 )
AIFollow Player 0 0 0 0
set c_move to 0
endif
endif

if ( oneTimeMove == 1 )
set moveTimer to moveTimer + GetSecondsPassed
if ( moveTimer > 4 )
set moveTimer to 0
AiFollow Player 0 0 0 0
set oneTimeMove to 0
endif
endif

;AND ABOVE HERE.

;ADDITIONS CAN ALSO BE ADDED TO THIS FOLLOWING SECTION, BUT BEWARE OF THE COUNTER.
;Counter can pooch some functions if they need to be checked every frame.

if ( counter < 20 )
set counter to counter + 1
return
endif

set counter to 0

if ( GetCurrentAIPackage == 3 )
if ( GetDistance Player < 300 )
setSpeed 15
setAthletics 15
elseif ( GetDistance Player > 300 )
set c_speed to ( ( Player->GetSpeed ) * 2.25 )
set c_athletics to ( ( Player->GetAthletics ) * 2.25 )
setSpeed c_speed
setAthletics c_athletics
endif

if ( GetItemCount p_restore_health_b >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_c >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_e >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_q >= 1 )
set p_Check to 1
elseif ( GetItemCount p_restore_health_s >= 1 )
set p_Check to 1
else
set p_Check to 0
endif
endif

if ( GetCurrentAIPackage != 3 )
setspeed 40
endif

;ADD ADDITIONAL TOPICS IN THIS SECTION IF REQUIRED.

end slaveScript




EDIT:


Note that I simplified this



if ( flyCheck == 1 )
if ( GetWeaponDrawn == 0 )
set playz to ( Player->GetPos z )
SetPos z playz
elseif ( flyCheck == 1 )
if ( GetCurrentAIPackage != 3 )
if ( GetWeaponDrawn == 0 )
set playz to ( GetPos z )
SetPos z playz
endif
endif
endif
endif

into this



if ( flyCheck == 1 )
if ( GetWeaponDrawn == 0 )
set playz to ( Player->GetPos z )
SetPos z playz
endif
endif

My simplified version does not do the assignment to playz variable. The second command is not important, since it just assigns slave z position it just detected. But in original script, this part of code was actually never executed, since the order of conditions to actually reach this part of code would be:


GetWeaponDrawn != 0 AND flyCheck == 1 AND GetCurrentAIPackage != 3 AND GetWeaponDrawn == 0, which of course is never true.

User avatar
Laura Elizabeth
 
Posts: 3454
Joined: Wed Oct 11, 2006 7:34 pm


Return to III - Morrowind