Author Topic: How to tell if %obj is player or bot?  (Read 1852 times)

I am trying to take a wack out at a gameMode and im wondering how do i check if %obj is a bot or not?
and also what is the function called when clicking another player?

%obj.getClassName() $= "AIPlayer"

Thanks, that will really help
is armor::onTrigger called when clicking another player/bot?

Look at Amade's bots mod.

Yea, i will do that thanks.
and also is there a way to target a random person in the same minigame?

%randomClientInMinigame = %mini.member[getRandom(0, %mini.numMembers)];

and this might be final question, how do i target all the players in the mini, i think its gotta do something like you said, Amade.

Why are you asking others to script a tag mod for you to release?

I am gonna add other functions that i know (probably) and i knew some functions but i was wondering if it is right, but if you don't want me to continue on this, i will stop.

and this might be final question, how do i target all the players in the mini, i think its gotta do something like you said, Amade.
Code: [Select]
for(%i = 0; %i < %mini.numMembers; %i++)
{
%member = %mini.member[%i];
%member.player.doStuff();
}
Why are you asking others to script a tag mod for you to release?
He still has to figure out what goes where.

Code: [Select]
for(%i = 0; %i < %mini.numMembers; %i++)
{
%member = %mini.member[%i];
%member.player.doStuff();
}
He still has to figure out what goes where.
That goes when the mini game starts and end (So i can target all to make them normal)
and i was thinking would this work though?
   %members = %mini.member[%mini.numMembers];
   %members.isIt = 0;



%randomClientInMinigame = %mini.member[getRandom(0, %mini.numMembers)];
That goes when minigame starts

%obj.getClassName() $= "AIPlayer"
and also that would be in the function for when they tag.

A loop would be difficult for a new person to figure out even with references, however there are ways to figure out values and such of objects and variables just by going into the game. Tree();, trace(1); and obj.dump(); are your best friends.

I knew bout that stuff, im trying it right now.

Doesn't work so well, it won't set a person to tag or tag.
Code: (Tag mode) [Select]
//package TagMode{function armor::onTrigger(%client,%this){parent::onTrigger(%client,%this);if(%client.isIt==1){%this.isIt=1;%client.isIt=0;
registerGameMode("Tag","EX",1,1,0);                                     //Title, shortened title (used for functions), Uses Teams, Special Teams, Show Rounds
setGameModeHelp("Tag","./Rules.txt"); //Text file with default mode displayed rules

//Some example mode rule types settable through the Rules tab of the GUI
addGameModeRule("Tag","Time","int 0 5",0); //integer between 0 and 30
addGameModeRule("Tag","Lives","int 0 10",0); //datablock

//If you don't create any of the 'special' functions here they will be ignored and not used.

function GameMode_Tag_GetSpecialTeams(%client)
{
//Gets default team data to display in the GUI when you select that game mode

//Clear teams list first
commandtoclient(%client,'tdmSpecialClearTeams');

//First Team
commandtoclient(%client,'tdmSpecialSendTeam',0,"Name" TAB //Team Name
0 TAB //Paint Colour
1 TAB //Auto Sort Ratio
PlayerStandardArmor.uiName TAB //Datablock
gunItem.uiName TAB //Start Equipment
"NONE" TAB
"NONE" TAB
"NONE" TAB
"NONE" TAB
PlayerStandardArmor.uiName TAB //Leader Datablock
gunItem.uiName TAB //Leader Start Equipment
"NONE" TAB
"NONE" TAB
"NONE" TAB
"NONE");

//Uniform data is sent in three 'chunks' - first ten fields, second ten, then seven

//chest TAB chestCol TAB
//rArm TAB rArmCol TAB
//lArm TAB lArmCol TAB
//rHand TAB rHandCol TAB
//lHand TAB lHandCol TAB
//----------------------------------------
//pants TAB pantsCol TAB
//rLeg TAB rLegCol TAB
//lLeg TAB lLegCol TAB
//hat TAB hatCol TAB
//accent TAB accentCol TAB
//----------------------------------------
//pack TAB packCol TAB
//secondPack TAB secondPackCol TAB
// headCol TAB
//decalName TAB faceName

commandtoclient(%client,'tdmSpecialStoreUniform',0,0,"FIELDS HERE"); //Team ID; Data ID, Data String
commandtoclient(%client,'tdmSpecialStoreUniform',0,1,"FIELDS HERE");
commandtoclient(%client,'tdmSpecialStoreUniform',0,2,"FIELDS HERE");

//Leader uniform is the same.
commandtoclient(%client,'tdmSpecialStoreLUniform',0,0,"FIELDS HERE");
commandtoclient(%client,'tdmSpecialStoreLUniform',0,1,"FIELDS HERE");
commandtoclient(%client,'tdmSpecialStoreLUniform',0,2,"FIELDS HERE");

//Send other teams in the same way, change the Team ID
}
package Tagging
{
function player::activateStuff(%client, %this)
{
if(isObject(%client.minigame) || isObject(%this.minigame) || %this.getClassName() $= "AIPlayer")
{
if(%client.isIt == 1)
{
%this.isIt = 1;
%client.isIt = 0;
messageClient(%this, '', "\c6Uh oh, your it!");
%mini.messageall('',"\c3"@%this.name@"\c6 is it!");
}
}
parent::activateStuff(%client, %this);
}
};
activatePackage("tagging");
function GameMode_Tag_onModeStart(%mini,%client)
{
for(%i = 0; %i < %mini.numMembers; %i++)
{
%member = %mini.member[%i];
%member.isIt = 0;
}
%randomClientInMinigame = %mini.member[getRandom(0, %mini.numMembers)];
%randomClientInMinigame.isIt = 1;
%mini.messageAll('',"\c3"@%randomClientInMinigame.name@" \c6 is it!");
}

function GameMode_Tag_onModeEnd(%mini,%client)
{
%members = %mini.member[%mini.numMembers];
%members.isIt = 0;
}

function GameMode_Tag_onMiniReset(%mini,%client)
{
for(%i = 0; %i < %mini.numMembers; %i++)
{
%member = %mini.member[%i];
%member.isIt = 0;
}
%randomClientInMinigame = %mini.member[getRandom(0, %mini.numMembers)];
%randomClientInMinigame.isIt = 1;
%mini.messageAll('',"\c3"@%randomClientInMinigame.name@" \c6 is it!");
}

function GameMode_Tag_onAddMember(%mini,%client)
{
%client.isIt=0;
}

function GameMode_Tag_onRemoveMember(%mini,%client)
{
%client.isIt=0;
}

function GameMode_Tag_onClientChangeTeam(%mini,%client,%lastTeam,%newTeam)
{
//nothing
}

function GameMode_Tag_onClientDeath(%mini,%client,%sourceObject,%sourceClient,%damageType,%damageArea)
{
//Shouldn't be.
}

function GameMode_Tag_onClientSpawn(%mini,%client)
{
if(%client.isIt == 1)
{
messageClient(%client, '', "\c6Nice try \c3"@%client.name@"\c6 but you are still it!");
}
}

function GameMode_Tag_pickSpawnPoint(%mini,%client)
{
//Called before a player is spawned
//don't create the function or return "" to spawn players normally
//return a transform to spawn players in a different place

return "";
}

function GameMode_Tag_getShapeNameColor(%mini,%client,%player)
{
//Called before a player's name color is set
//don't create the function or return "" for mini/team color
//return a color string to set that instead

return "";
}

function GameMode_Tag_updatePlayerDatablock(%mini)
{
//Called when the minigame settings are changed and player datablocks are updated
}

function GameMode_Tag_forceEquip(%mini,%slot)
{
//Called when the minigame settings are changed and players are given tools
}

function GameMode_Tag_resetCapturePoints(%mini,%client)
{
//Called instead of MinigameSO::resetCapturePoints if it exists
}

function GameMode_Tag_applyTeamUniform(%mini,%client)
{
//Called before *team* uniform is set in Accessories and Full uniform modes
//don't create the function or return "" for default
//return 0 for team and 1 for leader uniform

return "";
}

function GameMode_Tag_miniGameCanDamage(%mini,%obj1,%obj2,%client1,%client2)
{
//Called before a player is damaged
//return "" for default (depending on Friendly Fire)
//return 0/1 to force damage on or off

return "0";
}

function GameMode_Tag_miniGameCstar fishe(%mini,%obj1,%obj2)
{
//Called before an object is used
//return "" for default
//return 0/1 for to force usable or not

return "";
}

function GameMode_Tag_onMinigameUpdateSettings(%mini,%client,%datastring)
{
//Called after the minigame settings are updated
}

function GameMode_Tag_onMinigameUpdateModeSettings(%mini,%client,%datastring)
{
//Called after the game mode/team/rules settings are updated, but not when the game mode is first started
}

function GameMode_Tag_onModeUpdateRuleN(%mini,%rulevalue,%oldvalue,%modestart)
{
//Called when the minigame's rule settings are *changed*, for each rule defined.
//You may not wish to show messages when the mode is first started.
//Replace N with the rule number, starting from 0.

//Return 1 to reset the minigame when this rule is changed.
//If the function is created, it must return a value (0/1) or may default to 'true' which causes random/occasional minigame resets when changed.
}