Quick question

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

rick_Kraut

Member
Feb 20, 2020
12
1
3
25
Slapping a quick project together to entice some people into it,
but, I am not super familiar with skript, and I can't seem to either A, find what I am looking for, or B, the examples aren't clear enough for me

Using Skript 2.4.1, on 1.15.2 last time I checked.

What in particular are you looking for?
I am looking for two things,
1st I never really figured out if there was a way I could instance (have multiple of these Tesla coils that all function separately)
2nd figured out how to set up inventories, but, I still need to figure out how to make slots only accept a single type of item (slot will only accept diamonds for example and nothing else.

Here is what I got so far;

code_language.skript:
# Tesla skript, a simple area defense system; the purpose for this skript
# is to assign blocks as tesla coils, and their function for area defense.

# Currently this project depends on Skript 2.4.1, and SkQuery 4.1.2
command /loopstop:
   description: stops the loop
   executable by: players
   trigger:
       set {_stoploop} to false
       message "it should have stopped"

on rightclick on dropper with stick:
   set block at block 1 above event-location to iron bars
   set block at block 2 above event-location to iron bars
   set block at block 1 north 2 above event-location to iron bars
   set block at block 1 south 2 above event-location to iron bars
   set block at block 1 east 2 above event-location to iron bars
   set block at block 1 west 2 above event-location to iron bars
   set block at event-location to dropper named "&6Tesla Coil"
   set {tesla} to event-location
   message "%event-location%"
   message "wow you made a tesla coil"
# don't really know of a safer way of doing this, and of corse this doesn't survive restarts.
   set {_stoploop} to true
   while {_stoploop} is true:
       wait for 1 seconds
       if the distance between player and {tesla} is smaller than 7:
           message "prepare for damage"
           damage player by 1

# check if player right click's on a dropper with the lore "&6Tesla Coil",
# I am just using lore as a condition, there are most likely better methods to check for this.
on rightclick on dropper:
   if the clicked block is dropper named "&6Tesla Coil":
       cancel event
       open chest inventory with 4 row named "&6Tesla Coil" to player
       set cursor slot of player to air
       loop 36 times:
           if loop-number is between 11 and 13:
               format slot 36 of player with light gray stained glass pane named " " #dispite not actually having any impact, these do cause errors that bother me.
           else if loop-number is between 15 and 17:
               format slot 36 of player with light gray stained glass pane named " "
           else if loop-number is between 20 and 22:
               format slot 36 of player with light gray stained glass pane named " "
           else if loop-number is between 24 and 26:
               format slot 36 of player with light gray stained glass pane named " "
           else:
               format slot loop-number - 1 of player with light gray stained glass pane named " " to be unstealable
       format slot 8 of player with red stained glass pane named "help" to be unstealable

       # open slots on the left would be for ammo, open slots on the right would be for upgrades. unsure on approch for this
Apologies If my notes are too aggressive, trying to go for a particular result here.


TL;DR: need help inventory gui, and a way to have multiple instances of an object (preferably something that isn't a resource hog)

Edit 1: some spelling errors, and added version number
Edit 2: updated some code... again
 
Last edited:
Status
Not open for further replies.