Здравствуйте, гость ( Вход | Регистрация )

 
Ответить в эту темуОткрыть новую тему
> newbie_chests, .56b
KonstantiN
сообщение 7.8.2012, 21:21
Сообщение #1


******

Группа: Пользователи
Наличность: 0
Пользователь №: 6.583



Код

[comment header]
Author: Khaos
Contributors: N/A
Sphere Version: 56B
Created: 8:15pm Saturday, April 28th, 2012.
Last Modified: 9:44pm Saturday, April 28th, 2012.

[comment newbie_chests]
A very simple script. Newbie chests can be placed in any area fit by a GM. It creates 'x' amount of item templates within at 'x' time.

The chest empties every 30 minutes and repopulates the chest with 5 newbie templates as a default.

The items set are default unless an override is used. The timer and content max are controlled globally. Unless, again, an override is used to stop this. Overrides and global control were added to remove the need to create several scripts of the same item.

The 'random_*' templates listed in the default template are examples. I didn't include any templates for the custom ones.

[comment script_version]
version 1.8.2.4

[comment revisions]
- Initial base item scripted.
- Added: Global control added for timer and content max.
- Updated: Switched code from the @create and @timer triggers to a function.
- Added: Function now tests for an override. If the override isn't present it uses the template in the <args> area. If the override is present, the string in the tag will be used over the default. This is handled in the triggers. The tag usage: tag.override.content.template=<args>. <args> being what template you add to it.
- Added in tag.override support to the function. This now handles two tags. tag.override.content.max and tag.override.content.timer.
- Added: Attributes attr_move_never and attr_static to the base item.
- Added: Can flags added. can_i_block and can_i_flip.
- Updated: Removed the default template from the function and moved it to global.
- Fixed: set the base FOR to 0 instead of 1.


[defname global_controls_chest_newbie]
newbie_chest_content_max        5    // <value> of templates it will generate.
newbie_chest_content_timer        30    // <value> in minutes.
newbie_chest_content_template        loot_chest_newbie    // <args> default template to use.

[itemdef i_chest_wooden_newbie]
id=i_chest_wooden
name=wooden chest [ newbie ]
type=t_container
can=can_i_block|can_i_flip
weight=5

category=Server Items
subsection=New Player
description=Newbie Chest

on=@create
attr=attr_static|attr_move_never
// tag.override.content.template=
// tag.override.content.max=
// tag.override.content.timer=

if !<tag.override.content.template>
  populate_newbie_chest <def.newbie_chest_content_template>
else
  populate_newbie_chest <tag.override.content.template>
endif

on=@timer
empty
if !<tag.override.content.template>
  populate_newbie_chest loot_chest_newbie
else
  populate_newbie_chest <tag.override.content.template>
endif
return 1

[function populate_newbie_chest]
if !<tag.override.content.max>
for 0 <eval <def.newbie_chest_content_max>>
  if <local._for> == <eval <def.newbie_chest_content_max>>
   local._for ++
   serv.newitem=<args>, ,<new.uid>
  else
   if !<tag.override.content.timer>
    timer=60*<eval <def.newbie_chest_content_timer>>
   else
    timer=60*<eval <tag.override.content.timer>>
   endif
  endif
endfor
else
for 0 <eval <def.newbie_chest_content_max>>
  if <local._for> == <eval <tag.override.content.max>>
   local._for ++
   serv.newitem=<args>, ,<new.uid>
  else
   if !<tag.override.content.timer>
    timer=60*<eval <def.newbie_chest_content_timer>>
   else
    timer=60*<eval <tag.override.content.timer>>
   endif
  endif
endfor
endif


[template loot_chest_newbie]
category=Loot Templates
subsection=Containers
description=Newbie Chest
container=i_backpack
item=random_food, { 2 4 }
item=random_drink, { 2 4 }
item=random_light_source
item=random_weapon_practice





[eof]


--------------------
По тихоньку возрождаю The Odyssey.
Пользователь в офлайнеDelete PostОтправить личное сообщение
Вернуться в начало страницы
+Ответить с цитированием данного сообщения

Ответить в эту темуОткрыть новую тему
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 

- Текстовая версия | Версия для КПК Сейчас: 27.4.2024, 22:24
Designed by Nickostyle