Aller au contenu


Télékinésie Offensive


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1 SpiritusRector

SpiritusRector

Posté 26 novembre 2010 - 17:12

Bonjour à tous,

Je souhaiterais faire en sorte que la télékinésie puisse être offensive dans oblivion;
je ne parle pas ici de PushActorAway mais bien de bouqins volants faisants des dégâts lorsqu'ils percuttent la tronche des pnjs.

Je ne viens pas les mains vides, je possède déjà un script (en fait deux) assez longs pour ce qui est recherché...mais bon (inutile de préciser qu'ils ne sont pas de moi...)

Mon problème est extrêmement simple pour toute personne habitué à gérer du script:
rajouter une référence player et le différencier de actor dans le script qui va suivre pour éviter que le bouquin ne m'éclate la geule des qu'il est trop près de mon perso...(autobuté par sa propre télékinésie ça fait minable...)

scn CMTelekinesisDamageSpellScript

ref actor ; the actor being hit

float Vmodified ; the velocity variable being modified

long Wmodified ; the weight variable being modified

Begin ScriptEffectStart

Set actor to GetSelf

Set Vmodified to CMVelocity * -1 ; makes velocity negative

Set Vmodified to Vmodified / 5 ; divides the velocity by 5, change this to increase or decrease damage

Set Wmodified to CMWeight / 8 ; divides the weight of the object by 8, change this to increase or decease damage

Set Vmodified to Vmodified - Wmodified ; adds modified velocity with modified weight to make the final damage

if CMObjType == 33

set Vmodified to Vmodified - 3

elseif CMObjType == 34

set Vmodified to Vmodified - 2

elseif CMObjType == 20

set Vmodified to Vmodified - 1

elseif CMObjType == 26 ; for the torch

set Vmodified to Vmodified - 3

elseif CMObjType == 22

set Vmodified to Vmodified + 3

elseif CMObjType == 25

set Vmodified to Vmodified + 1

endif

actor.modav2 health Vmodified ; removes health from actor, change "health" to another actor value to give a different effect to the object

if Vmodified < -5 ; if damage is more than 5 then knock down actor, decrease -5 to make the knock down less often, increase -5 to make the damage more often (0 will be all the time)

Player.PushActorAway actor, 10 ; knock down actor, decrease 10 to make knock down more subtle, increase 10 to make actor fly back further (100 is max)

endif

[/b][/size]

Si toutefois ce thème à déjà été abordé je m'en excuse et je vous pris de me faire savoir où est le topic...

Merci d'avance pour vos réponses et idées...

Modifié par SpiritusRector, 26 novembre 2010 - 17:13.

Audaces Fortuna Juvat...

#2 Shadow she-wolf

Shadow she-wolf

    Le katana de la GBT


Posté 26 novembre 2010 - 19:34

Coucou...


J'ai un petit peu de mal à comprendre où tu veux en venir avec ce script...
Mais si le but est de simplement empêcher que le PJ se prenne des dégâts, c'est assez simple.

scn CMTelekinesisDamageSpellScript

float Vmodified ; the velocity variable being modified
long Wmodified ; the weight variable being modified

Begin ScriptEffectStart

if ( GetSelf == Player )
   return
endif

Set Vmodified to CMVelocity * -1 ; makes velocity negative
Set Vmodified to Vmodified / 5 ; divides the velocity by 5, change this to increase or decrease damage
Set Wmodified to CMWeight / 8 ; divides the weight of the object by 8, change this to increase or decease damage
Set Vmodified to Vmodified - Wmodified ; adds modified velocity with modified weight to make the final damage

if CMObjType == 33
   set Vmodified to Vmodified - 3
elseif CMObjType == 34
   set Vmodified to Vmodified - 2
elseif CMObjType == 20
   set Vmodified to Vmodified - 1
elseif CMObjType == 26 ; for the torch
   set Vmodified to Vmodified - 3
elseif CMObjType == 22
   set Vmodified to Vmodified + 3
elseif CMObjType == 25
   set Vmodified to Vmodified + 1
endif

modav2 health Vmodified ; removes health from actor, change "health" to another actor value to give a different effect to the object
if Vmodified < -5 ; if damage is more than 5 then knock down actor, decrease -5 to make the knock down less often, increase -5 to make the damage more often (0 will be all the time)
   Player.PushActorAway actor, 10 ; knock down actor, decrease 10 to make knock down more subtle, increase 10 to make actor fly back further (100 is max)
endif

End

J'ai simplement ajouté:
if ( GetSelf == Player )
   return
endif
Au tout début du script. En gros on regarde si la cible est le joueur, si oui, on fait "return", c'est à dire que le script reboucle. Le bloc ScriptEffectStart ne se jouant qu'une unique fois lorsque l'effet est ajouté à l'acteur, il ne sera pas rejoué.
On utilise généralement la fonction "return" pour empêcher le moteur du jeu à lire des pans entier de scripts.

En plus de cela, j'ai supprimé la variable "actor", qui ne servait strictement à rien ici...
Un effet de script est automatique appliqué à l'acteur sous l'effet de cet effet de script. On a donc pas besoin de le préciser.

#3 SpiritusRector

SpiritusRector

Posté 26 novembre 2010 - 20:14

Bonjour Shadow, Merci pour le coup de main et les explications fortes utiles... <BR><BR>Voici le script utilisé pour les paramètre du sort de TK offensive et il renvoie au 1er script que je t'ai montré pour le calcul des dégâts...Mais sérieux il existe pas un moyen de faire un peu plus simple
[size="2"]scn CMDamageTelekinesisSpellScript

ref obj ; the object

ref self ; a possible actor that is the actor

float Pos01x ; starting position along x axis

float Pos01y ; starting position along y axis

float Pos01z ; starting position along z axis

float Pos02x ; second position along x axis

float Pos02y ; second position along y axis

float Pos02z ; second position along z axis

float Difx ; difference between both positions along x axis

float Dify ; difference between both positions along y axis

float Difz ; difference between both positions along z axis

short PosCount ; variable to catch starting position and then second position

long MagickaDiff ; amount of magicka the player needs to gain to cast the spell successfully

long NegWeight ; negative of the weight of the object x2

long Weight ; the weight of the object x2

short DontRun ; variable to stop the damage casting

short Castonce

short LooseOnce

Begin ScriptEffectStart

Set DontRun to 0 ;Resests script crucial variables

Set LooseOnce to 0

Set Obj to 0

Set obj to GetCrosshairRef

if obj && obj.IsActor != 1

Set CMObjType to Obj.GetObjectType

Player.AddSpell CMTelekinesisSpell

SelectPlayerSpell CMTelekinesisSpell

TapControl 7

SelectPlayerSpell CMDamageTelekinesisSpell2

Set CMWeight to Obj.GetWeight ; The weight of the object

Set Weight to CMWeight * 2 ; Weight of the object times two, change this to change the magicka cost of the spell

if Weight > Player.GetAV Magicka ; if weight of the object is greater than player's magicka, the player does not have enough magicka

Set MagickaDiff to Weight - Player.GetAV Magicka ; the amount of magicka the player needs to have more of to cast the spell successfully

Message "You need %.0f more magicka to cause damage with this object." MagickaDiff

set DontRun to 1

set LooseOnce to 1

else

if LooseOnce == 0

Set NegWeight to Weight * -1 ; Negative of the weight of the object x2

Player.ModAV2 Magicka NegWeight ; removes magicka from the player equal to the weight of the object x2

set LooseOnce to 1

endif

endif

else

Set DontRun to 1

endif

End

Begin ScriptEffectUpdate

if Player.HasMagicEffect TELE != 1

Set DontRun to 1 ; damage disabled

if CastOnce == 0 && Obj.IsActor != 1

Obj.Cast CMDeathtrapSpell Obj

Set CastOnce to 1

endif

endif

if DontRun == 0 ; the following finds the velocity of the object

if PosCount == 0 ; set starting positions

Set Pos01x to GetPos x

Set Pos01y to GetPos y

Set Pos01z to GetPos z

Set PosCount to 1

return

elseif PosCount == 1 ; set second positions

Set Pos02x to GetPos x

Set Pos02y to GetPos y

Set Pos02z to GetPos z

if Pos01x < 0 ; makes variable positive

Set Pos01x to Pos01x * -1

endif

if Pos02x < 0

Set Pos02x to Pos02x * -1

endif

if Pos01y < 0

Set Pos01y to Pos01y * -1

endif

if Pos02y < 0

Set Pos02y to Pos02y * -1

endif

if Pos01z < 0

Set Pos01z to Pos01z * -1

endif

if Pos02z < 0

Set Pos02z to Pos02z * -1

endif

if Pos01x > Pos02x

set Difx to Pos01x - Pos02x ; finds difference of two positions

elseif Pos02x > Pos01x

set Difx to Pos02x - Pos01x

endif

if Pos01y > Pos02y

set Dify to Pos01y - Pos02y

elseif Pos02y > Pos01y

set Dify to Pos02y - Pos01y

endif

if Pos01z > Pos02z

set Difz to Pos01z - Pos02z

elseif Pos02z > Pos01z

set Difz to Pos02z - Pos01z

endif

Set CMVelocity to Difx + Dify + Difz ; sets the velocity to the sum of the differences of positions along all axies, a positve number 

Set PosCount to 0 ; reset velocity finder

obj.cast CMTelekinesisDamage obj

endif

endif

End

[/size]


Merci à tous ceux qui tenteront de m'aider...

Modifié par SpiritusRector, 26 novembre 2010 - 21:38.

Audaces Fortuna Juvat...

#4 Shadow she-wolf

Shadow she-wolf

    Le katana de la GBT


Posté 26 novembre 2010 - 22:48

Voir le messageSpiritusRector, le 26 novembre 2010 - 20:14, dit :

Mais sérieux il existe pas un moyen de faire un peu plus simple
Pour quoi faire ?

Si j'ai bien compris, tu semblais vouloir modifier une GMST qui affecte la vitesse de déplacement des objets...télékinésiés...

Manifestement les scripts que tu proposes utilisent OBSE, donc...il y a une fonction OBSE pour modifier la valeur d'une GMST: SetNumericGameSetting.

Il suffit de mettre la valeur souhaitée au tout début de l'application du sort, et de la réinitialiser à la fin du sort.

#5 SpiritusRector

SpiritusRector

Posté 26 novembre 2010 - 23:23

En fait ces deux codes permettent de faire de la TK offensive en s'ajoutant au sort de TK pour que les objets deviennent offensif un fois télékinésiés.
Le plus long (le dernier posté) est le script du sort mais fait appel au second (le premier posté) pour fonctionner(il me semble que celui-ci gère les dégats)...
Désolé je n'ai pas été trés clair dès le début...

(L'info GS c'est un plus pour le sort que je veus créer... donc merci)

Le mod duquel proviennent ces script est le suivant: http://www.tesnexus....le.php?id=22957
Je peut pas ëtre plus précis...


Audaces Fortuna Juvat...




0 utilisateur(s) li(sen)t ce sujet

0 membre(s), 0 invité(s), 0 utilisateur(s) anonyme(s)