Aller au contenu
  • 0

Bloc special (piege)


Question

Posté(e)

Bonjour,

J'ai un problème avec la suppression de coordonnée dans une variable.

Le but du skript est que quand on pose un bloc de sandstone nommé soulstone , cela ajoute a une variable ces coordonnée.

Quand on marche sur ce bloc , il se casse et les coordonné s’enlève de la variable .

Quand on le casse , les coordonné s’enlève de la variable

.Tous fonctionne correctement quand je le pose et il se casse en marchant dessu .

Mais quand on la casse ou que on marche dessus il ne s’enlève pas de la variable .

Par exemple on pose une bloc de sandstone normal , on marche dessus il ne s’enlève pas (normal) , quand on pose un bloc nommé soulstone et que je marche dessus il se casse (normal) mais si je remet un bloc de sandstone normal et que je marche il se casse alors qu'il ne devrait pas .

Voici se que j'ai fait :

Code:

 

command /piege:
   permission: op
   trigger:
       give player 1 sandstone named "&6Soul&lStone"

on place:
   if player is holding a sandstone named "&6Soul&lStone":
       add event-block's location to {locations.sandpiege::*}

on walk on sandstone:
   if "%{locations.sandpiege::*}%" contains "%location of event-block%":
       set event-block to air
       remove location of event-block from {locations.sandpiege::*}

on break of sandstone:
   if "%{locations.sandpiege::*}%" contains "%location of event-block%":
       remove location of event-block from {locations.sandpiege::*}

 

 

 

Merci d'avoir lu et merci a toi si tu as la réponse ;)

 

Cordialement _Rtinox

19 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Bonjour,

on walk on sandstone:
   if {locations.sandpiege::*} where [location of event-block is object input] is set:
       set {_b} to location of event-block
       set event-block to air
       remove {_b} from {locations.sandpiege::*}
on break of sandstone:
   if {locations.sandpiege::*} where [location of event-block is object input] is set:
        remove location of event-block from {locations.sandpiege::*}

N'oublies pas de clear ta variable list avant d'utiliser le code

  • 0
Posté(e)

Salut, il ne faut jamais utiliser de 'contains' pour savoir s'il y a quelque chose dans une liste, car par exemple si une liste contient' jean_michelle" et que tu veux regarder s'il la liste contient "jean", il va te dire que oui car "jean_michelle" contient "jean".

on walk on sandstone:
   loop {locations.sandpiege::*}:
       set {_l} to event-block's location
       loop-value is "%{_l}%"
       set {_yes} to true
   if {_yes} is true:
       set event-block to air
       remove location of event-block from {locations.sandpiege::*}

 

Tu peux essayer ce que je t'ai mis en haut ou alors:

 

Tu peux toujours essayer de set une variable a chaque fois, même si c'est pas conseiller:

 

set {piege.sandstone.%event-block's location%} to true
#-------------
if {piege.sandstone.%event-block's location%} is true:
   clear {piege.sandstone.%event-block's location%}

  • 0
Posté(e)

Je fais 2 skript du coup mais aucun marche . Quand je marche sur la soulstone , rien ne sa passe .

command /piege:
   permission: op
   trigger:
       give player 1 sandstone named "&6Soul&lStone"

on place:
   if player is holding a sandstone named "&6Soul&lStone":
       add event-block's location to {locations.sandpiege::*}

on walk on sandstone:
   loop {locations.sandpiege::*}:
       set {_l} to event-block's location
       loop-value is "%{_l}%"
       set {_yes} to true
   if {_yes} is true:
       set event-block to air
       remove location of event-block from {locations.sandpiege::*}

on break of sandstone:
   if {locations.sandpiege::*} where [location of event-block is object input] is set:
       remove location of event-block from {locations.sandpiege::*}

 

command /piege:
   permission: op
   trigger:
       give player 1 sandstone named "&6Soul&lStone"

on place:
   if player is holding a sandstone named "&6Soul&lStone":
       add event-block's location to {locations.sandpiege::*}

on walk on sandstone:
   if {locations.sandpiege::*} where [location of event-block is object input] is set:
       set {_b} to location of event-block
       set event-block to air
       remove {_b} from {locations.sandpiege::*}

on break of sandstone:
   if {locations.sandpiege::*} where [location of event-block is object input] is set:
       remove location of event-block from {locations.sandpiege::*}

  • 0
Posté(e)
Salut, il ne faut jamais utiliser de 'contains' pour savoir s'il y a quelque chose dans une liste, car par exemple si une liste contient' jean_michelle" et que tu veux regarder s'il la liste contient "jean", il va te dire que oui car "jean_michelle" contient "jean".

Dans ce cas là, le "contains" ne pose pas de problème car c'est des valeurs et non des "Caractères"

  • 0
Posté(e)
on walk on sandstone: loop {locations.sandpiege::*}: set {_l} to event-block's location loop-value is "%{_l}%" set {_yes} to true if {_yes} is true: set event-block to air remove location of event-block from {locations.sandpiege::*}

 

Essaye cela ( même si Azer_Flaash ne seras pas content :) )

 

on walk on sandstone:
   loop {locations.sandpiege::*}:
       set {_l} to event-block's location
       loop-value contains "%{_l}%"
       set {_yes} to true
   if {_yes} is true:
       set event-block to air
       remove location of event-block from {locations.sandpiege::*}

 

Pexu être aussi que le "loop-value is "%{_l}%" marche mais que le problème viens de

 

remove location of event-block from {locations.sandpiege::*}

 

Bonne soirée

Cordialement.

  • 0
Posté(e)

Salut à toi, ton code du début marche très bien je l'ai tester ! Sa doit surement venir de toi

En espérant avoir pus t'aider

 

Darkmariosan :)

 

Ton code:

command /piege:
   permission: op
   trigger:
       give player 1 sandstone named "&6Soul&lStone"

on place:
   if player is holding a sandstone named "&6Soul&lStone":
       add event-block's location to {locations.sandpiege::*}

on walk on sandstone:
   if "%{locations.sandpiege::*}%" contains "%location of event-block%":
       set event-block to air
       remove location of event-block from {locations.sandpiege::*}

on break of sandstone:
   if "%{locations.sandpiege::*}%" contains "%location of event-block%":
       remove location of event-block from {locations.sandpiege::*}

  • 0
Posté(e)
Je teste le code je te redit quoi :)

 

 

Après un test le block se set en air ect, tous va bien pour ma part.

Donc d'après LeCraftDeOuf, le problème viens de toi.

 

Pour ce bug ? j'en sais rien :/

×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.