AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Spawning a smoke cloud in the map (https://forums.alliedmods.net/showthread.php?t=340500)

GoldNux 11-22-2022 06:08

Spawning a smoke cloud in the map
 
I'm not sure how this works so an explanation along with an example would be great.
I figured I needed an entity to spawn the cloud, but I'm not sure which entity is invisible and does not clip the player.

PHP Code:

new Float:g_origin[3] = {1247.9687502560.031250132.031250}
new 
Float:g_angle[3] = {0.00.00.0};
new 
iEntity create_entity("info_target");
engfunc(EngFunc_PlaybackEvent0iEntity260.0 g_origing_angle0.00.00100); 

Thanks!

kww 11-22-2022 08:58

Re: Spawning a smoke cloud in the map
 
Quote:

Originally Posted by GoldNux (Post 2793410)
... but I'm not sure which entity is invisible and does not clip the player

upd2: I just copied what you posted, sorry

I'm a lamer in theme of entities but info_target is what you need: it is invisible and is not solid

upd: this seems to work
PHP Code:

// summon smoke at player position
public ClCmd_test(id)
{
    new 
iEntity create_entity("info_target");
    if( 
iEntity ) {
        new 
float:fOrigin[3];
        
pev(idpev_originfOrigin);
        
engfunc(EngFunc_PlaybackEventFEV_GLOBALiEntity260.0 fOrigin, {0.00.00.0}, 0.00.00100);
        
remove_entity(iEntity);
    }
}

// summon smoke at desired position
public ClCmd_test2(id)
{
    new 
iEntity create_entity("info_target");
    if( 
iEntity ) {
        
engfunc(EngFunc_PlaybackEventFEV_GLOBALiEntity260.0 , {1247.9687502560.031250132.031250}, {0.00.00.0}, 0.00.00100);
        
remove_entity(iEntity);
    }



GoldNux 11-22-2022 14:40

Re: Spawning a smoke cloud in the map
 
Quote:

Originally Posted by kww (Post 2793424)
upd2: I just copied what you posted, sorry

I'm a lamer in theme of entities but info_target is what you need: it is invisible and is not solid

upd: this seems to work
PHP Code:

// summon smoke at player position
public ClCmd_test(id)
{... 


Wow thanks! This is so much fun.
One question, can I emit sound from the entity?

I tried to look at it but I'm not sure how to find the entity index.

kww 11-23-2022 08:52

Re: Spawning a smoke cloud in the map
 
Quote:

Originally Posted by GoldNux (Post 2793467)
Wow thanks! This is so much fun.
One question, can I emit sound from the entity?

Sure.

Upd: example below should work in theory but is not working for me xd

Quote:

Originally Posted by GoldNux (Post 2793467)
I tried to look at it but I'm not sure how to find the entity index.

Entity index is the index of that info_target
E.g.:
PHP Code:

public plugin_precache()
{
    
precache_sound("weapons/sg_explode.wav");
}

if(
placeSmoke)
{
    new 
iEntity create_entity("info_target");
    if(
iEntity)
    {
        
entity_set_origin(iEntityorigin1);
        
emit_sound(iEntity CHAN_WEAPON"weapons/sg_explode.wav"VOL_NORMATTN_NORM0PITCH_NORM);
        
engfunc(EngFunc_PlaybackEventFEV_GLOBALiEntity260.0 origin1, {0.00.00.0}, 0.00.00100);
        
        
entity_set_origin(iEntityorigin2);
        
emit_sound(iEntity CHAN_WEAPON"weapons/sg_explode.wav"VOL_NORMATTN_NORM0PITCH_NORM);
        
engfunc(EngFunc_PlaybackEventFEV_GLOBALiEntity260.0 origin2, {0.00.00.0}, 0.00.00100);
        
        
remove_entity(iEntity);
    }




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

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