Полная Версия: Скрипты
Gekko
Хм...Здрасте, Данмеры, Хаджиты, Имперцы и прочие жители Ввандерфелла.

Этот топик я создаю для того, чтобы мы облегчили сами себе создание модов, так или иначе, касающихся скриптов. Многие из нас не умеют писать скрипты, но хотят делать плагины, призываю им помочь!
Я предлагаю, обмениваться здесь своими скриптами, а в конце подвести итог - кто больше...(В одном сообщени один скрипт, желательно с описаниями что и как)
Так и быть, начну я. И начну с простенького...


Отправлено: [mergetime]1090469648[/mergetime]
Небольшой скрипт из моего еще не вышедшего плагина "Светлая земля".

Begin "имя скрипта"(без ковычек)

short controlvar; объявляем переменную controlvar

If(OnActivate == 1); проверка условия - "если активируем"
If(controlvar == 0); проверка условия "если переменная не затронута"

Player -> addspell, ID спела; добавляем спел персонажу

MessageBox "Ваш текст"; выводим на экран сообщение
Set controlvar to 1; устанавливаем переменную на 1

Endif; конец первого условия
Ebdif; конец второго условия

End; конец скрипта

Как вы уже, наверное поняли, мой скрипт добавляет персонажу определенный магический атрибут и выводит сообщение. Например:
Вы прикасаетесь к мечу - вам добавляется спел( у меня это была характеристика) и на экран выводится сообщение (Вы получили благословление).
Infernal knight
Мдя... действительно, не самый сложный скрипт...
Значит так - контр-предложение: все подряд скрипты сюда постить не стоит, а стоит постить именно ИНТЕРЕСНЫЕ скрипты, т.е. скрипты, которые привносят что-то действительно интересное, новое, что может пригодиться в создании интересных модов. Скрипты желательно должны быть действительно уникальны и иметь какую-то идею в своем основании... а простые скрипты пусть придумывают сами, основы скриптмастерства есть в руководстве Ган Бури Гана по скриптам для ламеров, которое перевел Aidan4
Итак, мой скрипт, вызова монстров - он большой, поэтому все комментировать не буду... Что он делает? Он проверяет контейнер на содержание в нем определенных предметов после чего если предметы там содержаться, делает видимой модель свитка, при клике на котором вызывает определенные типы монстров - тип монстров зависит от ID предметов, находящихся в контейнере - у меня это магические свитки монстров, но можно сделать проверку по камню душ и содержащейся там душе, монстр появляются над площадкой, которую можно перемещать, делать невидимой и т.д. Площадка на которой появляются монстры огорожена стеной, чтобы не было видно как они появляются из неоткуда, после появления стена поднимается, а дверь закрывается делая выход невозможным до полного истребления монстров :)

Скрипт контейнера:
Begin IK_LecturnScript

Short FirstTurner
Short SecondTurner
Short ThirdTurner
Short ForthTurner

If ( GetItemCount, IK_ScrollWingedTwilightDesc == 0 )
If ( GetItemCount, IK_ScrollStormAtronachDesc == 0 )
If ( GetItemCount, IK_ScrollSteamCenturionDesc == 0 )
If ( GetItemCount, IK_ScrollSkeletonWarriorDesc == 0 )
If ( GetItemCount, IK_ScrollSkeletonMageDesc == 0 )
If ( GetItemCount, IK_ScrollSkeletonDesc == 0 )
If ( GetItemCount, IK_ScrollSkeletonArcherDesc == 0 )
If ( GetItemCount, IK_ScrollShalkDesc == 0 )
If ( GetItemCount, IK_ScrollScribDesc == 0 )
If ( GetItemCount, IK_ScrollScampDesc == 0 )
Set FirstTurner to 0
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

If ( GetItemCount, IK_ScrollRatDesc == 0 )
If ( GetItemCount, IK_ScrollOgrimTitanDesc == 0 )
If ( GetItemCount, IK_ScrollOgrimDesc == 0 )
If ( GetItemCount, IK_ScrollNixHoundDesc == 0 )
If ( GetItemCount, IK_ScrollMudCrabDesc == 0 )
If ( GetItemCount, IK_ScrollKwamaWorkerDesc == 0 )
If ( GetItemCount, IK_ScrollKwamaWarriorDesc == 0 )
If ( GetItemCount, IK_ScrollKwamaForagerDesc == 0 )
If ( GetItemCount, IK_ScrollKagoutiDesc == 0 )
If ( GetItemCount, IK_ScrollHungerDesc == 0 )
Set SecondTurner to 0
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

If ( GetItemCount, IK_ScrollGuarDesc == 0 )
If ( GetItemCount, IK_ScrollGoldenSaintDesc == 0 )
If ( GetItemCount, IK_ScrollFrostAtronachDesc == 0 )
If ( GetItemCount, IK_ScrollFlameAtronachDesc == 0 )
If ( GetItemCount, IK_ScrollDwarvenSpectreDesc == 0 )
If ( GetItemCount, IK_ScrollDremoraLordDesc == 0 )
If ( GetItemCount, IK_ScrollDremoraDesc == 0 )
If ( GetItemCount, IK_ScrollDaedrothDesc == 0 )
If ( GetItemCount, IK_ScrollClannfearDesc == 0 )
If ( GetItemCount, IK_ScrollCenturionSpiderDesc == 0 )
Set ThirdTurner to 0
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

