ItzEarthy
(Itz Earthy)
October 30, 2023, 8:12pm
1
I am trying to use tags to have the specific prop hide and show randomly every 5 seconds.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
movedoor:=class(){
Device : movedoordevice
OurDoor : creative_prop
}
movedoordevice := class(creative_device):
@editable
OurDoors:[]creative_prop=array{}
OnBegin<override>()<suspends>:void=
Print("Begun")
On_Off()
On_Off():void=
loop:
RandomInt : int = GetRandomInt(0, 1)
if (RandomInt = 0):
OurDoor.Show() # Unknown identifier `OurDoor`
if (RandomInt = 1):
OurDoor.Hide() # Unknown identifier `OurDoor`
else:
break
Sleep<public>(5.0): #Error Here
robc
(robc_)
October 30, 2023, 9:00pm
2
I think there may be a few things that need to change.
Here’s an example that I think would work - it expects a single door, not an array (part of the code you provided assumed an array, part didn’t’).
Hopefully this helps you progress.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
movedoor:=class(){
Device : movedoordevice
OurDoor : creative_prop
}
movedoordevice := class(creative_device):
@editable OurDoor : creative_prop = creative_prop{}
OnBegin<override>()<suspends>:void=
Print("Begun")
On_Off()
On_Off()<suspends>:void=
loop:
RandomInt : int = GetRandomInt(0, 1)
if (RandomInt = 0):
OurDoor.Show()
if (RandomInt = 1):
OurDoor.Hide()
Sleep(5.0)
ItzEarthy
(Itz Earthy)
October 30, 2023, 9:49pm
3
@editable
OurDoors:[]creative_prop=array{}
Doesn’t need to be there. But there needs to be a connection to the verse tag because it needs to happen to every prop individually
robc
(robc_)
October 30, 2023, 9:59pm
4
If you’re wanting to discover them using game tags, then it’s something like this.
Here’s an example defining a tag called Tag_My_Tag.
Tag_My_Tag := class(tag){}
Once the above is compiled, you can assign the tag to objects in your map/world.
Here’s an example getting all creative_props with that tag.
aTaggedItems := GetCreativeObjectsWithTag(Tag_My_Tag{})
for (aItemRaw : aTaggedItems, aItem := creative_prop[aItemRaw]):
# You can now use aItem, such as with Hide()/Show()
aItem.Hide()
Hope it helps…
ItzEarthy
(Itz Earthy)
October 30, 2023, 10:49pm
5
OK, I tried that, but now it only works for one of the tagged actors. I want this to go on constantly
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
door_tag:= class(tag) {}
movedoordevice := class(creative_device):
@editable var Timeing : float = 0.0
OnBegin<override>()<suspends>:void=
Print("Begun")
On_Off()
On_Off()<suspends>:void=
TaggedList := GetCreativeObjectsWithTag(door_tag{})
Print("Tagged Actors: {TaggedList.Length}")
for (TaggedActor : TaggedList, DoorPop := creative_prop[TaggedActor]):
loop:
RandomInt : int = GetRandomInt(0, 1)
Print ("{RandomInt}")
if (RandomInt = 0):
DoorPop.Show()
if (RandomInt = 1):
DoorPop.Hide()
else:
Sleep(Timeing)
ItzEarthy
(Itz Earthy)
October 31, 2023, 12:32am
6
Solution
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
door_tag:= class(tag) {}
movedoordevice := class(creative_device):
@editable var Timing : float = 0.0
@editable var Debug : logic = false
OnBegin<override>()<suspends>:void=
Print("Begun")
On_Off()
On_Off()<suspends>:void=
TaggedList := GetCreativeObjectsWithTag(door_tag{})
if(Debug = true):
Print("Tagged Actors: {TaggedList.Length}")
for (Index->TaggedActor : TaggedList, DoorProp := creative_prop[TaggedActor]):
if(Debug = true):
Print("Door: {Index}")
spawn{LoopFuntion(DoorProp)}
LoopFuntion(DoorProp : creative_prop)<suspends>:void=
loop:
RandomInt : int = GetRandomInt(0, 1)
if(Debug = true):
Print ("{RandomInt}")
if (RandomInt = 0):
DoorProp.Show()
if (RandomInt = 1):
DoorProp.Hide()
else:
Sleep(Timing)
system
(system)
Closed
November 30, 2023, 12:33am
7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.