Aller au contenu

Photo

The grand bunch(or more specifically... doing lots of things at the same time)


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Xeneize

Xeneize
  • Members
  • 133 messages

It has come that time where I am in need of doing loads of things simultaneously but how to achieve that exactly?

 

I understand the use of constants would be key here, but is there a way to tell a script to get a single waypoint and to create multiple things to it? What I am looking for is a script that will get all the waypoints in a certain area with the same name, and to apply a light, effect, create a pleaceable and if possible also a sound to it.

 

How would I go about this? Any tips from those that know what they're doing here?



#2
Tchos

Tchos
  • Members
  • 5 042 messages

Well, since as far as I know you can't spawn a light object, you have a couple of options for that:

  1. Place the light where you want it, and set it to disabled, and enable it with the script instead of creating it.  Since lights lose their tags, you'll get the nearest light object to the waypoint once you get the waypoint.
  2. Include the light in the effect you want to spawn.

I would embed the sound in the effect as well, because that ensures that it'll play with no problems, whereas I've had inconsistent results in getting sounds to play on objects.

 

At any rate, yes, there's nothing preventing you from creating multiple objects at the location of a single waypoint in a single script.  If you were spawning creatures, you might need to introduce a little roughness or delay to it or else the engine might consider the location to be blocked and refuse to spawn anything else there, but with an effect and a placeable that wouldn't be a problem.

 

You could open up the Halloween expansion for my BSoCC and look at the gravestone script.  I use waypoints to spawn effects in front of random gravestones, and then I spawn a dirt cloud effect and a dirt mound placeable when you start digging at it.



#3
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages

SFX will also have to be pre-placed in the area.  In the toolset, it would be easy enough just to make one set and then copy-paste to lay out your whole group.  Then you just have a script with a loop that goes through every waypoint with a certain tag, and then activates the light object and SFX nearest to each waypoint.

 

Be mindful that light object tags go away once a game's been saved and reloaded.



#4
Tchos

Tchos
  • Members
  • 5 042 messages

Sound objects would have to be pre-placed, but sounds embedded into a VFX can be spawned reliably.



#5
Dann-J

Dann-J
  • Members
  • 3 161 messages

Both VFX placeables and light objects can be spawned from blueprints. I frequently do both to light fires (campfires, torches, braziers, etc), or to create different coloured light inside cave entrances depending on the time of day (with an accompanying light beam VFX).

 

If you do want to repeatedly spawn and destroy lights objects, keep in mind the previous warnings; either store the light as a local object on the waypoint or ipoint, or use a 'get nearest' function (and hope the nearest light to your origin point is the one you want).



#6
Xeneize

Xeneize
  • Members
  • 133 messages

Will try this out guys, thank you!



#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

I actually have a script that does something similar to this. It runs as a heartbeat script from an ipoint in an area (it could run off the area HB itself), checking the time of day and turning on or off torches or braziers when appropriate. It loops through all placeables in the area and only processes those with a specific tag (ipoints with a tag of "nightlight"). I manually placed the light objects in the area, but the script spawns and destroys the VFX (getting the VFX blueprint from a local string on each ipoint). Each ipoint can use a different VFX if necessary, and is positioned exactly where the effect origin should be.

 

Script:

Spoiler