If ( GetItemCount, IK_ScrollCenturionSphereDesc == 0 )
If ( GetItemCount, IK_ScrollCaveRatDesc == 0 )
If ( GetItemCount, IK_ScrollBoneWalkerDesc == 0 )
If ( GetItemCount, IK_ScrollBonelordDesc == 0 )
If ( GetItemCount, IK_ScrollAshZombieDesc == 0 )
If ( GetItemCount, IK_ScrollAshSlaveDesc == 0 )
If ( GetItemCount, IK_ScrollAshGhoulDesc == 0 )
If ( GetItemCount, IK_ScrollAscenSleepDesc == 0 )
If ( GetItemCount, IK_ScrollAncesGhostDesc == 0 )
If ( GetItemCount, IK_ScrollAlitDesc == 0 )
Set ForthTurner to 0
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif

If ( GetItemCount, IK_ScrollWingedTwilightDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollStormAtronachDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollSteamCenturionDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollSkeletonWarriorDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollSkeletonMageDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollSkeletonDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollSkeletonArcherDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollShalkDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollScribDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollScampDesc == 1 )
Set FirstTurner to 1
endif
If ( GetItemCount, IK_ScrollRatDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollOgrimTitanDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollOgrimDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollNixHoundDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollMudCrabDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollKwamaWorkerDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollKwamaWarriorDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollKwamaForagerDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollKagoutiDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollHungerDesc == 1 )
Set SecondTurner to 1
endif
If ( GetItemCount, IK_ScrollGuarDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollGoldenSaintDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollFrostAtronachDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollFlameAtronachDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollDwarvenSpectreDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollDremoraLordDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollDremoraDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollDaedrothDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollClannfearDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollCenturionSpiderDesc == 1 )
Set ThirdTurner to 1
endif
If ( GetItemCount, IK_ScrollCenturionSphereDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollCaveRatDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollBoneWalkerDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollBonelordDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAshZombieDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAshSlaveDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAshGhoulDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAscenSleepDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAncesGhostDesc == 1 )
Set ForthTurner to 1
endif
If ( GetItemCount, IK_ScrollAlitDesc == 1 )
Set ForthTurner to 1
endif

If ( FirstTurner == 0 )
If ( SecondTurner == 0 )
If ( ThirdTurner == 0 )
If ( ForthTurner == 0 )
IK_MonsterScroll->Disable
endif
endif
endif
endif

If ( FirstTurner == 1 )
IK_MonsterScroll->Enable
endif
If ( SecondTurner == 1 )
IK_MonsterScroll->Enable
endif
If ( ThirdTurner == 1 )
IK_MonsterScroll->Enable
endif
If ( ForthTurner == 1 )
IK_MonsterScroll->Enable
endif

end

Скрипт свитка:
Begin IK_MonsterScrollScript

;ActionNumb 2 - Monster killing

float XM
float YM
float ZM
short ActionNumb
float doorCounter

Set XM to ( IK_Platform->GetPos, X )
Set YM to ( IK_Platform->GetPos, Y )
Set ZM to ( IK_Platform->GetPos, Z + 50 )

if ( OnActivate == 1 )
If ( IK_Lecturn->GetItemCount, IK_ScrollWingedTwilightDesc == 1 )
PlaceItem, "winged twilight", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollStormAtronachDesc == 1 )
PlaceItem, "atronach_storm", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollSteamCenturionDesc == 1 )
PlaceItem, "centurion_steam", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollSkeletonWarriorDesc == 1 )
PlaceItem, "skeleton warrior", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollSkeletonMageDesc == 1 )
PlaceItem, "IK_MageSkeleton", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollSkeletonDesc == 1 )
PlaceItem, "skeleton", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollSkeletonArcherDesc == 1 )
PlaceItem, "skeleton archer", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollShalkDesc == 1 )
PlaceItem, "shalk", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollScribDesc == 1 )
PlaceItem, "scrib", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollScampDesc == 1 )
PlaceItem, "scamp", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollRatDesc == 1 )
PlaceItem, "Rat", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollOgrimTitanDesc == 1 )
PlaceItem, "ogrim titan", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollOgrimDesc == 1 )
PlaceItem, "ogrim", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollNixHoundDesc == 1 )
PlaceItem, "nix-hound", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollMudCrabDesc == 1 )
PlaceItem, "mudcrab", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollKwamaWorkerDesc == 1 )
PlaceItem, "kwama worker", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollKwamaWarriorDesc == 1 )
PlaceItem, "kwama warrior", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollKwamaForagerDesc == 1 )
PlaceItem, "kwama forager", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollKagoutiDesc == 1 )
PlaceItem, "kagouti", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollHungerDesc == 1 )
PlaceItem, "hunger", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollGuarDesc == 1 )
PlaceItem, "guar", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollGoldenSaintDesc == 1 )
PlaceItem, "golden saint", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollFrostAtronachDesc == 1 )
PlaceItem, "atronach_frost", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollFlameAtronachDesc == 1 )
PlaceItem, "atronach_flame", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollDwarvenSpectreDesc == 1 )
PlaceItem, "dwarven ghost", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollDremoraLordDesc == 1 )
PlaceItem, "dremora_lord", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollDremoraDesc == 1 )
PlaceItem, "dremora", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollDaedrothDesc == 1 )
PlaceItem, "daedroth", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollClannfearDesc == 1 )
PlaceItem, "clannfear", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollCenturionSpiderDesc == 1 )
PlaceItem, "centurion_spider", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollCenturionSphereDesc == 1 )
PlaceItem, "centurion_sphere", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollCaveRatDesc == 1 )
PlaceItem, "rat_cave_fgrh", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollBoneWalkerDesc == 1 )
PlaceItem, "bonewalker", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollBonelordDesc == 1 )
PlaceItem, "bonelord", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAshZombieDesc == 1 )
PlaceItem, "ash_zombie", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAshSlaveDesc == 1 )
PlaceItem, "ash_slave", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAshGhoulDesc == 1 )
PlaceItem, "ash_ghoul", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAscenSleepDesc == 1 )
PlaceItem, "ascended_sleeper", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAncesGhostDesc == 1 )
PlaceItem, "ancestor_ghost", XM, YM, ZM, 270
endif
If ( IK_Lecturn->GetItemCount, IK_ScrollAlitDesc == 1 )
PlaceItem, "alit", XM, YM, ZM, 270
endif
if ( ActionNumb == 0 )
Set ActionNumb to 1
endif
endif

