Среда, 13 Ноября 2024, 11:32

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 1 из 1
  • 1
Супер Skill (ES)
infermikДата: Среда, 23 Марта 2011, 22:30 | Сообщение # 1
заслуженный участник
Сейчас нет на сайте
Всем привет, сейчас я покажу как сделать скилы (Алхимия, кузнец, и вся прочая абра-кадабра)
Возможно скрипт вызовет у вас массу затруднений, но он легкий.
Скил-скрипт написан для Eclipse Stable

Скил немного реальный т.е вам придется отдохнуть чтобы опять приступить к работе

Итак пожалуй начнем:

1)Открываем main.ess
и в самый конец вставляем:

Code
'********************************
Function F_Freeslots(index)      
'********************************

Dim slot
Dim count

slot=1
count=0
    Do While slot < 25    
       If getplayerinvitemnum(index, slot) = 0 Then
       count = Int(count) + 1
       End If
    slot=Int(slot) + 1
    Loop
F_Freeslots=Int(count)
End Function

'********************************
Sub Give_Item(index, number, durability)
'********************************

Dim slot

slot = 1
    Do While slot < 25
       If Getplayerinvitemnum( index, Int( slot ) ) = 0 Then
          Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
          Call SetPlayerInvItemDur(index, Int( slot ), Int( durability ) )
          Call SetPlayerInvItemValue(index, Int( slot ), Int(0) )
          Call SendInventoryUpdate(index, Int(slot) )
          slot = 25
       End If
    slot = slot + 1
    Loop
End Sub

'********************************
Sub Give_Currency(index, number, quantity)
'********************************

Dim slot
Dim initial
Dim final
Dim given

slot=1
given=0

    Do While slot < 25
       If Getplayerinvitemnum(index,Int(slot))=Int(number) Then
          initial = Getplayerinvitemvalue( index, Int( slot ) )
          final = Int( initial ) + Int( quantity )
          Call setplayerinvitemvalue( index, Int( slot ), Int( final ) )
          Call SendInventoryUpdate(index, Int(slot) )
          slot = 25
          given = 1
       End If
    slot = slot + 1
    Loop
        
    If given=1 Then
       slot=25
    Else
       slot=1
    End If

    Do While slot < 25
       If Getplayerinvitemnum(index,Int(slot)) = 0 Then
          Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
          Call SetPlayerInvItemValue(index, Int( slot ), Int( quantity ) )
          Call SetPlayerInvItemDur(index, Int( slot ), 0 )
          Call SendInventoryUpdate(index, Int(slot) )
          slot = 25
       End If
    slot = slot + 1
    Loop
     
End Sub

'********************************
Function F_Check_Take(index, number, value)
'********************************

Dim slot

slot = 1
F_Check_Take =0
    Do While slot < 25    
       If Getplayerinvitemnum( index, Int( slot ) ) = Int( number ) Then
          If GetPlayerInvItemValue(index, Int( slot ) ) >= Int(value) Then          
          F_Check_Take=1             
          End If
       End If
    slot = slot + 1
    Loop
End Function

'********************************
Sub Take_Item(index, number, value)
'********************************

Dim slot
Dim taken
Dim initial
Dim final

slot=1
taken=0
    Do While Int(slot) < 25       
       If Int(taken)=0 Then       
          If Getplayerinvitemnum(index,Int(slot)) = Int(number) Then
             If Int(getplayerinvitemvalue(index, Int(slot))) >= Int(value) Then
             initial = Int(getplayerinvitemvalue(index, Int(slot) ) )
             final = Int(initial) - Int(value)             
                If Int(final) <= 0 Then                
                Call setplayerinvitemnum(index, Int(slot), Int(0) )
                Call setplayerinvitemvalue(index, Int(slot), Int(0) )
                Call setplayerinvitemdur(index, Int(slot), Int(0) )
                Call SendInventoryUpdate(index, Int(slot))
                taken=1                
                Else             
                Call setplayerinvitemvalue(index, Int(slot), Int(final) )
                Call SendInventoryUpdate(index, Int(slot) )
                taken=1             
                End If
             End If          
          End If
       End If       
    slot = slot + 1
    Loop
End Sub

'********************************
Sub Baron_Stam_regain(index)
'********************************

Dim skill_type
Dim skill_action
Dim stam_total
Dim player_lvl

skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )

    If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
    Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
    Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
    Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
    Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
    Call battlemsg(index, "You should return here if you wish to rest", 14, 1)
    End If
        
player_lvl=Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level")
skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))
stam_total=5 + Int(player_lvl)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(stam_total))
Call battlemsg(index, "You feel refreshed and ready to " & skill_action & " again.", 14, 1)
End Sub

