how to detect spawned entity exist or not

hi everyone
can someone help me on this matter
for example i spawn an entety with these commands
void vSpawn;
setspawnentry("name", "test");
vSpawn = spawn();

after a while vSpawn Kills itseft
how i can realize from spawner that vSpawn still exist or not

thank you so much
 
Solution
hi everyone
can someone help me on this matter
for example i spawn an entety with these commands
void vSpawn;
setspawnentry("name", "test");
vSpawn = spawn();

after a while vSpawn Kills itseft
how i can realize from spawner that vSpawn still exist or not

thank you so much
@pedramtolo

The method I commonly use is by saving the entity into a variable and then checking with the "exists" entity property.

Saving the entity into a variable:
C:
void vSpawn;
setspawnentry("name", "test");
vSpawn = spawn();
setentityvar(getlocalvar("self"), "testEntity", vSpawn);

Detecting it:
C:
void main()
{
    void self       = getlocalvar("self");
    void testEntity = getentityvar(self, "testEntity");
    void...
hi everyone
can someone help me on this matter
for example i spawn an entety with these commands
void vSpawn;
setspawnentry("name", "test");
vSpawn = spawn();

after a while vSpawn Kills itseft
how i can realize from spawner that vSpawn still exist or not

thank you so much
@pedramtolo

The method I commonly use is by saving the entity into a variable and then checking with the "exists" entity property.

Saving the entity into a variable:
C:
void vSpawn;
setspawnentry("name", "test");
vSpawn = spawn();
setentityvar(getlocalvar("self"), "testEntity", vSpawn);

Detecting it:
C:
void main()
{
    void self       = getlocalvar("self");
    void testEntity = getentityvar(self, "testEntity");
    void exists     = getentityproperty(testEntity, "exists");

    if(testEntity != NULL() && exists){ //CHECK IF THE VARIABLE IS NOT NULL AND IF THE SAVED ENTITY EXISTS
        doSomething();
    }
}
 
Solution
Back
Top Bottom