Raised This Month: $ Target: $400
 0% 

register_touch with a spawned env_sprite


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-15-2009 , 01:07   register_touch with a spawned env_sprite
Reply With Quote #1

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?
__________________
Bad_Bud is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-15-2009 , 03:24   Re: register_touch with a spawned env_sprite
Reply With Quote #2

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
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-15-2009 at 03:33.
ConnorMcLeod is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-15-2009 , 04:02   Re: register_touch with a spawned env_sprite
Reply With Quote #3

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.
__________________
Bad_Bud is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2009 , 04:03   Re: register_touch with a spawned env_sprite
Reply With Quote #4

Can you post your code ?
__________________
Arkshine is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-15-2009 , 04:05   Re: register_touch with a spawned env_sprite
Reply With Quote #5

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.
__________________
Bad_Bud is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-15-2009 , 23:49   Re: register_touch with a spawned env_sprite
Reply With Quote #6

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
__________________
Hunter-Digital is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-16-2009 , 01:24   Re: register_touch with a spawned env_sprite
Reply With Quote #7

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.
__________________
Bad_Bud is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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