'********************************
Sub Baron_Uber_skills(index)
'********************************
'Do not modify this script in any way.
'It is provided as is in all goodwill.
'There is CONSIDERABLE time spent here.
On Error Resume next
Dim skill_type
Dim skill_number
Dim take_total
Dim give_total
Dim count
Dim take_count
Dim take_num
Dim take_val
Dim take_msg
Dim empty_space
Dim take_check
Dim needed_item
Dim player_weapon
Dim skill_action
Dim currency_check
Dim recipe_count
Dim recipe_total
Dim min_lvl
Dim player_lvl
Dim player_stam
Dim recipe_stam
Dim give_val
Dim give_num
Dim give_dur
Dim give_msg
Dim high_randomiser
Dim success_chance
Dim low_chance
Dim high_chance
Dim give_exp
Dim new_exp
Dim lvl_exp
Dim next_lvl

If Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data")) < 0 Then
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type", "")
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number", 0)
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data", 1)
Call Playermsg(index, "Made skill template for map", 14)
Call Playermsg(index, "Credits go to Baron - http://barony.deviantart.com/", 14)
End If

RECIPE_COUNT = Int(1)
skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )
recipe_total=Int(GetVar("scripts\skills\" & skill_type & ".ini","INDEX" ,"total_recipes"))

'RECIPES ALWAYS HAVE SKILL 1 SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO HIGHEST
'NON RECIPES HAVE ANY SKILL SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO 1

Do While Int(RECIPE_COUNT) <= Int(recipe_total)

    If trim(skill_type) <> "" Then

    skill_number = Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number"))

    If Int(recipe_count) > 1 Then
    skill_number = Int(recipe_count)
    End If

    needed_item=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"item_num_needed"))
    player_weapon=Int( Getplayerinvitemnum(index, Int(getplayerweaponslot(index)) ) )
    skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))

       If Int(needed_item) = Int(player_weapon) Then

       min_lvl = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"min_level"))

       If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
       Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
       Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
       Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
       Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
       Call playermsg(index, "You attempt to " & skill_action & " for the first time!", 14)
       End If

       player_lvl = Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level"))

          If Int(min_lvl) <= Int(player_lvl) Then
           
          player_stam=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina"))
          recipe_stam=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"stam_taken"))
           
          If Int(player_stam) >= Int(recipe_stam) Then

          take_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"take_total"))
          give_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"give_total"))    
           count = Int ( 1 )
           take_count = Int ( 0 )
           empty_space=F_Freeslots(index)
     
                If Int(give_total) <= Int(empty_space) Then
     
             Do While count <= Int(take_total)
             take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
             take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val"))    

             take_check=F_Check_Take(index,take_num,take_val)
             take_count=take_count + Int(take_check)    
             count=count+1
             Loop

                If Int(take_count) = Int(take_total) Then          
              
                count = Int ( 1 )       
              
                   Do While Int(count) <= Int(take_total)
                   take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
                   take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val"))    
                     take_msg=Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_Msg"))             
                   Call battlemsg(index, trim(take_msg), 15, 1)    
                   Call Take_Item(index, Int(take_num), Int(take_val) )          
                   count=count+1
                   Loop
           
                   count = Int ( 1 )
                   new_exp = 0
                    
                   Do While Int(count) <= Int(give_total)
                   give_val = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_val"))
                   give_msg = Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_msg"))
                    
                   success_chance = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_base_chance"))
                   low_chance= Int(player_lvl) - Int(min_lvl) + 1
                   high_chance = Int(player_lvl) - Int(min_lvl) + Int(success_chance)
                   high_randomiser = Int((high_chance + 1) * Rnd)
                    
                   If Int(high_randomiser) <= Int(low_chance) Then                   
                       
                      If Int(give_val) > 0 Then
                      give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
                      Call Give_Currency(index, Int(give_num), Int(give_val) )
                      Call battlemsg(index, Trim(give_msg),10, 1)
                      'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
                      RECIPE_COUNT= Int(recipe_total)
                      Else
                      give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
                      give_dur = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_dur"))
                      Call Give_Item(index, give_num, give_dur)
                      Call battlemsg(index, Trim(give_msg),10, 1)
                      'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
                      RECIPE_COUNT= Int(recipe_total)
                      End If
                       
                      give_exp = 0 + Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_EXP"))
                      new_exp = 0 + Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp")) + Int(give_exp)
                       Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
                   End If
                    
                   If new_exp=0 Then
                   new_exp=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp"))
                   End If
                       
                   count=count+1
                   Loop
                    
                   next_level = Int(player_lvl) + Int(1)
                   lvl_exp = Int(Getvar("experience.ini", "EXPERIENCE", "Exp" & Int(next_level) ) )
                   Call battlemsg(index,new_exp & " / " & lvl_exp & " For " & next_level & " " & trim(skill_type), 6, 0)
                    
                   If Int(new_exp) >= Int(lvl_exp) and Int(player_lvl) < 100 Then
                   new_exp= 0 + Int(new_exp) - Int(lvl_exp)                   
                   Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
                   Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(next_level))
                   Call battlemsg(index, "Congratulations, you are now level " & Int(next_level) & " in " & trim(skill_type) & "!", 13, 1)
                   End If
                    
                   player_stam = Int(player_stam) - Int(recipe_stam)
                   Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(player_stam))
                    
                   If Int(recipe_total) = 1 Then
                   RECIPE_COUNT= Int(recipe_total)
                   End If                            
                  
                  Else                 
                     If Int(recipe_count) + 1 > Int(recipe_total) and Int(recipe_total) > Int(1) Then
                   Call battlemsg(index, "You have no components to " & skill_action, 12, 1)
                   End If     
                End If          
        
             Else       
             Call battlemsg(index, "You need more inventory room to continue " & skill_type & ".", 15, 1)             
              End If
            
            Else
            Call battlemsg(index, "You are too tired to " & skill_action & ".", 12, 1)
            End If
            
            Else
            Call battlemsg(index, "You need to be more skilled to " & skill_action & " here.", 12, 1)          
            End If
            
       End If
         'This continues off end of item script. Used when empty slot. Elseif errors usually.
       If Int(needed_item) <> Int(player_weapon) and Int(recipe_count) = 1 Then
       Call battlemsg(index, "You need to get the right tool to " & skill_action & " here.", 15, 1)        
       End If
     
     Else
     'Not working. Cant figure out why. Is non essential for the script to work.
     Call Playermsg(index, "You still need to define a skill for this map", 14)
    End If

