That was unrelated to your work, Im sorry, I had a wait(1); by mistake in the material event, which caused the functions to increase when i paused the game, forgive me.
Back on track, heres what Im doing at the top of my entity action:
Action tester_ent()
{
float4 *myFloatsArray = sys_malloc(sizeof(float) * 4); // only once!
my->skFloatArray = (var)myFloatsArray;
...
my.material = mtl_Hero; //---------Assign the Hero shader
while(1)
// changing the variable
myFloatsArray[0] = (float)my.x+random(200)-random(200);
myFloatsArray[1] = (float)my.y+random(200)-random(200);
myFloatsArray[2] = (float)my.z+random(200)-random(200);
myFloatsArray[3] = (float)0;
wait(1);
}
Here is the material event:
hero_event()
{
...
if (mtl->d3deffect == NULL) // no effect loaded?
return 1; // do not render
if (me == NULL) // not an actual entity?
return 0; // render as it is
LPD3DXEFFECT _fx = mtl->d3deffect;
float *_fArray = (float*)my->skFloatArray; // fill a float array, or retrieve a pointer to an array from the entity skill or whatever
_fx->SetVector("myFloats", _fArray);
//
return 0;
}
Is that correct?
This all doesnt crash until i add myFloats to the .fx file