AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sprite Solid? (https://forums.alliedmods.net/showthread.php?t=336340)

Arje 02-13-2022 01:02

Sprite Solid?
 
Hi, I wanted to know if it is possible to make the created sprite remain solid, and can make other players touch it?

PHP Code:

public fireshot(id)
{
   
// Get position from eyes
    
new aimvec[3]
    
get_user_origin(idaimvec3)
    
// Throw fire
    
fireEffects(idaimvec)
}

public 
fireEffects(idaimvec[3])
{

   
// Fire - this way it's just a sprite but it is not solid
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(3)
    
write_coord(aimvec[0])
    
write_coord(aimvec[1])
    
write_coord(aimvec[2])
    
write_short(gSpriteBurning)
    
write_byte(22)
    
write_byte(10)
    
write_byte(0)
    
message_end()


    
// this way is the solid sprite but it is seen with all the black background of the sprite
     
new Float:vOrigin[3]
    
vOrigin[0] += aimvec[0]
    
vOrigin[1] += aimvec[1]
    
vOrigin[2] += 30.0
    
    
new amaterasuaowner id
    
new amaterasu create_entity("info_target")
    
entity_set_string(amaterasuEV_SZ_classname"amaterasu"
    
entity_set_model(amaterasu"sprites/shmod/blue_flame.spr")     
    
entity_set_size(amaterasuFloat:{-2.5, -2.5, -1.5}, Float:{2.52.51.5})
    
entity_set_edict(amaterasuEV_ENT_owneramaterasuaowner)
    
entity_set_int(amaterasuEV_INT_solid2)
    
entity_set_int(amaterasuEV_INT_movetype6)
    
entity_set_vector(amaterasuEV_VEC_originvOrigin)




Natsheh 02-13-2022 04:19

Re: Sprite Solid?
 
create_entity("info_target")

:arrow:

create_entity("env_sprite")


Then add

entity_set_int(amaterasu, EV_INT_rendermode, kRenderTransTexture);
entity_set_float(amaterasu, EV_FL_renderamt, 255.0);

Arje 02-13-2022 10:44

Re: Sprite Solid?
 
First thanks again for the help and guidance

i try this, but the black background was still
PHP Code:

entity_set_int(amaterasuEV_INT_rendermodekRenderTransTexture);
entidad_set_float(amaterasuEV_FL_renderamt255.0); 

so i try, and now remove the black background, but the animation of the sprite is not done, is it possible to do it?

PHP Code:

new Float:vOrigin[3]
    
vOrigin[0] += aimvec[0]
    
vOrigin[1] += aimvec[1]
    
vOrigin[2] += aimvec[2]
    
    new 
amaterasuaowner id
    
new amaterasu create_entity("env_sprite")
    
    
entity_set_string(amaterasuEV_SZ_classname,"amaterasu")
    
entity_set_model(amaterasu,"sprites/shmod/blue_flame.spr")
    
entity_set_int(amaterasuEV_INT_solid2// solid
    
    // I wanted to remove this to see if it made the animation but no
    //entity_set_int(amaterasu, EV_INT_movetype, MOVETYPE_NONE) // don't move
    
    
entity_set_edict(amaterasuEV_ENT_owneramaterasuaowner)
    
entity_set_int(amaterasuEV_INT_rendermodekRenderFxNoDissipation);
    
set_rendering(amaterasukRenderFxNoDissipation02550kRenderGlow255// put this to remove the black background of the sprite
    
    
entity_set_origin(amaterasuvOrigin// put your origin here : Float:{X , Y , Z}
    
entity_set_vector(amaterasuEV_VEC_originvOrigin

I don't know if you can see it in the image, but the size of the sprite is blue, green is what I do with the code, I would like it to be like blue

https://i.pinimg.com/564x/18/2f/dd/1...f93de29b0c.jpg

Arje 02-13-2022 11:14

Re: Sprite Solid?
 
well i found the solution find the solution to achieve the animation:

PHP Code:

entity_set_float(amaterasuEV_FL_animtime1.0// I'm not entirely sure about this, but I think it is the time in which the sprite will animate.
    
entity_set_float(amaterasuEV_FL_framerate1.0// Frames per second.
    
entity_set_int(amaterasuEV_INT_spawnflagsSF_SPRITE_STARTON// Essential if the animation is playing, I think.
    
dllfuncDLLFunc_Spawnamaterasu 

but how can I increase the size of the sprite so that the green is more similar to the blue?

Natsheh 02-13-2022 11:20

Re: Sprite Solid?
 
Using engine entity_set_float(amaterasu, EV_FL_scale, 2.0); // 2.0 is double the sprite size.

Arje 02-13-2022 12:18

Re: Sprite Solid?
 
Thanks!
but i have another question, I realized that the green flame is not generated on the floor, as if the blue one does, how can I solve this?

i try drop_to_floor(amaterasu) but it didn't do anything, and i guess it's not the solution either

Natsheh 02-13-2022 15:53

Re: Sprite Solid?
 
make the entity MOVETYPE_TOSS then use the function drop_to_floor

Arje 02-13-2022 16:42

Re: Sprite Solid?
 
thanks but it didn't work either, but i realized i could do this:

PHP Code:

vOrigin[2] += aimvec[2

to
PHP Code:

vOrigin[2] += aimvec[2] + 60 

now it displays correctly as I want, I don't know if it's the best way but it works for me, thanks again for the help.

Natsheh 02-13-2022 16:50

Re: Sprite Solid?
 
You're very welcome.

You probably need to change the entity move type after you spawn the entity with DLLFunc_Spawn


All times are GMT -4. The time now is 11:35.

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