if ( ActionNumb == 1 )
if ( doorCounter < 3 )
"IK_TrainingGateBack"->MoveWorld, z, -70
"IK_TrainingGateFront"->MoveWorld, z, 70
"IK_ImpUpWall1"->MoveWorld, z, 80
"IK_ImpUpWall2"->MoveWorld, z, 80
"IK_ImpUpWall3"->MoveWorld, z, 80
"IK_ImpUpWall4"->MoveWorld, z, 80
"IK_ImpUpWall5"->MoveWorld, z, 80
"IK_ImpUpWall6"->MoveWorld, z, 80
"IK_ImpUpWall7"->MoveWorld, z, 80
"IK_ImpUpWall8"->MoveWorld, z, 80
endif
endif

;if ( ActionNumb == 3 )
;if ( doorCounter < 3 )
;"IK_TrainingGateBack"->MoveWorld, z, 70
;"IK_TrainingGateFront"->MoveWorld, z, -70
;"IK_ImpUpWall1"->MoveWorld, z, -80
;"IK_ImpUpWall2"->MoveWorld, z, -80
;"IK_ImpUpWall3"->MoveWorld, z, -80
;"IK_ImpUpWall4"->MoveWorld, z, -80
;"IK_ImpUpWall5"->MoveWorld, z, -80
;"IK_ImpUpWall6"->MoveWorld, z, -80
;"IK_ImpUpWall7"->MoveWorld, z, -80
;"IK_ImpUpWall8"->MoveWorld, z, -80
;endif
;endif

if ( actionNumb == 1 )
if ( doorCounter => 3 )
"IK_TrainDoorsSwitchHand2"->RotateWorld, y, 120
"IK_TrainDoorsSwitchHand2"->MoveWorld, x, -5
"IK_TrainDoorsSwitchHand2"->MoveWorld, z, -4
"IK_TrainDoorsSwitchHand1"->RotateWorld, y, 120
"IK_TrainDoorsSwitchHand1"->MoveWorld, x, -12
Set ActionNumb to 2
Set doorCounter to 0
endif
endif

if ( actionNumb == 3 )
if ( Counter => 3 )
Set ActionNumb to 0
Set doorCounter to 0
endif
endif

if ( ActionNumb == 1 )
set doorCounter to doorCounter + GetSecondsPassed
endif


end
Gekko
Полностью согласен, насчет интересных скриптов! Это я так - для толчка!
Крутой скрипт у тебя, можешь сказать, он где-нибудь использовался?
Aidan4
Надеюсь, никому не надо напоминать, что на сайте существует Русскоязычный вариант Morrowind Scripting for Dummies, в котором можно найти множество весьма любопытных скриптов (особенно, в разделе "Секреты и Приёмы").
Infernal knight
2Gekko
Это мой скрипт, т.е. именно в таком виде его придумал и сделал я сам, а используется он в моем моде, который я делал-делал, делал-делал так и не доделал, но еще не все возможно что потеряно ;) Этот скрипт, который я привел, не спешите судить слишком строго, потому что в движке Мора есть ограничение на размер скрипта в строках и на количество IFов, поэтому если кому хочется предложить как его усовершенствовать - учтите, что такое ублюдище не от хорошей жизни... кроме того это еще не final release, так что мало ли...

2Aidan4
Дыкть я и прорекламировал - чтоб знали ;]
Кстати учтите - этот экзмеляр Scripting for Dummies - это не лишь бы что - это последняя 7 версия! ;) Эксклюзив так сказать! ;)
Ваш ответ: