"Hunt players" feature

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: "Hunt players" feature

Re: "Hunt players" feature

by Blue Shadow » Sun Dec 04, 2016 6:52 am

This can be closed now that we have scripting; I borrowed this code from the Icon of Sin. It doesn't exactly do what Fishy's code above does, but it's good enough for my use case.

Re: "Hunt players" feature

by Blue Shadow » Mon Jun 09, 2014 4:17 pm

Thanks! It's all clear now.

Re: "Hunt players" feature

by Fishytza » Mon Jun 09, 2014 1:54 am

Blue Shadow wrote:But what exactly it's transferring from player 1?
Player 1 him/herself, literally. At least I think that's how it works.

Basically, that bit of code could be translated to:

Code: Select all

A_TransferPointer(SOMETHING_FROM_PLAYER1, FOR_MYSELF, PLAYER1_THEMSELVES, AS_MY_TARGET)
that very same wiki page you linked wrote:AAPTR_DEFAULT: The calling actor itself
I think AAPTR_DEFAULT is only invalid if the actor was using itself as a source.
[EDIT]AAPTR_DEFAULT would be invalid if trying to assign yourself as your own target/master/tracer. And you can't use AAPTR_NULL as source or recipient.[/EDIT]

IE this would be invalid:

Code: Select all

A_TransferPointer(AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TRACER)
                 (from me,       to me,         myself,        as my tracer)
Just my 2 cents, though. I'm sure FDARI (if he's still around) could explain it better.

Re: "Hunt players" feature

by Blue Shadow » Sun Jun 08, 2014 4:00 pm

Again, I get the general idea of what the code is trying to achieve, yet, again, the transfer pointer part that I'm not sure about. Lets take this, for example, from the above code:

Code: Select all

A_TransferPointer(AAPTR_PLAYER1, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
It appears to be transferring something from player 1 to the calling actor. But what exactly it's transferring from player 1? What actor that's stored in the DEFAULT pointer of the player?

Oh, and for the sourcefield (and recipientfield), the [wiki=A_TransferPointer]wiki states[/wiki] that neither NULL nor DEFAULT are allowed. Is that true?

Re: "Hunt players" feature

by Fishytza » Sun Jun 08, 2014 2:43 pm

Yholl wrote:Mind if I use it in DoomRL Monsterpack?
Why would I mind if I bothered posting it in the first place? Be my guest. :)

Re: "Hunt players" feature

by edward850 » Sun Jun 08, 2014 10:19 am

NeuralStunner wrote:I still think an engine-side solution would be more reasonable, especially if max player count increases in the future.
Mind you, the player pointer system needs better handling of that just the same.

Re: "Hunt players" feature

by NeuralStunner » Sun Jun 08, 2014 8:57 am

It's cycling through pointers to each player and determining whether they exist (by checking for a flag that a valid player actor would have set). It's manually assigned to Target each time so the monster can begin the chase immediately.

I still think an engine-side solution would be more reasonable, especially if max player count increases in the future.

Re: "Hunt players" feature

by Blue Shadow » Sun Jun 08, 2014 12:56 am

FishyClockwork wrote:Ugly hacks ahoy! *ahem* Might wanna give this a try?

*code*
Thanks for the code, but could you or somebody else explain how the transfer pointer part works? I've tried the code, and it seems to work, but I'd like to know how it's working, and that specific part is just confusing me a little.

Re: "Hunt players" feature

by Ravick » Sun Jun 01, 2014 2:22 am

Couldn't it be done by just using "Thing_hate" in the monsters Spawn state? (Maybe with the need of player to have a TID, I guess.)

Re: "Hunt players" feature

by Yholl » Sat May 31, 2014 11:57 pm

FishyClockwork wrote:Ugly hacks ahoy! *ahem* Might wanna give this a try?

Code: Select all

Actor HostileOnSpawn : ZombieMan
{
	States
	{
	Idle:
		Goto Super::Spawn
	Spawn:
		TNT1 A 0 NoDelay A_TransferPointer(AAPTR_PLAYER1, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER2, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER3, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER4, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER5, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER6, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER7, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER8, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)
		Goto Super::Spawn
	FoundPlayer:
		TNT1 A 0 A_PrintBold("found a player!") //Just a message to tell you it works
		Goto See
	}
}
Oooh, that's quite nice. Mind if I use it in DoomRL Monsterpack? Delicious credits to you, of course.
This'd fit well into my plans for making everyone sad.

Re: "Hunt players" feature

by NeuralStunner » Thu May 15, 2014 9:42 am

I'm pretty sure all those functions could be used from a CustomInventory, to keep the monster's states a little cleaner.

Re: "Hunt players" feature

by Fishytza » Thu May 15, 2014 9:16 am

Ugly hacks ahoy! *ahem* Might wanna give this a try?

Code: Select all

Actor HostileOnSpawn : ZombieMan
{
	States
	{
	Idle:
		Goto Super::Spawn
	Spawn:
		TNT1 A 0 NoDelay A_TransferPointer(AAPTR_PLAYER1, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER2, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER3, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER4, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER5, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER6, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER7, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)

		TNT1 A 0 A_TransferPointer(AAPTR_PLAYER8, AAPTR_DEFAULT, AAPTR_DEFAULT, AAPTR_TARGET)
		TNT1 A 0 A_CheckFlag("SHOOTABLE", "FoundPlayer", AAPTR_TARGET)
		Goto Super::Spawn
	FoundPlayer:
		TNT1 A 0 A_PrintBold("found a player!") //Just a message to tell you it works
		Goto See
	}
}

Re: "Hunt players" feature

by Ethril » Thu May 15, 2014 6:47 am

I'm not sure (I'll check in a minute) but I think you can accomplish this just by having their Spawn state lead directly into their See state instead of looping.
edit: okay that didn't work
i swear i've done something like this that worked but i can't remember how

"Hunt players" feature

by Blue Shadow » Thu May 15, 2014 5:29 am

Could there be a feature that allows a monster, a hostile one, to explicitly hunt players without the need to see or hear them first? Since what I want this for is not map-oriented, Thing_Hate won't do it, as it seems to involve messing about with tids, something that I'd like to avoid. What I'd like is a DECORATE solution, an actor flag or a flag for A_LookEx, maybe?

If the above is already possible, then I'd appreciate it if someone directs me to it.

Top