[Solved]Need help for a fonction

Discussions about Coding and Scripting
Post Reply
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

[Solved]Need help for a fonction

Post 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 ??'
Last edited by Letylove49 on Fri May 05, 2023 6:42 pm, edited 1 time in total.
Image



Letylove49 aka Alicia
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Need help for a fonction

Post by Barbie »

function ModifyPlayer(Pawn Other) in class'Mutator'?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Buggie
Godlike
Posts: 2734
Joined: Sat Mar 21, 2020 5:32 am

Re: Need help for a fonction

Post 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.
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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
Image



Letylove49 aka Alicia
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help for a fonction

Post 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);
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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);
}


Image



Letylove49 aka Alicia
Eternity
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: Need help for a fonction

Post by Eternity »

You can replicate it yourself or use existing way such as GameClass property in GameReplicationInfo...
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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.
Image



Letylove49 aka Alicia
Eternity
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: Need help for a fonction

Post 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...
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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.
Image



Letylove49 aka Alicia
User avatar
asosed
Adept
Posts: 279
Joined: Fri May 15, 2020 2:36 pm
Location: Russia
Contact:

Re: Need help for a fonction

Post 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')
Image
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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
Last edited by Letylove49 on Wed May 03, 2023 2:38 pm, edited 1 time in total.
Image



Letylove49 aka Alicia
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help for a fonction

Post 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.
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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 .
Image



Letylove49 aka Alicia
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Need help for a fonction

Post 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.
Image



Letylove49 aka Alicia
Post Reply