Пятница-Fredas
29.03.2024 11:33

Летописи Тамриэля

TESmagic


В жизни нет ничего лучше собственного опыта. Вальтер Скотт

Приветствую Вас Путешественник | RSS Главная | Каталог статей | Регистрация | Вход |

Путеводитель

Новостной Архив
Работа со скриптами [3]

Поиск

Главная » Статьи » Oblivion Tes 4 Construction Set » Работа со скриптами

Простые скрипты. ч.3
Начало тут

Скрипт на кодовый замок. Открывается при наборе правильной комбинации из 4 цифр (2914).


Scn aaaaMaormerSeyfOnScript

Short Popitka
Short Button1
Short Button2
Short Button3
Short Button4
Short CombiRight
Short ChestOpen
Short DoOnce

Begin OnActivate
if ( ChestOpen == 2 )
Activate
else
Set chestopen to 1
set Popitka to 0
set CombiRight to 0
endIf
end

Begin GameMode
if (ChestOpen == 1)
if (Popitka == 0)
MessageBox,"Введите первую цифру кода","0","1","2","3","4","5","6","7","8","9"
Set Popitka to 1
endif
endif

if (Popitka == 1)
set button1 to Getbuttonpressed
if button1 == -1
return
else
Set Popitka to 2
endif
endif

if (Popitka == 2)
MessageBox,"Введите вторую цифру кода","0","1","2","3","4","5","6","7","8","9"
Set Popitka to 3
endif

if (Popitka == 3)
set button2 to Getbuttonpressed
if button2 == -1
return
else
Set Popitka to 4
endif
endif

if (Popitka == 4)
MessageBox,"Введите третью цифру кода","0","1","2","3","4","5","6","7","8","9"
Set Popitka to 5
endif

if (Popitka == 5)
set button3 to Getbuttonpressed
if button3 == -1
return
else
Set Popitka to 6
endif
endif

if (Popitka == 6)
MessageBox,"Введите четвертую цифру кода","0","1","2","3","4","5","6","7","8","9"
Set Popitka to 7
endif

if (Popitka == 7)
set button4 to Getbuttonpressed
if button4 == -1
return
else
Set Popitka to 8
endif
endif

if (Popitka == 8)
if button1 == 2
Set CombiRight to CombiRight + 1
endif
if button2 == 9
Set CombiRight to CombiRight + 1
endif
if button3 == 1
Set CombiRight to CombiRight + 1
endif
if button4 == 4
Set CombiRight to CombiRight + 1
endif

if (Popitka == 8) && (CombiRight == 4)
Set ChestOpen to 2
set Popitka to 0
return
endif

if (Popitka == 8) && (CombiRight <= 3)
MessageBox"Код неверен."
Set Popitka to 0
Set ChestOpen to 0
endif

elseif (chestopen == 0)
return
elseif (chestopen == 2)
if Doonce == 0
set doonce to 1
Activate
return
endif
else
return
endif
end

Интересный и полезный прием - создание скрипта, содержащего одни переменные. Скрипт - объектный, объявленные в нем переменные могут использоваться в других скриптах. (что-то вроде глобальной переменной, но менее капризно)

Скрипт переменных. Навешан, например, на сундук с REF ID aaaMRDreamMercyChestRef

Scn aaaMRVarScr

Short doonce
Short Da
Short HitVar
Short Larchik
Short Summa

При необходимости использовать переменную из этого скрипта, в нужном месте другого скрипта эта переменная запишется как, например, aaaMRDreamMercyChestRef.doonce Пример - см.ниже.


Ларчик, выдающий деньги. (карманный банкомат )

Scn aaaMRLarecScr

Short Var
Short Button
Short Alarm
Short Maxim

Begin OnEquip
If aaaMRDreamMercyChestRef.Summa == 100000
Set aaaMRDreamMercyChestRef.Larchik to 1
Set Var to -1
else
MessageBox "Постарайтесь не жадничать. Какая сумма Вам нужна?", "1 септим", "10 септимов", "100 септимов", "1000 септимов", "10000 септимов", "100000 септимов"
Set Var to 1
endif
end

Begin GameMode
If Var == 1
Set Button to GetButtonPressed
if ( Button == 0 )
If aaaMRDreamMercyChestRef.Summa+1<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+1
Player.AddItem gold001 1
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
elseif ( Button == 1 )
If aaaMRDreamMercyChestRef.Summa+10<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+10
Player.AddItem gold001 10
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
elseif ( Button == 2 )
If aaaMRDreamMercyChestRef.Summa+100<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+100
Player.AddItem gold001 100
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
elseif ( Button == 3 )
If aaaMRDreamMercyChestRef.Summa+1000<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+1000
Player.AddItem gold001 1000
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
elseif ( Button == 4 )
If aaaMRDreamMercyChestRef.Summa+10000<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+10000
Player.AddItem gold001 10000
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
elseif ( Button == 5 )
If aaaMRDreamMercyChestRef.Summa+100000<=100000
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+100000
Player.AddItem gold001 100000
else
Set Maxim to 100000-aaaMRDreamMercyChestRef.Summa
Set aaaMRDreamMercyChestRef.Summa to aaaMRDreamMercyChestRef.Summa+Maxim
Player.AddItem gold001 Maxim
Set Var to -1
endif
Endif
Endif
Категория: Работа со скриптами | Добавил: Luna (21.11.2013)
Просмотров: 1901 | Рейтинг: 5.0/2
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Статистика








Яндекс.Метрика




Rambler's Top100



Онлайн всего: 1
Гостей: 1
Пользователей: 0


Форма входа
Логин:
Пароль:


Наш баннер:
//imperialcity.ucoz.net/

   

Друзья сайта



Сайт команды Города Ночи

Фан-сайт TES 4: Квагмир - мир снов







TES-game Oblivion and Morrowind

The Elder Scrolls: ФРПГ

Фан-сайт игр серии Gothic

TES-Empire - Информационный ресурс по The Elder Scrolls







Русскоязычный портал фэнов Дома Тельвани



TES World -- все для игр вселенной The Elder Scrolls


Silicium TES4:Oblivion Craft -- фан-сайт игры TES4:Oblivion

RPG игры серии Gothic, The Elder Scrolls, Risen, The Witcher



Фан-сайт игры Dragon Age: Начало и Dragon age:2


Copyright ImperialCity ©2009-2024 При копировании материалов - ссылка на сайт  обязательна!

free counters Rambler's Top100