AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_touch with a spawned env_sprite (https://forums.alliedmods.net/showthread.php?t=100486)

Bad_Bud 08-15-2009 01:07

register_touch with a spawned env_sprite
 
I have an env_sprite and it won't allow me to touch it after it's spawned. Is there a way around this other than spawning a dummy entity with no model in the same spot?

ConnorMcLeod 08-15-2009 03:24

Re: register_touch with a spawned env_sprite
 
Store that sprite index when you create it :

g_iSprite = create_entity("env_sprite")
register_touch("env_sprite", "player", "Sprite_Touch")

public Sprite_Touch( iSprite , id )
{
if( iSprite == g_iSprite )
{
// do stuff

-edit-
If the function is never called, try to make the sprite SOLID_TRIGGER

Bad_Bud 08-15-2009 04:02

Re: register_touch with a spawned env_sprite
 
Still doesn't work. I guess sprites don't allow touching for some reason.

It's easy to work around at least, but it uses twice as many entities, which kind of sucks.

I make a second entity with no model, basically just a size and a SOLID_TRIGGER, and I save the sprite's entid inside the EV_INT_team value so I can delete them both later by just referencing the "active" ent.

As far as the sprites are concerned, I had the sprite created with SOLID_BBOX for testing purposes, and I could dance on it and touch it and everything, but as soon as I spawned it (started the animation), it was no longer solid or touchable.

Arkshine 08-15-2009 04:03

Re: register_touch with a spawned env_sprite
 
Can you post your code ?

Bad_Bud 08-15-2009 04:05

Re: register_touch with a spawned env_sprite
 
I don't have the sprite only code anymore, I just have the code with the two entities working together.

You don't really need a source to try it though, just register a touch with env_sprite, make it animate, and I doubt you'll be able to get a touch out of it.

Hunter-Digital 08-15-2009 23:49

Re: register_touch with a spawned env_sprite
 
You need to set the sprite to SOLID_TRIGGER (or bbox, depends what youi want to do), set it's SIZE (mins and maxs) and also spawn it (eg: DispatchSpawn(ent) )... and should work.
I did that with a info_target with a sprite model, should work for env_sprite too

Bad_Bud 08-16-2009 01:24

Re: register_touch with a spawned env_sprite
 
It doesn't, I'm afraid. Once an env_sprite starts animating (DispatchSpawn), you can't change anything about it other than the fact it exists, and possibly its origin.

I couldn't even change the renderamt on it after it was spawned. It's there for good.


All times are GMT -4. The time now is 14:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.