Jump to content

I am trying to make portals, but it is just not working.


tempera

Recommended Posts



First of all, I am not a native speaker, sorry for my english!

Although I code java, I am very new to skript, so this will probably be a trivial thing that I am missing here.

My code just will not set the variable and whenever I step on a portal it will say it does not have a target.

 

on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		set {portals.selectedPortal} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals.event-block} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals.event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player

 

Edited by tempera
Link to comment
Share on other sites

1 minute ago, tempera said:

Although I code java, I am very new to skript, so this will probably be a trivial thing that I am missing here.

My code just will not set the variable and whenever I step on a portal it will say it does not have a target.

 


on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		set {portals.selectedPortal} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals.event-block} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals.event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player

 

do {portals.%event-block%} as just doing event-block is different and wont work

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

Just now, tempera said:

I tried it and unfortunaly it still doesnt work.

1. if you're going to make multiple event-block locations inside a single variable, use a list variable (ex. {MyVariable::Extra::*}) the * at the end calls for everything in that extra list variable.

2. at the beginning use {portals.SelectedPortal} instead of {SelectedPortal} as this makes it think its its own variable

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

I changed to this and it still does not work:

 

on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		set {portals::selectedPortal::*} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals::event-block::*} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals::event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player

 

Link to comment
Share on other sites

1 minute ago, tempera said:

I changed to this and it still does not work:

 


on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		set {portals::selectedPortal::*} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals::event-block::*} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals::event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player

 

 

set {portals::selectedPortal::*} to event-player's location

Change this to "add {Portals::%{selectedPortal}%::*} to {selectedPortal}"

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

1 minute ago, tempera said:

I have changed it and it still doesn't work,

i have modified and it still also doesn't work.

 


add {Portals::%{selectedPortal}%::*} to event-player's location

 

can you send errors?

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		add {Portals::%{selectedPortal}%::*} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals::event-block::*} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals::event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player


 

Link to comment
Share on other sites

2 minutes ago, tempera said:

on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal settarget:
	permission: portal.settarget
	trigger:
		add {Portals::%{selectedPortal}%::*} to event-player's location
		send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {portals::event-block::*} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {portals::event-block}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player


 

as i said, do {portals::%event-block%::*} not {portals::event-block::*}

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

32 minutes ago, tempera said:

It still does not work. I would like for you to acctualy rewrite the code the right way so i can learn

Here ya go:
 

on break end portal frame:
	if event-player is sneaking:
		cancel event
		set {selectedPortal} to event-block's location
		send action bar "§b§lSelected portal! Do '/portal settarget' to set the portal target!" to event-player

command /portal <text>:
	usage: &b/Portal (SetTarget)
	permission: portal.settarget
	trigger:
		if arg-1 is "SetTarget":
			set {Portals::%{selectedPortal}%} to location of event-player
			send action bar "§b§lPortal target set! Now just walk over it!" to event-player

on walk on end portal frame:
	if {Portals::%event-block's location%} is not set:
		send action bar "§c§lThis portal does not have a target yet!" to event-player
		stop trigger
	teleport event-player to {Portals::%event-block's location%}
	play sound "entity.enderman.teleport" with volume 1 and pitch 1 to event-player

 

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Lifestealed | Minecraft Servers
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - Present

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...