
[Résolu] Aide script : ajout de capacité lors d'équipement d'un objet
Re: Aide script
J'aurais encore besoin d'aide
je suis entrain de traduire un mod (Il ne me reste plus cas sauvegarder les scripts dans le construction set) mais un des scripts indique deux problèmes à la même ligne mais je ne voit pas quoi.
et

► Afficher le texte
► Afficher le texte
Code : Tout sélectionner
scn zzzUNUSEDSpawnZombiesScript
ref caster
ref target
ref this
short count
short temp
short HordeSize
begin ScriptEffectFinish
; Fetch the horde size from the nearest city's horde population
if (zzQuest.NearestCity <= 1)
set HordeSize to zzQuest.HordeAnvil
elseif (zzQuest.NearestCity <= 2)
set HordeSize to zzQuest.HordeBravil
elseif (zzQuest.NearestCity <= 3)
set HordeSize to zzQuest.HordeBruma
elseif (zzQuest.NearestCity <= 4)
set HordeSize to zzQuest.HordeCheydinhal
elseif (zzQuest.NearestCity <= 5)
set HordeSize to zzQuest.HordeChorrol
elseif (zzQuest.NearestCity <= 6)
set HordeSize to zzQuest.HordeLeyawiin
elseif (zzQuest.NearestCity <= 7)
set HordeSize to zzQuest.HordeSkingrad
else
set HordeSize to zzQuest.HordeCity
endif
PrintToConsole "Start population for city %.0f is %.0f", zzQuest.NearestCity, HordeSize
; Calculate the number of zombies we should try and spawn
set count to ((HordeSize / zzQuest.SpawnFraction) - zzQuest.ZombiesInArea)
PrintToConsole "Attempting to spawn %.0f zombie(s)", count
if (count > (zzQuest.SpawnMax - zzQuest.ZombiesInArea))
PrintToConsole "%.0f zombie(s) is above (%.0f), trimmed excess.", count, zzQuest.SpawnMax
set count to (zzQuest.SpawnMax - zzQuest.ZombiesInArea)
elseif (count < 0)
set count to 0
endif
; Remove the number of deployed zombies from the horde
set HordeSize to HordeSize - count
; First try deploy the zombies via nearby doors
set this to GetFirstRef 24 1
this.PlayMagicShaderVisuals effectAtronachStorm
set caster to zzZombieCastRef
set target to zzTargetRef
SaveIP 1
if (this && count > 0)
set temp to temp + 1
PrintToConsole "temp = %.0f", temp
; Only let zombies through unlocked perimeter doors
;if (this.IsLoadDoor == 1 && this.GetLocked == 0)
; Finally, randomise chance of it happening
if ((GetRandomPercent + 1) < zzQuest.SpawnChance)
; Zombies happen
caster.moveto this
caster.cast zzTestCreateZombieSpell this
set this to GetNextRef
set count to count - 1
this.PlayMagicShaderVisuals effectAtronachFrost ; DEBUG
endif
;endif
RestoreIP 1
endif
this.StopMagicShaderVisuals effectAtronachFrost
this.PlayMagicShaderVisuals effectAtronachFlame ; DEBUG
message "%.0f zombie (s) n'a pas pu être engendré", count
PrintToConsole "%.0f zombie(s) couldn't be spawned", count
; Update the zombie populations
set HordeSize to HordeSize + count
if (zzQuest.NearestCity <= 1)
set zzQuest.HordeAnvil to HordeSize
elseif (zzQuest.NearestCity <= 2)
set zzQuest.HordeBravil to HordeSize
elseif (zzQuest.NearestCity <= 3)
set zzQuest.HordeBruma to HordeSize
elseif (zzQuest.NearestCity <= 4)
set zzQuest.HordeCheydinhal to HordeSize
elseif (zzQuest.NearestCity <= 5)
set zzQuest.HordeChorrol to HordeSize
elseif (zzQuest.NearestCity <= 6)
set zzQuest.HordeLeyawiin to HordeSize
elseif (zzQuest.NearestCity <= 7)
set zzQuest.HordeSkingrad to HordeSize
else
set zzQuest.HordeCity to HordeSize
endif
PrintToConsole "New population for city %.0f is %.0f", zzQuest.NearestCity, HordeSize
; Now we're finished with it reset anything that needs to be reset
set zzQuest.ZombiesInArea to 0
end
Le savoir est une arme.