Çözüldü Oyuncunun önündeki moblara hasar verme

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Fellixem

Birisi mi Spawnlandı?
Katılım
31 Aralık 2021
Mesajlar
3
Elmaslar
0
Puan
6.400
Yaş
26
Minecraft
Fellixem

Discord:

Fellixem#0001

Oyuncunun önündeki 5 bloğa kadar olan tüm canavarlara nasıl hasar verebilirim?
 
Kod:
loop while player is alive:
    loop in radius 5 around player:
        if {loop-entity} is a monster:
            damage {loop-entity} by 1
            play sound "entity.player.attack.impact"
    wait 1 tick

Bu kodu deneyebilirsiniz fakat bu kod sürekli çalıştığı için sunucu performansını etkileyebilir.
 
Ben yerinde olsam, Java ile yapardım (Yapabiliyorsam), veya bu konu ile ilgili ingilizce makalelelere bakarım. Çünkü buna benzer birçok şey aslında yabancılar tarafından yapıldı
 
İstediğin skript:


Kod:
on right click:
    set {_p} to player
    set {_loc} to location of {_p}
    set {_dir} to direction of {_p}
    set {_range} to 5
  
    loop {_range} times:
        set {_newloc} to {_loc} offset {_dir} by loop-number
        loop living entities within 1 block of {_newloc}:
            if entity is not player:
                damage entity by 5


Biraz el atip özenleştirdim

Kod:
on right click:
    set {_p} to player
    set {_loc} to location of {_p}
    set {_dir} to direction of {_p}
    set {_range} to 5
    set {_sword} to netherite sword named "Mob Savar"
    if {_sword} is not {_p}'s tool:
        send "&cBu eylemi gerçekleştirebilmek için Mob Savar isimli bir netherite kılıç kullanmalısın."
    else if cooldown "{_p}_mob_savar" is not set:
        set cooldown "{_p}_mob_savar" to 30 seconds
        loop {_range} times:
            set {_newloc} to {_loc} offset {_dir} by loop-number
            loop living entities within 1 block of {_newloc}:
                if entity is not player:
                    damage entity by 5
        send "&aMob Savar kullanarak önündeki canavarlara hasar verdin!"
    else:
        send "&cBu eylemi tekrar gerçekleştirebilmek için &6%remaining seconds%&c saniye beklemelisin." to {_p} parsed as a message
 
İstediğin skript:


Kod:
on right click:
    set {_p} to player
    set {_loc} to location of {_p}
    set {_dir} to direction of {_p}
    set {_range} to 5
 
    loop {_range} times:
        set {_newloc} to {_loc} offset {_dir} by loop-number
        loop living entities within 1 block of {_newloc}:
            if entity is not player:
                damage entity by 5


Biraz el atip özenleştirdim

Kod:
on right click:
    set {_p} to player
    set {_loc} to location of {_p}
    set {_dir} to direction of {_p}
    set {_range} to 5
    set {_sword} to netherite sword named "Mob Savar"
    if {_sword} is not {_p}'s tool:
        send "&cBu eylemi gerçekleştirebilmek için Mob Savar isimli bir netherite kılıç kullanmalısın."
    else if cooldown "{_p}_mob_savar" is not set:
        set cooldown "{_p}_mob_savar" to 30 seconds
        loop {_range} times:
            set {_newloc} to {_loc} offset {_dir} by loop-number
            loop living entities within 1 block of {_newloc}:
                if entity is not player:
                    damage entity by 5
        send "&aMob Savar kullanarak önündeki canavarlara hasar verdin!"
    else:
        send "&cBu eylemi tekrar gerçekleştirebilmek için &6%remaining seconds%&c saniye beklemelisin." to {_p} parsed as a message
Can't understand this expression: 'direction of {_p}' hatası veriyor
 
on damage:
if damaged is mob:
loop through entities within 5 blocks of damager:
if entity is mob:
damage entity by 2.0

Hata verirse hata kodunu yaz.
 
Can't understand this expression: 'direction of {_p}' hatası veriyor
Bu hata, Skript dilinde kullanılan {_p} değişkeninin bir oyuncuyu temsil etmemesi nedeniyle oluşabilir. Bu hatanın nedeni, oyuncu değişkeninin belirli bir dünya veya bölge ile ilişkilendirilmemesidir.

Bu hatayı düzeltmek için, öncelikle oyuncu değişkenini doğru bir şekilde tanımlamalısınız. Örneğin, "player" komutu, oyuncunun bulunduğu dünyayı ve konumu da dahil olmak üzere tüm oyuncu bilgilerini içerir. Buna göre, skriptin başında şu satırı ekleyebilirsiniz:

vbnetCopy code
set {_p} to player

Bu satır, oyuncu değişkenini doğru bir şekilde tanımlayacak ve "direction of {_p}" ifadesinin doğru şekilde çalışmasını sağlayacaktır.
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Hala Discord sunucumuza katılmadın mı?

Büyük bir topluluğun parçası ol, etkinliklere katıl ve özel hediyeler kazanma şansı yakala!

Şimdi Katıl
Üst