So...
The problem is...whatever I want to spawn an actor with A_SpawnItemEx and set a random angle (0 - 359) his initial direction angle changes but right afterwards, he returns his original spawn direction movement...moving to (again) one specific direction...it's very frustating, since I've made a "hacky" system in spawning invisible dummy actors from other actors with extreme speed to wander about the map and finally spawning another one. It was meant to be dynamic and random, but it's complicated when they have a tendency to go to one specific direction in their initial spawn state.
Here are the images

The arrow indicates their initial tendency to go


You can see by the last two images what really happens...
and finally the code to the dummy actors
Code: Select all
//This one i've put in the PostBeginPlay of the five visible actors on the screen
A_SpawnItemEX("Dummy_SentrySpawner", 0.0, 0.0, 0.0, 0, 0, 0, random(0, 359.9), SXF_NOCHECKPOSITION);
/////////////////////////
//THIS IS THE INVISIBLE DUMMY SPAWNER
Class Dummy_SentrySpawner : Actor
{
int Wander_Timer;
Default
{
// PROPERTY
Health 999999;
Radius 12;
Height 50;
Speed 50; //999
MaxDropOffHeight 48; //x2.0
MaxStepHeight 48; //x2.0
// FLAGS
//MONSTER;
-SOLID;
+ISMONSTER;
+THRUACTORS;
-COUNTKILL;
-SHOOTABLE;
-CANUSEWALLS;
-CANPUSHWALLS;
-ACTIVATEMCROSS;
+NOTELEPORT;
}
States
{
Spawn:
TNT1 A 1 A_Wander;
TNT1 A 0 A_SentryCanSpawn();
TNT1 A 0
{
Wander_Timer++;
if(Wander_Timer == 35) // 1 secs overall in "frozen" time
{
Destroy(); //Removes if he doesn't met conditions until then.
}
}
Loop;
SpawnSentry:
TNT1 A 0 A_SpawnItemEx("WehrmachtSentryGunBase", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
Stop;
}
Void A_SentryCanSpawn()
{
if(!CheckProximity("Dummy_SentrySpawner", 1024, 1, CPXF_ANCESTOR|CPXF_CHECKSIGHT) && !CheckProximity("WehrmachtSentryGunBase", 1024, 1, CPXF_ANCESTOR|CPXF_CHECKSIGHT) && GetZAt(256, 0) == floorz &&
GetZAt(-256, 0) == floorz && GetZAt(0, 256) == floorz && GetZAt(0, -256) == floorz)
{
SetStateLabel("SpawnSentry");
}
else
{
return;
}
}
override void PostBeginPlay()
{
super.PostBeginPlay();
// Set Wander timer to 0 so it can count the steps until enough
int Wander_Timer = 0;
}
}