Can infodecals be stored as handles?

Avatar
Goldenknighttim
182 Posts
Posted Jan 14, 2015
Hey, I've got another scripting question. I'm trying to place a decal and store it in an array:

function create_splat(position)
{
local new_splat = Entities.CreateByClassname("infodecal")
EntFireByHandle(new_splat, "AddOutput", "targetname splatdecal", 0, null, null)
EntFireByHandle(new_splat, "AddOutput", "LowPriority 1", 0, null, null)
EntFireByHandle(new_splat, "AddOutput", "texture paintblobs/blob_splat_stick", 0, null, null)
EntFireByHandle(new_splat, "AddOutput", "vscripts custom/linking-yellow/linking-yellow_gel.nut", 0, null, null)
new_splat.SetOrigin(position)
//The decal does not show up in the specified spot unless I use an entity maker and ignore this function.
//printl(new_splat.GetName())
::splat_list.append(new_splat)
}

Before this, I was trying the FindByNameWithin() function after creating it with an entity maker. Neither of these methods are storing any handle value in the variable. I'm starting to wonder if it's even possible to hold infodecals in a handle variable. I need to be able to change the names of the infodecals dynamically so I can set a texturetoggle up to switch the texture of dynamically specified infodecals. Has anyone else had problems with this, or can anyone see something wrong with my logic?

Advertisement
Registered users don't see ads! Register now!
Avatar
Goldenknighttim
182 Posts
Posted Jan 14, 2015
Replied 1 hour later
I was calling the function from the wrong spot. The infodecal is being created, but the addoutput entfires don't seem to be firing because when I use GetName() it comes up blank, and I can't see the decal image in the specified spot.
Edit: It's also not being added to the array, so still kinda the same problem.
Avatar
FelixGriffin
2,680 Posts
Posted Jan 15, 2015
Replied 17 hours later
According to the VDC, infodecal entities are removed immediately after "spraying" (either when the map loads or when given the Activate input).
Avatar
Goldenknighttim
182 Posts
Posted Jan 15, 2015
Replied 5 hours later
That would explain a lot, except for the fact that I can still use a texturetogglecon them after they have applied themselves to the wall.
Avatar
Skotty
671 Posts
Posted Jan 15, 2015
Replied 1 hour later
This might be because the toggle texture command applies global to all object using the given material.
Avatar
Goldenknighttim
182 Posts
Posted Jan 15, 2015
Replied 1 hour later
Ok, well something changed in how I was testing things that is now causing the decals to not be able to toggle texture. I'll have to try to find out why it was ever working in the first place. But It's really looking now like I'm not going to be able to choose specific decals to edit he way I hoped.. Thanks for your help guys.
Avatar
Skotty
671 Posts
Posted Jan 15, 2015
Replied 42 minutes later
info_overlay work like decals, but might be able to get manipulated in game. Take a look on them.
Avatar
Goldenknighttim
182 Posts
Posted Jan 15, 2015
Replied 11 minutes later
Yeah, I was working with those first. They are really difficult to place in calculated positions, and looks impossible because they each need a brush number to attach to, and a specific angle. My new plan is to create an info_target at the same place, and instead of toggling the texture, I'm going to place another decal over the same spot. If low priority is set to yes, it would probably replace one decal with the new one, and I can replace again when toggling back.
Avatar
Goldenknighttim
182 Posts
Posted Jan 17, 2015
Replied 1 day later
So I tried placing the second decal over the first, while both are set to low priority. The problem now is that the older decals are not going away. The 2 decals are exaclty the same size, and are in exactly the same place. From what I can tell about the LowPriority setting on infodecals from the Valve Developer Comunity, this should be removing the old decal. Does anyone have any idea why older decals are not being removed. Is there another way to remove decals?
Avatar
FelixGriffin
2,680 Posts
Posted Jan 18, 2015
Replied 1 day later
The low priority setting only applies when the number of decals placed exceeds the engine's limit. I think it's usually used for things like bullet holes (in HL2).
Avatar
Goldenknighttim
182 Posts
Posted Jan 18, 2015
Replied 13 minutes later
That's a shame. Thanks for explaining that though.
Avatar
Goldenknighttim
182 Posts
Posted Jan 18, 2015
Replied 18 minutes later
Got another idea I guess, does anyone know if there is a way to choose which frame an infodecal spawns at?
Avatar
TeamSpen210
608 Posts
Posted Jan 18, 2015
Replied 3 hours later
What you should try doing is create a template infodecal in some room, which has the texture and targetname set. Setup an env_entity_maker and point_template to spawn it, and then you can use the special entity_maker methods to spawn the decal at a position. Since it has a targetname, the entity should stay around until you send the activate input. That means you should be able to do AddOutput to set the targetname.
Avatar
Goldenknighttim
182 Posts
Posted Jan 18, 2015
Replied 3 hours later

TeamSpen210 wrote:
What you should try doing is create a template infodecal in some room, which has the texture and targetname set. Setup an env_entity_maker and point_template to spawn it, and then you can use the special entity_maker methods to spawn the decal at a position. Since it has a targetname, the entity should stay around until you send the activate input. That means you should be able to do AddOutput to set the targetname.

