Skocz do zawartości
  • 0

Problem z mieczami


XxPostalekxX

Pytanie

Witam. Mam problem mianowicie zrobiłem zmienne do mieczy w lore, aby były np. Silne na potwory 10%, a na ludzi -20% i nie wiem jak użyć tego w on damage by zadawały faktyczny dmg taki jak dodaje lore. Chodzi o to, że gdy do broni zostanie wylosowany % np. 50% na potwory i -100% na ludzi to wtedy by było tak jak pisze tam w kodzie na dole, a gdy by był np. 37% na potwory i -74% na ludzi to do tego skrypt samemu by dodawał dmg. Da się to jakoś zrobić?

command /test:
    permission: admin.ostrze
    trigger:
        set {_spp} to a random integer between 1 and 100
        set {_spl} to a random integer between -1 and -100
        add 1 of diamond hoe of sharpness 40 named "&8Tajemniczy test" with lore "&4Silny przeciwko potworom &6%{_spp}%%%||&4Silny przeciwko ludziom &6-%({_spp}*2)%%%" to player's inventory
        send "&c* &7Otrzymales Tajemniczy test do ekwipunku!"
        send "Losowa liczba pomiedzy : %random integer between 1 and 100%" 
on damage:
    if attacker is a player:
        if attacker's tool is diamond hoe of sharpness 40 named "&8Tajemniczy test" with lore "&a%{_spp}%%% Silny przeciwko potworom||&c-%({_spp}*2)%%%Silny przeciwko ludziom":
            if victim is not a player:
                set {_damage} to damage
                set damage to ({_damage}*1.5)
            else:
                set {_damage} to damage
                set damage to ({_damage}*0)					
				

 

Odnośnik do komentarza
https://skript.pl/temat/30968-problem-z-mieczami/
Udostępnij na innych stronach

7 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

  • 0
5 minut temu, XxPostalekxX napisał:

A mógłbyś mi jakoś to pokazać czy coś? Bo nie wiem jak to zrobić :/

Cytat

To create a custom enchantment, is very simple and easy to do, let's start with a simple tutorial.
After 1.5.3, you can create custom enchantments using effects in your skript. All you have to do is register a enchantment with a name, this name will be used at your code to enchant items.

Code (Skript):
on skript load:
     register a new custom enchantment with id name "Magic"

The id name is what you use in your code to enchants a item, in this example, we will use Magic as custom enchantment's name.

This is the basic of creating a custom enchantment, but it's not all. It has somethings that you can hide and the plugin will use a default value and there are values that are optional. The expressions that you don't need to set if you don't want are:
 

set max level of Magic to 10

The max level that a enchantment can have, it goes from 1 to 10, the default is 3.
 

set rarity of Magic to 3

The rarity of enchantment, it goes from 1 (rare) to 5 (common), the default is 3.
 

set accepted items for Magic to "Swords", "Bow" and "Armor"

The types of items that the enchantment accepts. This doesn't accept the ID or name of item, only especific values and they are:
Helmets, Chestplates, Leggings, Boots, Pickaxes, Axes, Shovels, Bow and Fishing Rod
And there are values that represents a group of groups above:
Tools: Pickaxes, Axes and Shovels
Armor: Helmets, Chestplates, Leggings and Boots
All: All groups above
If this option is not set, it will use the default value, All. You can use more than one value, it's just separate with "," or "and".
 

set enabled for Magic to true

If true, the enchantment can be gotten on enchantment table, else, only by skript. By default is false.

The optional value doesn't have a default value, so you don't need it if you don't want it.
 

set conflicts for Magic to Enchantment and Another_Enchantment

It will set a group of enchantments that is incompatible with the enchantment, it means that they won't be together at same item. The value is the ID name of other custom enchantments.

Here is a example of how it's should look like:

Code (Skript):
on skript load:
     register a new custom enchantment with id name "Magic"
     set {_enchantment} to "Magic" parsed as custom enchantment
     set max level of {_enchantment} to 5
     set rarity of {_enchantment} to 1
     set accepted items for {_enchantment} to "Swords" and "Bow"
     set lore name of {_enchantment} to "Magic Power"

After the configuration, you just have to reload the file: or you restart your server or you execute the skript effect:

reload all custom enchantments

If everything is right, you shouldn't see any errors on console. After that, you only have to create your custom effects for the enchantment by yourself. And to do that, you have some expressions to help you.
 

Code (Skript):
#You can specify the level or not.
%itemtype% has custom enchantment %custom enchantment%
level of custom enchantment %custom enchantment% of %itemstack%
#You can add or remove enchantments from it.
[all] custom enchantments of %itemstack%
...

Skopiowane z forum skunity, nie chciało mi się wszystkiego pisać, chyba zrozumiesz po agnielsku ;d

Odnośnik do komentarza
https://skript.pl/temat/30968-problem-z-mieczami/#findComment-201736
Udostępnij na innych stronach

  • 0
1 minutę temu, SernickLOL napisał:

Skopiowane z forum skunity, nie chciało mi się wszystkiego pisać, chyba zrozumiesz po agnielsku ;d

No dobra coś pokminie, a wiesz może na jakiej zasadzie można by było zrobić średnie obrażenia ?

Odnośnik do komentarza
https://skript.pl/temat/30968-problem-z-mieczami/#findComment-201739
Udostępnij na innych stronach

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...