AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is it possible to attach a sprite to a non-player model? (https://forums.alliedmods.net/showthread.php?t=3229)

Geesu 06-30-2004 15:29

Is it possible to attach a sprite to a non-player model?
 
I know there is the TE_PLAYERATTACHMENT which allows you to attach a sprite to a player.

But can I spawn a model somewhere on a map (empty/blank). And then attach a sprite to it? Or am I just going to have to make my sprite into a model?

Josh

Ryan 06-30-2004 17:44

I believe with TE_PLAYERATTACHMENT, as the name states, you can only attach the sprites to a player, and not any entity.

However, you can attach a sprite or model to any entity with the following code.

Code:
new iEnt = create_entity( "someclassname" ); // .. do your entity properties here // here is where you want to set your offsets new Float:fOrigin[3]; entity_get_vector( iSomeOtherEnt, EV_VEC_origin, fOrigin ); // .. Offsets (here we'll use only a z-offset, so the model/sprite appears above the entity) fOrigin[2] += 20.0; entity_set_origin( iEnt, fOrigin ); // now set the entity to follow an existing entity entity_set_int( iEnt, EV_INT_movetype, MOVETYPE_FOLLOW ); entity_set_edict( iEnt, EV_ENT_aiment, iSomeOtherEnt );

Thing to note is that the really only reliable way to follow an entity is by giving it a z-coordinate only, since any x/y coord will not rotate with the player when their angles change.

Hope this helps.


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

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