Aller au contenu

Photo

SLS2 bug: usable & dual state placeable with a vfx


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

#1
kamal_

kamal_
  • Members
  • 5 260 messages
I think I've identified a bug in SLS2. Included in SLS2 are both usable and dual state (having both an on and an off version, such as the ghost lights) versions of placeables. However, there are no placables included that are both usable and dual state. In trying to create one, I came across a bug. By default, you can't have both usable and dual state, unless the placeable also has on and off hours assigned as a variable, it simply does not work. Without on/off hours, the placeable will correctly flip to the off state version, and the light will go out, but any vfx assigned to the placeable will remain. Net result, you turn out the campfire, but the fire itself remains.

If you give the placeable on/off hours, it will work correctly when you turn it off, removing the vfx. However it will of course go on and off by itself and the times you provided, which is normally not what you want if you're allowing it to be usable.

There is at least a partial workaround. You must set the on/off hours to both be 0 (setting them the same but not zero does not work, they must be 0 as this is a case defined in the scripts). In addition to adding on/off hour variables you're not going to use, you must assign a startState variable of "off". Assigning a startState of "on" and it will once again not remove the vfx.

Thus, if you wanted a usable dual state placeable with working vfx and no on/off hours, you must both assign the onHours and offHours (both ints) local variables, set them both to zero, and set the startState variable to "off". This will start the placeable correctly in the off state. If you want the placeable to be on when the players find it, you must start it off, and then turn it on somehow.
-------------------------------------------------------------------
I'll be looking into the scripting to see if I can fix that.

Modifié par kamal_, 03 août 2012 - 12:40 .


#2
Morbane

Morbane
  • Members
  • 1 883 messages
Nice work kamal_

It would be cool to have a chest flash (or something) when it is opened...

If I get you right - you're saying that might be possible?

#3
kamal_

kamal_
  • Members
  • 5 260 messages

Morbane wrote...

Nice work kamal_

It would be cool to have a chest flash (or something) when it is opened...

If I get you right - you're saying that might be possible?

? Chests have always been able to do that with the onOpen event.

Let me try again, since it's kind of hard to explain and I didn't do a good enough job.

SLS2 does some things in addition to just turning lights and sounds on or off based on various conditions. What's relevant here is it can turn on/off a visual effect, and it can swap out a placeable for another one. Slayster included a number of prefabs in the SLS2 package. Some of these take advantage of the turning on/off of vfx (such as the braziers, which get a fire effect when you light them). Others swap out on and off versions of a placeable, such as the ghost lights, where there is a different placeable for when the light is on. 

There are pc usable placeables that turn on/off the vfx (tiki torches and such), and there pc usable dual state placeables. However, there are no placeables in the pack that have all three abilities: are pc usable, turn on/off vfx, and are dual state.

Fortunately Slayster includes a readme that covers making new "light fittings", what Slayster calls any base placeable used with the system. Since there were no fittings that had the all three abilities, I wanted to make some. Unfortunately the readme is incorrect. One thing I discovered was that it says you can remove any local variables that won't be use (hours to turn on/off automatically in my case). The on/off variables turned out to be necessary despite my not being interested in making a light with on/off hours. Without the variables, the placeable did not behave properly (I forget exactly if they didn't switch the light or what exactly, but they didn't work).

Long bunch of testing rendered short: The placeable is usable, and it properly switches out for it's off state, but turning the placeable off does not turn off the vfx, what actually happens is the vfx is turned off and immediately back on. If you have the placeable start in the off state, it correctly starts without the vfx, and the vfx correctly starts and the placeable switches when you turn it on, turning it back off does not turn off the vfx. If the placeable starts on, turning it off also does not remove the vfx. Since if you remove the placeable swapping part, the vfx goes on and off correctly when used, there's the bug.

I'm getting the vfx being created on the off placeable even whe I remove variable on that placeable for the vfx. It shouldn't be playing the vfx in the off state, because no vfx is assigned to the off state.

Modifié par kamal_, 03 août 2012 - 11:05 .


#4
kamal_

kamal_
  • Members
  • 5 260 messages
I took a vid to explain. www.youtube.com/watch

Also, I've identified the source of the bug (and found and fixed another bug in the process). The function SLS2CopyVars in ginc_sls2 is used to copy variables when switching out dual state placeables, ensuring the placeable being swapped in (created from blueprint) has the same variables as the one you're replacing. It always copies the vfx variable. Which means the off blueprint, which does not have a vfx variable, gets a vfx variable added to it as part of the process of getting swapped in, resulting in the off placeable playing the vfx, since it has the variable.

Now to work out how to detect and work around it.

Modifié par kamal_, 04 août 2012 - 12:15 .


#5
bealzebub

bealzebub
  • Members
  • 352 messages
Oooohh, that's what yer talken about.
I only just now figured out what SLS2 was.

#6
Morbane

Morbane
  • Members
  • 1 883 messages
ok - i guess ive never thought about putting a sfx on a chest before - glad to know i dont need sls2 to do it ;)

#7
kamal_

kamal_
  • Members
  • 5 260 messages
ok, worked this out. The video shows the placeable swapping out and effects working properly, though it's hard to see the placeable swap directly (turn down your sound, I had bad music playing) www.youtube.com/watch

The off version of the placeable must be usable with hit points, and have dynamic collision on. It also needs the following scripts:
On Used: p_sls2_fitting_us
On User Defined: p_sls2_fitting_ud
and the following variables:
onBlueprint: (resref of the on version on the blueprint)
offBlueprint (resref of the on version off the blueprint)
startState (this needs to be set to "off")
vfxTag: (leave blank)

The on version needs the same properties and scripts, and the following variables:
lightTag: (set this on the actual placeable in your area, does not need to be set on the blueprint)
vfxTag: (set this on the actual placeable in your area, does not need to be set on the blueprint)
vfxBlueprint: (resref of the vfx you intend to use)
onBlueprint: (resref of the on version on the blueprint)
offBlueprint (resref of the on version off the blueprint)
startState (this needs to be set to "on")

What was happening was the readme didn't cover the situation. The off version of the placeables provided by SLS2 do not have the startState variable, and the readme didn't say it was necessary to add this variable to the off state for usable placeables when creating. The information was not in the section on making placeables work with the system, and was only deducible from the variable reference.