Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
While sprites are flat, they do show movement. Perhaps, a variety of movement gives an illusion of depth and life. Does changing a sprite angle add anything extra? This is the concept behind Lookers. Basically when a monster is spawned instead of dancing in place like it has a full bladder it also turns this way and that as though looking for something.
class lookers_EventHandler : EventHandler
{
PlayerInfo player;
Array<Actor> monsters;
ThinkerIterator MonsterFinder;
int tCount;
int spDir;
void findMonsters(float distance)
{
monsters.Clear();
Actor mo;
MonsterFinder.Reinit();
spDir = spDir == 15 ? -15 : 15;
while (mo = Actor(MonsterFinder.Next()))
{
// note that Spawn is not detected by InStateSequence
if (mo.bIsMonster && !mo.InStateSequence(mo.CurState, mo.ResolveState("Missile")))
{
float d = player.mo.Distance3D(mo);
if (d < distance)
{
mo.A_SetAngle(mo.angle + spDir, SPF_INTERPOLATE);
monsters.Push(mo);
}
}
}
// console.printf("Monsters found: %d, direction: %d", monsters.Size(), spDir);
}
override void WorldTick()
{
if (tCount < 70) // speed of change
{
tCount++;
}
else
{
findMonsters(1024);
tCount = 0;
}
}
override void PlayerSpawned(PlayerEvent e)
{
tCount = 0;
spDir = 15;
MonsterFinder = ThinkerIterator.Create("Actor");
player = players[e.PlayerNumber];
}
}
How this works is simple. Every 70 ticks a ThinkerIterator finds all monsters within 1024 distance. So long as the state isn't Missile, the monster angle is changed +/- 15 degrees. So when just spawned and A_Look is called, for example, a monster actually looks from side to side. Likewise when chasing it appears to look around.
This is rough and may have problems, although so far I like how it looks. The angle is changed within a perimeter, and I've no idea if it resets to a standard sprite angle once the player moves away (my guess is yes). Since I'm not tracking individual angles (for now pointers are added to an array until I decide) directions toggle back and forth, which can create a weird choreography. InStateSequence seems buggy (it doesn't detect Spawn, for one); for the present it seems OK to exclude Missile, since it makes sense in those cases that a monster face the player.
Still pondering...
Update 12/7/21
Spoiler:
Wondering if it's possible to make a sprite tilt to look up or down, I played with that using A_SetPitch(). Interestingly, making monsters a FLATSPRITE with a pitch of -90 turns them into literal cutouts. This may be a good way to create a door, shutter, or some kind of other object. Didn't work here of course.
I ended up using A_SetScale() to randomly change Y slightly. This makes it seem like a monster is "stretching" to look around. I'm still experimenting with this, but it seems to work. I also added dummy inventory items called xLooker and yLooker, each with Inventory.MaxAmount of 2. The number of these items in inventory determines the direction of movement. Possibly these two inventory items can create more complex directional animation.
Or type "developer 2" at the console. That will put set developer mode to "warnings" level and that will probably do you too.
I usually keep developer mode at 2 because I spend as much time working on mods as I do playing them and I also like to see if any mods I play are flagging up important or interesting warnings.
thugsta wrote:Weird, i do some mod work too but never knew of this command. Thanks.
bug2.jpg
Is this right now?
Interesting. I don't see a crash playing "The Focus." There's nothing specific in this error, but the previous seems to refer to another script. Is it a different mod, I wonder? It still could be mine, just wondering.
@thugsta - if you mean this Real Elevators, then you can eliminate it from your load order. Real Elevators is a modder's resource and does nothing on its own; I will update my thread to make that clear, sorry for any confusion
Nero wrote:@thugsta - if you mean this Real Elevators, then you can eliminate it from your load order. Real Elevators is a modder's resource and does nothing on its own; I will update my thread to make that clear, sorry for any confusion
Dang it, I was hoping it was usable as is from the usage description. Some acceleration would of been good on some of these big elevators in these custom maps with long rides, reminds me of Mass Effect all over again lol.
I've played this a few times using Lookers on MAP04, died, no errors.
No problems with all other mods loaded. I did get a similar error once that I couldn't reproduce. My guess is this is some conflict in using a null pointer. My code, for example, refreshes the looker but doesn't check after to see if the pointers aren't null.
Actor mo;
MonsterFinder.Reinit();
while (mo = Actor(MonsterFinder.Next()))
{
// note that Spawn is not detected by InStateSequence
if (mo.bIsMonster && !mo.InStateSequence(mo.CurState, mo.ResolveState("Missile")))
{
Not sure if this should be mo && mo.bIsMonster && etc. although I haven't seen a need so far for this. I suppose it's possible in addressing these during a firefight that one could be wiped out. I'm capturing everything not "Missile." Hmm... Probably should also exclude the Death states. The reason I've excluded Missile is because InStateSequence doesn't seem to work with Spawn.
Hey Doomer wrote:I've played this a few times using Lookers on MAP04, died, no errors.
No problems with all other mods loaded. I did get a similar error once that I couldn't reproduce. My guess is this is some conflict in using a null pointer. My code, for example, refreshes the looker but doesn't check after to see if the pointers aren't null.
Actor mo;
MonsterFinder.Reinit();
while (mo = Actor(MonsterFinder.Next()))
{
// note that Spawn is not detected by InStateSequence
if (mo.bIsMonster && !mo.InStateSequence(mo.CurState, mo.ResolveState("Missile")))
{
Not sure if this should be mo && mo.bIsMonster && etc. although I haven't seen a need so far for this. I suppose it's possible in addressing these during a firefight that one could be wiped out. I'm capturing everything not "Missile." Hmm... Probably should also exclude the Death states. The reason I've excluded Missile is because InStateSequence doesn't seem to work with Spawn.
Weird I literally had nothing else loaded other then your tweak (hell even disabled reshade to test just in case). Sure the first screenshot is on me forgetting to isolate the problem with the new addon if there was a conflict but the second screenshot when loaded with this single tweak i could reproduce it over and over again. I hammer enter to start a new game asap, bring down console type changemap map04, load up the new map, open the first door to get to the first bunch of enemies next to the shutters, face the shutters at any angle and die, boom the 2nd screenshot i showed you.
thugsta wrote:
Weird I literally had nothing else loaded other then your tweak (hell even disabled reshade to test just in case). Sure the first screenshot is on me forgetting to isolate the problem with the new addon if there was a conflict but the second screenshot when loaded with this single tweak i could reproduce it over and over again. I hammer enter to start a new game asap, bring down console type changemap map04, load up the new map, open the first door to get to the first bunch of enemies next to the shutters, face the shutters at any angle and die, boom the 2nd screenshot i showed you.
I'll even get a video of it if need be.
See the updated file. I removed Lookers for Death and XDeath states.
Hey Doomer wrote:
See the updated file. I removed Lookers for Death and XDeath states.
Still does it but i have found by playing with the options on what causes it. Having 'Enable Autosaves to Always" in Miscellaneous Settings. Turning this off made it not crash anymore, first time i have seen the engines own autosave bother a mod.
Hope this can make you now get to the bottom of the problem.