#custom mob spawning

1 messages · Page 1 of 1 (latest)

fallen loom
#

its not working line 30 and 26 errors

hearty imp
#

So, that's only 25 lines, there

hoary field
#

So we cant help with either lol

#

Format your code too please

fallen loom
#

It was discord prob messed it up

fallen loom
#

can anyone help?

hoary field
#

No

#

You literally havent shown the code with errors (or even the errors themselves)

fallen loom
#

worry about magma spawn skript

hoary field
#
  1. The issue for those is ypu need to double quotes inside a string: send “Bon said “”hello”” to Fred” to player
  2. You need % around variables in strings, another AI mistake
  3. Line 18 is absolute gibberish syntax. Like im surprised AI messed up that much. Doesnt resemble skript or anything i know of
fallen loom
#

itd json

hoary field
#

I just realised AI is using an escape character for the quotes lol.

fallen loom
#

k lets start over i have a few skripts that i need help i added commens for readability here is a mob switch i want to be able to allow only certain mobs here

# Whitelisted mobs
options:
    # Proper list format (one per line with - OR space-separated in [])
    allowedMobs: pig, creeper, magma_cube

on spawn of living entity:
    set {_mobType} to type of entity

    # Ignore dropped items and armor stands
    if {_mobType} is dropped item or armor stand:
        stop

    # Ignore Shopkeepers (custom name or plugin entities)
    if name of entity is set:
        if name of entity is set by player:
            stop

    # If not whitelisted, cancel spawn
    if {_mobType} is not in "{@allowedMobs}":
        cancel event
#

here is the magma spawning thing i used rgb birdflob for a gradiant here so thats the json i can change format if neede

options:
    spawn-cap: 20
    spawn-count: 5
    x1: -3
    y1: 166
    z1: 8
    x2: -23
    y2: 182
    z2: -34

every 10 seconds:
    set {_current} to size of all magma cubes in world "world"

    if {_current} < {@spawn-cap}:
        set {_toSpawn} to {@spawn-count}
        if {_current} + {_toSpawn} > {@spawn-cap}:
            subtract {_toSpawn} by ({_current} + {_toSpawn} - {@spawn-cap})
        
        loop {_toSpawn} times:
            set {_x} to random number between {@x2} and {@x1}
            set {_y} to random number between {@y1} and {@y2}
            set {_z} to random number between {@z2} and {@z1}
            set {_size} to random integer between 1 and 3
            
            execute console command "/summon magma_cube {_x} {_y} {_z} {CustomName:'[{\"text\":\"N\",\"color\":\"dark_red\"},{\"text\":\"e\",\"color\":\"red\"},{\"text\":\"t\",\"color\":\"gold\"},{\"text\":\"h\",\"color\":\"yellow\"},{\"text\":\"e\",\"color\":\"green\"},{\"text\":\"r\",\"color\":\"aqua\"},{\"text\":\" \",\"color\":\"white\"},{\"text\":\"S\",\"color\":\"dark_blue\"},{\"text\":\"e\",\"color\":\"blue\"},{\"text\":\"n\",\"color\":\"dark_purple\"},{\"text\":\"t\",\"color\":\"light_purple\"},{\"text\":\"i\",\"color\":\"white\"},{\"text\":\"n\",\"color\":\"gray\"},{\"text\":\"e\",\"color\":\"dark_gray\"},{\"text\":\"l\",\"color\":\"black\"}]',CustomNameVisible:1b,Health:40,Attributes:[{Name:maxHealth,Base:40}],Size:{_size}}"
#

here is the spawn script

# spawn.sk
options:
  spawnX: 71.990
  spawnY: 163
  spawnZ: -170.005
  spawnWorld: "world"

command /spawn:
  trigger:
    if {combat.%player%} > 0:
      send "&cYou cannot use /spawn while in combat!"
      stop
    set {spawn.pending.%player%} to true
    set {spawn.start.%player%} to location of player
    send "&eDon't move for &f3s &eto teleport to spawn..."
    wait 3 seconds
    if {spawn.pending.%player%} is true:
      if distance between location of player and {spawn.start.%player%} <= 0.2:
        teleport player to location at {@spawnX}, {@spawnY}, {@spawnZ} in world {@spawnWorld}
        send "&aTeleported to spawn!"
      else:
        send "&cYou moved! Teleport cancelled."
    delete {spawn.pending.%player%}
    delete {spawn.start.%player%}

