Lookers [Update 12/14/21]

Post your example zscripts/ACS scripts/etc here.

Lookers [Update 12/14/21]

Postby Hey Doomer » Mon Dec 06, 2021 5:43 am

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.

ZScript:
Code: Select allExpand view
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:


Update 12/10/21
Spoiler:


Update 12/14/21
Spoiler:
Last edited by Hey Doomer on Tue Dec 14, 2021 7:45 am, edited 3 times in total.
Hey Doomer
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby thugsta » Thu Dec 09, 2021 12:47 pm

Bug report:- Seems to crash with VM aborted on console when dying on Map04 of Doom2...
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Hey Doomer » Thu Dec 09, 2021 12:50 pm

thugsta wrote:Bug report:- Seems to crash with VM aborted on console when dying on Map04 of Doom2...


Thanks. Can you turn on devmode and let me know what the error is?
Hey Doomer
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby thugsta » Thu Dec 09, 2021 1:00 pm

Where is devmode to turn it on?

But here is what the console say properly
bug.jpg
You do not have the required permissions to view the files attached to this post.
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Hey Doomer » Thu Dec 09, 2021 1:35 pm

thugsta wrote:Where is devmode to turn it on?

But here is what the console say properly
bug.jpg


If you search in options for "dev" you'll see Developer message mode. Turn that on and you'll get the messages. Errors is probably sufficient.
Hey Doomer
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby Enjay » Thu Dec 09, 2021 1:42 pm

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.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Lookers [Update 12/7/21]

Postby thugsta » Thu Dec 09, 2021 2:11 pm

Weird, i do some mod work too but never knew of this command. Thanks.

bug2.jpg

Is this right now?
You do not have the required permissions to view the files attached to this post.
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Hey Doomer » Thu Dec 09, 2021 3:00 pm

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.
Hey Doomer
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby thugsta » Thu Dec 09, 2021 3:37 pm

Not sure if it matters but, die near the beginning where those shutters are opening/closing.

I am mainly only playing with a bunch of your tweaks and and when i disable this one, the crashing stops.

Using:- Lookers, Clouds, Darker, Impact, Windows, Real elevators, Billboarder and Drag-Things

EDIT- Just tried it now with Lookers only and yes still the same error.
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Sarah » Thu Dec 09, 2021 4:58 pm

@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 :D
User avatar
Sarah
Royal Boredom....Why can't I do this in Windows?
 
Joined: 06 Sep 2006
Location: Middle of Nowheresville Il.
Github ID: Saican
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit

Re: Lookers [Update 12/7/21]

Postby thugsta » Thu Dec 09, 2021 5:15 pm

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 :D


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.

Thanks for the heads up.
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Hey Doomer » Fri Dec 10, 2021 3:35 am

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.

Code: Select allExpand view
      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
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby thugsta » Fri Dec 10, 2021 4:49 am

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.

Code: Select allExpand view
      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 :?: :shock: 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.
thugsta
 
Joined: 21 Jan 2019

Re: Lookers [Update 12/7/21]

Postby Hey Doomer » Fri Dec 10, 2021 4:52 am

thugsta wrote:Weird :?: :shock: 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
 
Joined: 25 Sep 2021

Re: Lookers [Update 12/7/21]

Postby thugsta » Fri Dec 10, 2021 11:46 pm

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.
thugsta
 
Joined: 21 Jan 2019

Next

Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests