From l'Ogrim le plus intelligent de l'univers (Oblivion compris) (avec un peu de bol il l'a tjs en préparé... en tout cas je peux te certifier que ca marche sur tte cell prévue par le script
)
Script de téléportation d'une cell extérieure à une cell intérieure et ce quelque soit la position en extérieure et retour.
Fonctionne des cells Y-30 à 30 et X-30 à 30, peut-être étendu audelà jusqu'à +/-999 position de cellule en Y.
Attention
nécessite Tribunal pour le déplacement du joueur.
Sur un activator, apparait quand on drop un "misc item" tente.
Begin _EntreTente
short button
short messageOn
if (MenuMode == 1)
return
endif
if ( OnActivate == 1 )
MessageBox "Replier la tente ou entrer ?" "Replier" "Entrer" "Annuler"
set messageOn to 1
endif
If ( messageOn == 1)
set button to GetButtonPressed
if ( button >= 0 )
set messageOn to 0
endif
if ( button == 0 )
Player->AddItem "_La tente" 1
Disable
SetDelete 1
endif
if ( button == 1 )
Activate
set Playerxpos to ( Player->GetPos x )
set Playerypos to ( Player->GetPos y )
set Playerzpos to ( Player->GetPos z )
set Playerzrot to ( Player->GetAngle z )
if ( Playerxpos < 0 )
set CellX to ( ( Playerxpos / 8192 ) - 1 )
else
set CellX to ( Playerxpos / 8192 )
endif
if ( Playerypos < 0 )
set CellY to ( ( Playerypos / 8192 ) - 1 )
else
set CellY to ( Playerypos / 8192 )
endif
;MessageBox "CELLULE X : %g", CellX
;MessageBox "CELLULE Y : %g", CellY
Player->PositionCell 4096, 4096, 14834, 0, "Balmora, temple"
endif
if ( button == 2 )
return
endif
endif
End _EntreTente
Quand on sort de la tente :
Begin _SortieTente
if (MenuMode == 1)
return
endif
if ( OnActivate == 1 )
Activate
if ( CellY == -30 )
startscript "_CelluleY-030"
endif
if ( CellY == -29 )
startscript "_CelluleY-029"
endif
if ( CellY == -28 )
startscript "_CelluleY-028"
endif
if ( CellY == -27 )
startscript "_CelluleY-027"
endif
if ( CellY == -26 )
startscript "_CelluleY-026"
endif
if ( CellY == -25 )
startscript "_CelluleY-025"
endif
if ( CellY == -24 )
startscript "_CelluleY-024"
endif
if ( CellY == -23 )
startscript "_CelluleY-023"
endif
if ( CellY == -22 )
startscript "_CelluleY-022"
endif
if ( CellY == -21 )
startscript "_CelluleY-021"
endif
if ( CellY == -20 )
startscript "_CelluleY-020"
endif
if ( CellY == -19 )
startscript "_CelluleY-019"
endif
if ( CellY == -18 )
startscript "_CelluleY-018"
endif
if ( CellY == -17 )
startscript "_CelluleY-017"
endif
if ( CellY == -16 )
startscript "_CelluleY-016"
endif
if ( CellY == -15 )
startscript "_CelluleY-015"
endif
if ( CellY == -14 )
startscript "_CelluleY-014"
endif
if ( CellY == -13 )
startscript "_CelluleY-013"
endif
if ( CellY == -12 )
startscript "_CelluleY-012"
endif
if ( CellY == -11 )
startscript "_CelluleY-011"
endif
if ( CellY == -10 )
startscript "_CelluleY-010"
endif
if ( CellY == -9 )
startscript "_CelluleY-009"
endif
if ( CellY == -8 )
startscript "_CelluleY-008"
endif
if ( CellY == -7 )
startscript "_CelluleY-007"
endif
if ( CellY == -6 )
startscript "_CelluleY-006"
endif
if ( CellY == -5 )
startscript "_CelluleY-005"
endif
if ( CellY == -4 )
startscript "_CelluleY-004"
endif
if ( CellY == -3 )
startscript "_CelluleY-003"
endif
if ( CellY == -2 )
startscript "_CelluleY-002"
endif
if ( CellY == -1 )
startscript "_CelluleY-001"
endif
if ( CellY == 0 )
startscript "_CelluleY000"
endif
if ( CellY == 1 )
startscript "_CelluleY001"
endif
if ( CellY == 2 )
startscript "_CelluleY002"
endif
if ( CellY == 3 )
startscript "_CelluleY003"
endif
if ( CellY == 4 )
startscript "_CelluleY004"
endif
if ( CellY == 5 )
startscript "_CelluleY005"
endif
if ( CellY == 6 )
startscript "_CelluleY006"
endif
if ( CellY == 7 )
startscript "_CelluleY007"
endif
if ( CellY == 8 )
startscript "_CelluleY008"
endif
if ( CellY == 9 )
startscript "_CelluleY009"
endif
if ( CellY == 10 )
startscript "_CelluleY010"
endif
if ( CellY == 11 )
startscript "_CelluleY011"
endif
if ( CellY == 12 )
startscript "_CelluleY012"
endif
if ( CellY == 13 )
startscript "_CelluleY013"
endif
if ( CellY == 14 )
startscript "_CelluleY014"
endif
if ( CellY == 15 )
startscript "_CelluleY015"
endif
if ( CellY == 16 )
startscript "_CelluleY016"
endif
if ( CellY == 17 )
startscript "_CelluleY017"
endif
if ( CellY == 18 )
startscript "_CelluleY018"
endif
if ( CellY == 19 )
startscript "_CelluleY019"
endif
if ( CellY == 20 )
startscript "_CelluleY020"
endif
if ( CellY == 21 )
startscript "_CelluleY021"
endif
if ( CellY == 22 )
startscript "_CelluleY022"
endif
if ( CellY == 23 )
startscript "_CelluleY023"
endif
if ( CellY == 24 )
startscript "_CelluleY024"
endif
if ( CellY == 25 )
startscript "_CelluleY025"
endif
if ( CellY == 26 )
startscript "_CelluleY026"
endif
if ( CellY == 27 )
startscript "_CelluleY027"
endif
if ( CellY == 28 )
startscript "_CelluleY028"
endif
if ( CellY == 29 )
startscript "_CelluleY029"
endif
if ( CellY == 30 )
startscript "_CelluleY030"
endif
endif
End _SortieTente
Le misc item tente replié dans l'inventaire.
Begin _TenteInventaire
short DoOnce
If ( Player->GetItemCount "_La tente" ) == 0
if ( DoOnce == 0 )
PlaceAtPC "_ActiTente" 1 256 0
Disable
set DoOnce to 1
endif
endif
End _TenteInventaire
Et un des scripts de téléportation, il y en a 61, un par position Y.
Begin _CelluleY000
float posx
float posy
float posz
float rotz
Set posx to Playerxpos
Set posy to Playerypos
Set posz to Playerzpos
Set rotz to Playerzrot
If ( CellX == -30 )
Player->Position -241664 4096 0 0
Endif
If ( CellX == -29 )
Player->Position -233472 4096 0 0
Endif
If ( CellX == -28 )
Player->Position -225280 4096 0 0
Endif
If ( CellX == -27 )
Player->Position -217088 4096 0 0
Endif
If ( CellX == -26 )
Player->Position -208896 4096 0 0
Endif
If ( CellX == -25 )
Player->Position -200704 4096 0 0
Endif
If ( CellX == -24 )
Player->Position -192512 4096 0 0
Endif
If ( CellX == -23 )
Player->Position -184320 4096 0 0
Endif
If ( CellX == -22 )
Player->Position -176128 4096 0 0
Endif
If ( CellX == -21 )
Player->Position -167936 4096 0 0
Endif
If ( CellX == -20 )
Player->Position -159744 4096 0 0
Endif
If ( CellX == -19 )
Player->Position -151552 4096 0 0
Endif
If ( CellX == -18 )
Player->Position -143360 4096 0 0
Endif
If ( CellX == -17 )
Player->Position -135168 4096 0 0
Endif
If ( CellX == -16 )
Player->Position -126976 4096 0 0
Endif
If ( CellX == -15 )
Player->Position -118784 4096 0 0
Endif
If ( CellX == -14 )
Player->Position -110592 4096 0 0
Endif
If ( CellX == -13 )
Player->Position -102400 4096 0 0
Endif
If ( CellX == -12 )
Player->Position -94208 4096 0 0
Endif
If ( CellX == -11 )
Player->Position -86016 4096 0 0
Endif
If ( CellX == -10 )
Player->Position -77824 4096 0 0
Endif
If ( CellX == -9 )
Player->Position -69632 4096 0 0
Endif
If ( CellX == -8 )
Player->Position -61440 4096 0 0
Endif
If ( CellX == -7 )
Player->Position -53248 4096 0 0
Endif
If ( CellX == -6 )
Player->Position -45056 4096 0 0
Endif
If ( CellX == -5 )
Player->Position -36864 4096 0 0
Endif
If ( CellX == -4 )
Player->Position -28672 4096 0 0
Endif
If ( CellX == -3 )
Player->Position -20480 4096 0 0
Endif
If ( CellX == -2 )
Player->Position -12288 4096 0 0
Endif
If ( CellX == -1 )
Player->Position -4096 4096 0 0
Endif
If ( CellX == 0 )
Player->Position 4096 4096 0 0
Endif
If ( CellX == 1 )
Player->Position 12288 4096 0 0
Endif
If ( CellX == 2 )
Player->Position 20480 4096 0 0
Endif
If ( CellX == 3 )
Player->Position 28672 4096 0 0
Endif
If ( CellX == 4 )
Player->Position 36864 4096 0 0
Endif
If ( CellX == 5 )
Player->Position 45056 4096 0 0
Endif
If ( CellX == 6 )
Player->Position 53248 4096 0 0
Endif
If ( CellX == 7 )
Player->Position 61440 4096 0 0
Endif
If ( CellX == 8 )
Player->Position 69632 4096 0 0
Endif
If ( CellX == 9 )
Player->Position 77824 4096 0 0
Endif
If ( CellX == 10 )
Player->Position 86016 4096 0 0
Endif
If ( CellX == 11 )
Player->Position 94208 4096 0 0
Endif
If ( CellX == 12 )
Player->Position 102400 4096 0 0
Endif
If ( CellX == 13 )
Player->Position 110592 4096 0 0
Endif
If ( CellX == 14 )
Player->Position 118784 4096 0 0
Endif
If ( CellX == 15 )
Player->Position 126976 4096 0 0
Endif
If ( CellX == 16 )
Player->Position 135168 4096 0 0
Endif
If ( CellX == 17 )
Player->Position 143360 4096 0 0
Endif
If ( CellX == 18 )
Player->Position 151552 4096 0 0
Endif
If ( CellX == 19 )
Player->Position 159744 4096 0 0
Endif
If ( CellX == 20 )
Player->Position 167936 4096 0 0
Endif
If ( CellX == 21 )
Player->Position 176128 4096 0 0
Endif
If ( CellX == 22 )
Player->Position 184320 4096 0 0
Endif
If ( CellX == 23 )
Player->Position 192512 4096 0 0
Endif
If ( CellX == 24 )
Player->Position 200704 4096 0 0
Endif
If ( CellX == 25 )
Player->Position 208896 4096 0 0
Endif
If ( CellX == 26 )
Player->Position 217088 4096 0 0
Endif
If ( CellX == 27 )
Player->Position 225280 4096 0 0
Endif
If ( CellX == 28 )
Player->Position 233472 4096 0 0
Endif
If ( CellX == 29 )
Player->Position 241664 4096 0 0
Endif
If ( CellX == 30 )
Player->Position 249856 4096 0 0
Endif
Player->SetPos x posx
Player->SetPos y posy
Player->SetPos z posz
Player->SetAngle z rotz
StopScript "_CelluleY000"
End _CelluleY000
Je vous rassure de suite les scripts de téléportation suivant la cellule, je les ait fait par programme et recopié dans l'esp.
C'est cette partie du premier script qui calcul les coordonnées X et Y de la cell.
if ( Playerxpos < 0 )
set CellX to ( ( Playerxpos / 8192 ) - 1 )
else
set CellX to ( Playerxpos / 8192 )
endif
if ( Playerypos < 0 )
set CellY to ( ( Playerypos / 8192 ) - 1 )
else
set CellY to ( Playerypos / 8192 )
endif
Gilbertus appréciera.
CellX, CellY, Playerxpos, Playerypos, Playerzpos et Playerrotz sont des variables globales.