Thank you for your ideas, i will try it.
You are right i should have added more details. I have this situation.
The entities i mentioned are remote triggered explosives. The action sets several skills set the damage, delay, aoe etc. I store the pointer of this entity in a skill of the detonator-entity.
I want to detonate it by setting one of its flags to 1 and then execute the explosion function.
The problem is this function contains an ent_create function, and it is necessary that the you pointer for the created entity is set to the explosive and not to the detonator.
I will try to get my code in a readable state and post it here. Ok i dont have access to my computer right now, so i will just post a general example
-- EDIT --
1. The Detonator
void trigger_explo(ENTITY* explosive) // Will set the Flag of the saved entity to 1
{
[...]
set(explosive,FLAG1);
[...]
}
action detonator() // Has stored all explosives-pointer in its entity-skills
{
[...]
my.skill1 = spawn_explosive(); // create explosive and save its pointer
while(1)
{
[...]
if(i_want_to detonate) // check if eg. button for detonation is pressed
{
trigger_explo((ENTIY*) my.skill1);
[...]
}
wait(1);
}
}
2. The Explosive
void detonate_ent() // aoe damage and shrapnelspawning
{
[...]
ent_create("shrapnel.mdl",my.x,shrapnel_func);
//you.parent = me;
}
void explosive_ent()
{
[...]
set_stats_from_other_source(source); // With this function i save the stats of the explosive and the generated shrapnels in skills of this entity
while(1)
{
if(is(my,FLAG1)){detonate_ent();} // i just would like to avoid many entities with short loops that check only for one changing flag
wait(1);
}
}
3. The Shrapnel
void set_stats_from(ENTITY* from) // all properties of the shrapnel are save in skills in the explosive_entiy
{
my.skill10 = from.skill10;
}
void shrapnel_func()
{
set_stats_from(you); // get stats from your creator
[...]
while(1)
{
do_stuff();
wait(1);
}
}
I know i can avoid the whileloop if i run detonate_ent() inside the detonator action. But then you would point to the detonator and not the explosive.
It would work if i save the stats in detonator.skills instead of explosive.skills, but i want to avoid that if possible, cause i dont have enough free skills if i want to support the number of explosives i need.
I hope my idea is now better to understand and i thank you for ideas / answers.
Regards