RECIPE_COUNT = Int(recipe_count)+1

Loop

End Sub

Добавлено (23.03.2011, 22:30)
---------------------------------------------
2)Далее переходим в папку Events там ищем SriptedTile.ess

туда вставляем:

Code

Case 0
    Call Baron_Uber_skills(index) 'Тайл наступая на который первый раз генерируется информация о скиле который будет находится на данной карте
     
'<><><><><>

Case 1
    Call Baron_Stam_regain(index) 'Тайл наступая на который ваша энергия будет востонавливаться

3)В папке Script создаем папку SKILLS и mapextras
Затем в папке SKILL, в качестве примера создадим файл Mining.ini с содержимым:

Code

[INDEX]
Action=Mine 'Пишет когда вы копаете Пример: Идет добыча
Skill=Mining 'Само название скила
Succeeded=Mined 'Пишет если действие сделано Например: добыча завершена
Recipe=0
Total_recipes=1 'Странный параметр если попробовать увеличить то он будет проверять все рецепты(которые добываются) мой совет лучше его не трогать

[1]
Min_Level=0 'Требующийся уровень игрока
Item_Num_Needed=5 'Какое орудие труда нужно для добычи
Stam_Taken=1 'Сколько энергии заберет использование скила

Take_Total=0 'Параметр который забирает предмет если не хотите чтобы при добыче гора съела кирку то оставьте на 0

Give_total=2

1_Give_Num=51 'Номер предмета который вы хотите дать
1_Give_Val=0
1_Give_dur=0
1_Base_Chance=10 'Базовый шанс
1_Give_Msg=You mined some copper ore. 'Сообщение о том что вы добыли
1_EXP=15 'Сколько опыта дается за такую успешную добычу

2_Give_Num=24
2_Give_Val=1
2_Give_dur=0
2_Base_Chance=20
2_Give_Msg=You break apart a crystal in your mining efforts.
2_EXP=25

[2]
Min_Level=5
Item_Num_Needed=5
Stam_Taken=1

Take_Total=0

Give_total=2

1_Give_Num=52
1_Give_Val=0
1_Give_dur=0
1_Base_Chance=1 0
1_Give_Msg=You mined some iron ore.
1_EXP=35

2_Give_Num=24
2_Give_Val=2
2_Give_dur=0
2_Base_Chance=20
2_Give_Msg=You break apart a crystal in your mining efforts.
2_EXP=25

4)Как сделать чтобы все работало?
На карте ставим Скрипт-Тайл
№ 0 - Скилл
% 1 - Отдыхаем

Ставим на карту №0 Ну и где нибудь рядом скрипт №1
Сохраняем идем на скрипт №0 затем идем в папку Script>mapextras
Там должен появится файл "Номер карты.ini"
Заходим в него видим:

Code
[SKILL]
type=
number=0
has_data=1

Если нет такого в файле то вставляем код, что выше.

Итак редактируем его нам допустим надо тот самый скрипт который мы с вами разбирали
И отредактируем его так:

Code
[SKILL]
type=Mining
number=1
has_data=1

Вот и все, желаю вам удачи в создании своих скилов.


Выпрямляю путем кнута и пряника
DarkScorp24Дата: Среда, 23 Марта 2011, 23:11 | Сообщение # 2
почетный гость
Сейчас нет на сайте
Круто)) Спс..Полезно

САТАНА
  • Страница 1 из 1
  • 1
Поиск:

Все права сохранены. GcUp.ru © 2008-2024 Рейтинг