Page 1 of 1

[Solved]Need help for a fonction

Posted: Mon May 01, 2023 5:25 pm
by Letylove49
hi

would lke to ask how to do a function for check if a mutator is running .
/***************************************************************************************************
*
* $DESCRIPTION Called when a new client has been created. Use this function to setup the new
* client with your own extensions (in order to support the plugin).
* $PARAM client The client that was just created.
* $REQUIRE client != none
* $OVERRIDE
*
**************************************************************************************************/
function clientCreated(NexgenClient client) {

if (Level.Game.IsA('SmartSB115.SmartSB'))
client.addController(class'NXPMBClient', self);
}
i know how to do for a gametype but not for a mutator

somone can help me with this please ??'

Re: Need help for a fonction

Posted: Mon May 01, 2023 8:28 pm
by Barbie
function ModifyPlayer(Pawn Other) in class'Mutator'?

Re: Need help for a fonction

Posted: Mon May 01, 2023 9:17 pm
by Buggie
Depends what you mean by "mutator is running".
Some stuff work not matter how set, in mutator chain, or as ServerActor.

In this case you need search presence of some actor on map.

Like make foreach of all actor of base know class, and check if it desired name.

Code: Select all

				foreach me.AllActors(class'Mutator', mutator)
					if (mutator.isA('BeaconPlayer'))
						break;
				if (mutator != None) DisablePlayerLabels = true;
Here we check if Mutator BeaconPlayer is on on map.

For another stuff, which need to be in mutator chain, you can walk over mutator chain and check each member for it.

Re: Need help for a fonction

Posted: Mon May 01, 2023 10:13 pm
by Letylove49
i don't know if that can help you to understand what i want to do

Code: Select all

 CustomGameConfig[0]=(bEnabled=True,GameClass="BotPack.DeathMatchPlus",NewPrefix="DM",Mutators="SmartSB115.SmartSB,",Settings="FragLimit=35,TimeLimit=15,MinPlayers=6",Packages="")
CustomGameConfig[4]=(bEnabled=True,GameClass="BotPack.CTFGame",NewPrefix="CTF",Mutators="fnn210.NewNetGH,FastCap.FC_Mutator,SmartSB115.SmartSB,NoImpactHammer.NoImpactHammer, fnn210.XlocMut",Settings="GoalTeamScore=7.000000,TimeLimit=15,MaxTeams=2,MinPlayers=4",Packages="")
CustomGameConfig[9]=(bEnabled=True,GameClass="Botpack.TeamGamePlus",NewPrefix="TDM",Mutators="SmartSB115.SmartSB,NoImpactHammer.NoImpactHammer",Settings="",Packages="")
CustomGameConfig[11]=(bEnabled=True,GameClass="Botpack.Domination",NewPrefix="Dom",Mutators="SmartSB115.SmartSB,NoImpactHammer.NoImpactHammer",Settings="",Packages="")
CustomGameConfig[12]=(bEnabled=True,GameClass="fnn210.LastManStanding",NewPrefix="LMS",Mutators="SmartSB115.SmartSB,NoImpactHammer.NoImpactHammer",Settings="",Packages="")
In this case the plugin must runing.

the mutaror is only on serverpackages

Code: Select all

 CustomGameConfig[16]=(bEnabled=True,GameClass="MonsterHunt2Gold467.MonsterHunt",NewPrefix="MH2",Mutators="MoreGunsv7.MoreGuns,
in this case the plugin musm't not running

Re: Need help for a fonction

Posted: Tue May 02, 2023 2:22 pm
by sektor2111
Letylove49 wrote: Mon May 01, 2023 5:25 pm function clientCreated(NexgenClient client) {

if (Level.Game.IsA('SmartSB115.SmartSB'))
client.addController(class'NXPMBClient', self);
}
Level.Game IS NOT mutator and client I think it doesn't have any "Level.Game", client is connected to a "Level.Game".
You can track these by logging a simulated function in whatever mutator. and looking in client connected.
As far as I read forum, SmartSB115 is a package with a mutator not a "Level.Game".

Code: Select all

	log ("Level Game is"@Level.Game);

Re: Need help for a fonction

Posted: Tue May 02, 2023 4:14 pm
by Letylove49
thanks

i want to know if is possible to make a check for multi gametyme like

Code: Select all


/***************************************************************************************************
 *
 *  $DESCRIPTION  Called when a new client has been created. Use this function to setup the new
 *                client with your own extensions (in order to support the plugin).
 *  $PARAM        client  The client that was just created.
 *  $REQUIRE      client != none
 *  $OVERRIDE
 *
 **************************************************************************************************/
function clientCreated(NexgenClient client) {


   if (Level.Game.IsA('DeathMatchPlus')) || if (Level.Game.IsA('CTFGame'))|| if (Level.Game.IsA('TeamGamePlus')) ||if (Level.Game.IsA('Domination'))||
   if (Level.Game.IsA('LastManStanding'))
    
	client.addController(class'NXPMBClient', self);
}



Re: Need help for a fonction

Posted: Tue May 02, 2023 10:31 pm
by Eternity
You can replicate it yourself or use existing way such as GameClass property in GameReplicationInfo...

Re: Need help for a fonction

Posted: Tue May 02, 2023 11:42 pm
by Letylove49
Buggie wrote: Mon May 01, 2023 9:17 pm Depends what you mean by "mutator is running".
Some stuff work not matter how set, in mutator chain, or as ServerActor.

In this case you need search presence of some actor on map.

Like make foreach of all actor of base know class, and check if it desired name.

Code: Select all

				foreach me.AllActors(class'Mutator', mutator)
					if (mutator.isA('BeaconPlayer'))
						break;
				if (mutator != None) DisablePlayerLabels = true;
Here we check if Mutator BeaconPlayer is on on map.

For another stuff, which need to be in mutator chain, you can walk over mutator chain and check each member for it.


thanks i have try that :

Error in NXPMBSSB.uc (35): 'ForEach': An iterator expression is required

Code: Select all

function clientCreated(NexgenClient client) {


    foreach me.AllActors(class''SmartSB115.SmartSB', mutator)
					if (mutator.isA('SmartSB115'))
						break;
				if (mutator != None) DisablePlayerLabels = true;  
on my plugin if the mutaor Smartssb115 is running the plugin must be running else nothing must running.

Re: Need help for a fonction

Posted: Wed May 03, 2023 12:27 am
by Eternity
Btw, "IsA()" function only checks for the Name of the actor's class (and the Name of all the parent classes), not the Class and not the package name it is loaded from...

Re: Need help for a fonction

Posted: Wed May 03, 2023 10:36 am
by Letylove49
ok in this case i want to know if is posible to check if a gamtype is not a specifiq gametyle:

!=Monsterhunt. if i want to start my plugin in all gaamtype but not on Monsterhunt because i use is one Plugin for this gametype.

Re: Need help for a fonction

Posted: Wed May 03, 2023 12:30 pm
by asosed
Letylove49 wrote: Wed May 03, 2023 10:36 am ok in this case i want to know if is posible to check if a gamtype is not a specifiq gametyle:

!=Monsterhunt. if i want to start my plugin in all gaamtype but not on Monsterhunt because i use is one Plugin for this gametype.
Level.Game.IsA('MonsterHunt')

Re: Need help for a fonction

Posted: Wed May 03, 2023 1:30 pm
by Letylove49
asosed wrote: Wed May 03, 2023 12:30 pm
Letylove49 wrote: Wed May 03, 2023 10:36 am ok in this case i want to know if is posible to check if a gamtype is not a specifiq gametyle:

!=Monsterhunt. if i want to start my plugin in all gaamtype but not on Monsterhunt because i use is one Plugin for this gametype.
Level.Game.IsA('MonsterHunt')
thanks

i want that be not monsterhunt but others gametype like DM CTF a, TDM or others . i want to use with Smardscorboard) but i need a option to diseable the orignial Brodcasted multikill message on hte left or the message will be displayed twice.
Shot00175.png

Code: Select all

function CheckBroadCast(Pawn Killer,int num)
{
   if(bBrodcastMultikill)
   if(Killer.bIsPlayer && !Killer.PlayerReplicationInfo.bIsABot)
      BroadCastMessage(Killer.PlayerReplicationInfo.PlayerName@GetText(num));
}
i have added this option on the mH2Gold because is opensource but four your mod i want to ask to you to add it if i can make my plugin working .

i have already a plugin who work for the Monsterhunt and work fine. you vcan see it work on my server . i would like to do the same for the others gametype.

if that is not possible i will do a plugin for each gamtype

Re: Need help for a fonction

Posted: Wed May 03, 2023 2:16 pm
by sektor2111
You can check game-types but the check is complex. Why ?
Simply because MonsterHunt is a TeamGamePlus doesn't matter what others are saying, and also a TeamGamePlus is a DeathMatchPlus.
Resuming, if you want to except something from running in MonsterHunt option is to check one single NEGATIVE condition.
Did I say that logs are helping in simple probing tools ? This is doable before messing X times in some important class.
Run a mutator doing this query:

Code: Select all

	if (Level.Game.IsA('DeathMatchPlus'))
		log ("We have a DeathMatch.");
Let me see, you'll see the log printed in all games because ALL games from your MapVote are CHILD classes of DeathMatchPlus, is that simple.
In end testing DeathMatchPlus and TeamGamePlus and Domination will return "YES" because Domination is a TeamGamePlus which is DeathMatchPlus - and so MonsterHunt is also part of subject. Before more blabbering, I recommend you to look in Editor at how are wrapped classes, it's the same as for Pawns. Skaarj is Pawn, and Bot is Pawn too, these games being ALWAYS DeathMatchPlus which is always "GameInfo", all of them being... "Actor" after all.

Re: Need help for a fonction

Posted: Wed May 03, 2023 2:55 pm
by Letylove49
thanks in this cas i don't need to create a plugin for each mode only 1 for DM CTF end MH

ServerPackages=NexgenMBMH2v112UK
ServerPackages=NexgenMBSSBDMv112UK
ServerPackages=NexgenMBSSBCTFv112UK

you can test the MH2 version on my server .

Re: Need help for a fonction

Posted: Fri May 05, 2023 6:41 pm
by Letylove49
OK I have made my 2 plugin for DM et CTF.
Thanks to prosam to have mad a update of smartssb for be full compatible with my plugin.
thank you to everyone who helped me with this project.