on move:
  if {spawn.pending.%player%} is true:
    set {spawn.pending.%player%} to false

ill send ss for all the issues

#

k idk what that was lemme resend

#

k idk why its not letting me ss right but thats all the code

#

u still here?

hoary field
# fallen loom k lets start over i have a few skripts that i need help i added commens for read...
  1. You did not add comments, AI did. We ca. tell which of the chunks are yours as they have no comments lol
  2. You haven’t fixed the issues already pointed out
  3. Just spawn the magma cube and set its name with skript. 2 simple lines instead of an absolutely massive console command. Console commands are only for things that can only be done there not through skript
  4. Use list variablws and UUIDs. {spawn.pending.%player%} -> {spawn.pending::%player’s UUID%}
fallen loom
#

y r u being so passive agressive? im just asking for help

#

also i want the name to be a gradiant thats the massive console command

hoary field
#

You can do that in skript too

fallen loom
hoary field
#

With skbee i think. You can search for “gradient” on the docs https://skripthub.net/docs

fallen loom
#

k

#

no i don't see it

hoary field
#

might be on the skbee wiki then. A quick search for "gradient" within this discord gives this though,
<gradient:##C31161:##FD8B00>

fallen loom
#

ok so i remade the magma thing again and i still can't get it to work can i plz get some help i got skbee as well

#
options:
  spawn-cap: 10
  spawn-count: 2
  interval-seconds: 10
  player-radius: 30
  spawnWorld: world

  x1: -23
  y1: 166
  z1: -34
  x2: -3
  y2: 182
  z2: 8

  magma-name: "&x&D&0&0&A&0&AN&x&D&3&1&1&0&9e&x&D&7&1&9&0&9t&x&D&A&2&0&0&8h&x&D&D&2&8&0&7e&x&E&1&2&F&0&6r &x&E&8&3&E&0&5S&x&E&B&4&5&0&4e&x&E&E&4&D&0&4n&x&F&2&5&4&0&3t&x&F&5&5&C&0&2i&x&F&8&6&3&0&1n&x&F&C&6&B&0&1a&x&F&F&7&2&0&0l"

every {@interval-seconds} seconds:
    set {_cx} to (({@x1} + {@x2}) / 2)
    set {_cy} to (({@y1} + {@y2}) / 2)
    set {_cz} to (({@z1} + {@z2}) / 2)

    set {_near} to false
    loop all players:
        if distance between location of loop-player and location at {_cx}, {_cy}, {_cz} <= {@player-radius}:
            set {_near} to true
            stop loop
    if {_near} is false:
        stop

    set {_count} to 0
    loop all entities in world {@spawnWorld}:
        if loop-entity is magma cube:
            if loop-entity has tag "MagmaSentinel":
                add 1 to {_count}

    if {_count} >= {@spawn-cap}:
        stop

    set {_toSpawn} to {@spawn-count}
    set {_space} to {@spawn-cap} - {_count}
    if {_toSpawn} > {_space}:
        set {_toSpawn} to {_space}

    loop {_toSpawn} times:
        set {_x} to random integer between {@x2} and {@x1}
        set {_y} to random integer between {@y1} and {@y2}
        set {_z} to random integer between {@z2} and {@z1}
        set {_size} to random integer between 1 and 3

        spawn 1 magma cube at location at {_x}, {_y}, {_z} in world {@spawnWorld}
        set {_ent} to last spawned entity

        # tag & name
        add tag "MagmaSentinel" to {_ent}
        set display name of {_ent} to {@magma-name}
        set custom name visible of {_ent} to true

        set max health of {_ent} to 40
        set health of {_ent} to 40
#
   try:
            set size of {_ent} to {_size}
        catch:
            execute console command "data merge entity %{uuid of {_ent}}% {Size:%{_size}%}"
        try:
            set attack damage of {_ent} to 5
        catch:
            execute console command "data merge entity %{uuid of {_ent}}% {Attributes:[{Name:\"generic.attackDamage\",Base:5.0}]}"

on death of magma cube:
    if victim has tag "MagmaSentinel":
        clear drops
        drop 1 magma cream named "&4Magma Tokens" at location of victim
#

plz help

hoary field
#
  1. You can use loop all players in radius {@player-radius} around location({_cx}, {_cy}, {_cz}): (or even just check the size)
  2. i have never seen try/catch in skript before...
fallen loom
#

i am a java programmer i assumed it would work