Will this code be ok ? pawns don't fight

Tutorials and discussions about Mapping - Introduce your own ones!
Post Reply
Red_Fist
Godlike
Posts: 2166
Joined: Sun Oct 05, 2008 3:31 am

Will this code be ok ? pawns don't fight

Post by Red_Fist »

I am adding this code so they don't fight. I want a placable new pawn, not a mutator or a separate .U

Code: Select all

//=============================================================================
// NKrall.
//=============================================================================
class NKrall expands Krall;

function eAttitude AttitudeToCreature(Pawn Other)
{
	if ( Other.IsA('NKrall') )
		return ATTITUDE_Friendly;
	else if ( Other.IsA('ScriptedPawn') )
		return ATTITUDE_Friendly;
	else
		return ATTITUDE_Ignore;
}
This is the stock code for the Brute, mostly the same for most pawns. slight variations on class.

Code: Select all

function eAttitude AttitudeToCreature(Pawn Other)
{
	if ( Other.IsA('Brute') )
		return ATTITUDE_Friendly;
	else if ( Other.IsA('Nali') )
		return ATTITUDE_Hate;
	else
		return ATTITUDE_Ignore;
}
So for this map I am doing would this mess up some other aspect, or for online ?

Because I have been wanting to have a set of pawns that do not attack each other for a long time and don't want any mutator or gametype, only the scripted pawns.
It's a very important thing, a loophole cheat to beat a map but is fun and strategy also, you just set off the enemies and let them work themselves down or kill each other off, and you never have to fire a shot.

So I want to do this map so they won't fight. I have a lot of non stock pawns I managed to get in MyLevel. But to try and place enemies with certain amounts of health becomes difficult if the pawns attack each other.
Makes it harder to make the gameplay,

Epic should have had a selection property in each Scripted pawn, so you could choose each pawn and the type of attitude you want. Instead of messing with code.
Binary Space Partitioning
User avatar
EvilGrins
Godlike
Posts: 9695
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Will this code be ok ? pawns don't fight

Post by EvilGrins »

You want to beat an MH map with the monsters just ignoring you?
G7ecOOL4A7E
Seems boring.
Attachments
Clip0005.png
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Will this code be ok ? pawns don't fight

Post by Barbie »

@EvilGrins: Red_Fist was talking about the relation between ScriptedPawns, not between ScriptedPawns and PlayerPawns.
(The class Pawn introduces the property AttitudeToPlayer, and the class ScriptedPawn introduces the function AttitudeToCreature.)
Red_Fist wrote:So for this map I am doing would this mess up some other aspect, or for online ?
I don't see any problems here. But you could shorten the code for the class NKrall to

Code: Select all

function eAttitude AttitudeToCreature(Pawn Other) {
   if ( Other.IsA('ScriptedPawn') )
	  return ATTITUDE_Friendly;
   else
	  return ATTITUDE_Ignore;
}
because NKrall is a ScriptedPawn.

And just some general hints:
  • A lot of MH servers are already surpressing fights between ScriptedPawns.
  • AFAIR this code does not prevent Monster-against-Monster-fights, if the bump each other or get angry by any other way.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
OjitroC
Godlike
Posts: 3613
Joined: Sat Sep 12, 2015 8:46 pm

Re: Will this code be ok ? pawns don't fight

Post by OjitroC »

I don't really know but is it possible to MyLevel the code from the SYF (StopYourFIghting) mutator? This seems to deal more directly with MonsterAttacks rather than simply with the ScriptedPawns' initial Attitude to other ScriptedPawns. As it stands, even with monsters having an initial Friendly Attitude to other monsters, a Player will still be able to provoke a fight between monsters in certain situations by firing at a monster and then moving to ensure that other monsters take the return fire.
Red_Fist
Godlike
Posts: 2166
Joined: Sun Oct 05, 2008 3:31 am

Re: Will this code be ok ? pawns don't fight

Post by Red_Fist »

I think you need to have it's own class, along with scripted pawn, but maybe not. :noidea

It makes scripted pawns not fight each other no matter if provoked even if they shoot each other by accident, zero fighting, but they all hate the player plenty fine.

Thanks Barbie,

Ya well, this map is gonna kick yar arse EvilGrins, you will see, it will have you running for every cheat code known to man, :P :plasma:
Binary Space Partitioning
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Will this code be ok ? pawns don't fight

Post by JackGriffin »

If you need help with this, let me know. SYF may be a good choice for you depending on what it is you want to accomplish. PM/email me and I'll fix you up.
So long, and thanks for all the fish
Red_Fist
Godlike
Posts: 2166
Joined: Sun Oct 05, 2008 3:31 am

Re: Will this code be ok ? pawns don't fight

Post by Red_Fist »

JackGriffin wrote:If you need help with this, let me know. SYF may be a good choice for you depending on what it is you want to accomplish. PM/email me and I'll fix you up.
A set of stock pawns do what I typed above
"Epic should have had a selection property in each Scripted pawn, so you could choose each pawn and the type of attitude you want. Instead of messing with code. "

Was thinking like a dropdown box in the pawns properties that list each pawn and then select the attitude next to it, would be the ultimate fix for this.
In that way you could make any scripted pawn like or hate any other pawn that you select, in the actor property interface.

I am going to use this code for now since I already added it, and I am not using every stock pawn in ths map, so I will just edit a few new ones I need.
Binary Space Partitioning
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Will this code be ok ? pawns don't fight

Post by sektor2111 »

OjitroC wrote:I don't really know but is it possible to MyLevel the code from the SYF (StopYourFIghting) mutator?
I've already done other thing in "MyLevel"s for double purpose - not a mutator for one purpose loading a heavy tick, just an actor doing more than a SYF.
The problem of an useless Krall is that other monsters will not love it, if will be attacked by the rest of creatures it won't react dying like an ass.

Aside:
Take a look at MH-Templar - wheel was invented already, and it's well set.
User avatar
EvilGrins
Godlike
Posts: 9695
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Will this code be ok ? pawns don't fight

Post by EvilGrins »

Not the coded version, but going from the video's "friendly" I've been experimenting with that on a CTF edit I'm doing.

They don't attack unless they get shot.
Attachments
Shot0009.png
Shot0008.png
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
Post Reply