Thank you for your reply. I am already doing everything up untill the last sentence, "That means you should be able to do AddOutput to set the targetname." But I'm not sure why changing the name of the infodecal would help. I was changing the name at first because I wanted to detect decals in a radius, and find te decals within the same radius of each of those, and so on, then I wanted to toggle the texture of each of those. to do that, I would need a name. But the infodecals kill themselves after they sprey, so that doesn't help anymore.

Maybe it would help if I explain what I'm trying to do. I'm trying to create a gel that can be used as a dynamic antiline. You have a button, and a door. You try to find a way to place a line of this gel between the button and the door. You press the button, the gel connecting the button and the door turns from yellow to black, and opens the door. I have a gel bomb with a new gel texture. I have a couple of functions that finds the place of the impact, and use a entity_maker to place an infodecal and a info_target on that spot. The infodecal is the gel in it's black form. When a button is pressed, it calls a function that finds all info_targets with a specific name within a radius, and places the yellow gel splat decal over that, and changes the name of that info_target. Then it has the info_target call the same function, pretty much spreading the output along the gel. In that function, I plan to add a fireuser_1 output to any entity to activate anything. Deactivation shouldn't be too hard after this is working. My problem is that the extra gel splats covering each other are creating a lot of lag, placing the black gel over the yellow doesn't work, as it ends up under the yellow, so the gel won't 'deactivate', and when I start scripting clear gel to work with this, it won't be able to remove the gel.

My current idea for fixing this: I've noticed that when the gel splats are placed in the same spot over and over again under the dropper, lag isn't a problem. Also, when the black gel is placed over the yellow gel, it goes under the yellow gel, possibly as if it's replacing the black gel splat that is already under the yellow texture. I'm guessing that the lowpriority value does remove the texture beneath it and replace it with itself. With that assumption, I think that if that texture does have multiple frames, then if I were to spawn the same texture, but on the yellow frame over the black frame, or the black frame over the yellow frame, or an alpha frame over any of the others, I could change the texture of, or even remove the decal. That's why I'm asking if there is a way to spawn a texture at a specific frame. While writing this out, I've got an idea for how to do that that I'll be trying shortly. I'll post if it works. (I understand that this last method is a huge stretch and probably won't work, but I'm running out of ideas, and I've come so far with this.)

Edit: idea for starting decal on second frame didn't work, tried using the 'skin' value. Still looking for another way to start the decal on another frame.

Avatar
TeamSpen210
608 Posts
Posted Jan 19, 2015
Replied 4 hours later
What I was thinking is to then create an env_texturetoggle and addOutput that to allow you to change the texture frame of the decal. (This is if texturetoggles work on decals). In the script, take the decal/target origin and do something like (x % 64 * 64), which will round it to the nearest 64-unit multiple. Then you could have some logic to ensure only one toggle per "grid" section is created, which would help decrease entity spam.

Alternately, maybe something simpler would be to just not have the "gel" change colours at all. Just spawn in a bunch of particle systems / sprites at the targets, so they blend into each other and show the conduction path. You could also use env_beams.

Avatar
josepezdj
2,386 Posts
Posted Jan 19, 2015
Replied 2 hours later

Goldenknighttim wrote:
Got another idea I guess, does anyone know if there is a way to choose which frame an infodecal spawns at?

Goldenknighttim wrote:
Edit: idea for starting decal on second frame didn't work, tried using the 'skin' value. Still looking for another way to start the decal on another frame.

Well, there is a parameter for multi-framed textures that actually allows you to choose the first frame your texture will start at:

"$frame" "3" (it would start at the 3rd frame in this example)

I've used it only in those materials where I also added the material proxy "ToogleTexture", but I bet this works in any other texture since the VMT parameters are shader-parameters (not specific for material proxies), and as far as I tested, this param does work at least in UnliGeneric and LightmappedGeneric shaders materials.

Advertisement
Registered users don't see ads! Register now!
Avatar
Goldenknighttim
182 Posts
Posted Jan 19, 2015
Replied 9 hours later

TeamSpen210 wrote:
What I was thinking is to then create an env_texturetoggle and addOutput that to allow you to change the texture frame of the decal. (This is if texturetoggles work on decals). In the script, take the decal/target origin and do something like (x % 64 * 64), which will round it to the nearest 64-unit multiple. Then you could have some logic to ensure only one toggle per "grid" section is created, which would help decrease entity spam.

Alternately, maybe something simpler would be to just not have the "gel" change colours at all. Just spawn in a bunch of particle systems / sprites at the targets, so they blend into each other and show the conduction path. You could also use env_beams.

The only way to toggle a decal texture is to have a single overlay with that texture, or several with only one name, and toggle the texture on that. That will toggle every decal with that texture, possibly as a glitch. After I finish this gel, I will want to be able to wash it off. I can only do that by deleating a decal, replacing the decal with alpha, or covering the decal with another that looks exactly like the original brush texture, with the same position and scale. I believe the last is impossible. The first should be possible, but I can't figure out how. The second looks like my best chance at the moment. I've got another idea I'll try tonight when I have the chance. I wonder if all the gel splats are changed with the overlay glitch, then I spawn another splat, it might come out black, and when everything toggles back, it might toggle the one that's black to yellow. It's a bit of a streatch, but if it works, I'll be happy.

Edit: newest idea didn't work. When I toggle the texture, then create a new decal with the same texture, it is also toggles to the same thing. I'm gonna try thinking about this more, but I'm pretty stuck.