[Map] The Lost City
Re: [Map] The Lost City
Oh, there's only a few things I would optimize, but I'm still not quite sure what the whole point is...
Are you telling me you've got a king of the hill game type in Arena?
Or there's some kind of throne that you mount players on?
I don't understand.
Are you telling me you've got a king of the hill game type in Arena?
Or there's some kind of throne that you mount players on?
I don't understand.
Re: [Map] The Lost City
lol...
<--Click here to subscribe to S_hift's youtube
Click here for full access to all my tribes downloads
Click here for full access to all my tribes downloads
Re: [Map] The Lost City
Code: Select all
function checkKingsThrone()
{
if(!$Legendz::Throne) // I'm guessing this is toggled by an admin... -perrinoia
return;
$Kingevenodd = !$Kingevenodd; //switches from 1 to 0... tells every other check... used to check if in both new & old sets
%set = newObject("throne"@$Kingevenodd, SimSet);
AddToSet("MissionCleanup\\Arena", %set);
%pos=GetOffsetRot("-155.5 0 5.5", "0 0 0", $Arena::Spawn);
containerBoxFillSet(%set, $SimPlayerObjectType, %pos, 14, 14, 20, 0); // Small box to scan... -perrinoia
%num = Group::objectCount(%set);
for(%i = 0; %i < %num; %i++)
{
%obj = Group::getObject(%set, %i);
%clientId = Player::getClient(%obj);
if(!%clientId.isTheKing) // Not the king... Whatever that means... -perrinoia
{
GameBase::setRotation(%obj, "0 0 " @ getWord(GameBase::getRotation(%obj), 2)); // Interesting solution for tipsy players... -perrinoia
Player::applyImpulse(%obj, Vector::getFromRot(GameBase::getRotation(%obj), -3000, 3000)); // Oh, we're boosting non-royalty... I get it now. -perrinoia
schedule(sprintf("if(!Player::isAIControlled(%1)) Client::sendMessage(%1, 1, \"~wmale3.wbye.wav\");", %obj), 2); // Where should I begin? -perrinoia
// 1) %cl = %obj? Why? Just use %obj instead of making a whole new variable with an inappropriate name. -perrinoia
// 2) Check if the player is a bot before sending a message to reduce error messages in console. -perrinoia
// 3) There is no 3rd argument in function schedule, stop putting object ID's there. -perrinoia
// 4) function sprintf() is nifty, and can shorten the length of certain lines of code by a few characters. -perrinoia
}
else // All hail whoever this guy is, I guess. -perrinoia
{
// %now = getSimTime(); //AFK System -DaJ4ck3L
// %clientId.lastActiveTimestamp = %now; //AFK System -DaJ4ck3L
%clientId.lastActiveTimeStamp = getSimTime(); // No need for this to take up two lines of code. -perrinoia
%obj.izking = true; // Wut do? -perrinoia
%clientId.KingonThrone = true; // Wut do? -perrinoia
%obj.onThrone = 1 + $Kingevenodd; //1 half the time & 2 other half... used to check if in this set while searching the old set
}
}
%num = Group::objectCount($Kingset);
for(%j = 0; %j < %num; %j++)
{
%obj = Group::getObject($Kingset, %j);
%clientId = Player::getClient(%obj);
%name = GameBase::getDataName(%obj);
if(%obj.onThrone && %obj.onThrone != ($Kingevenodd + 1)) // Dethroning because they weren't in the box? -perrinoia
{
%obj.izking = false; // Player is no longer king, but client is? -perrinoia
%clientId.KingonThrone = false; // Client is not on the throne? Why is this important enough to be stored in a property? -perrinoia
%obj.onThrone = 0; // Player is also not on the throne... Why is this stored in two places?
// %client.isTheKing = ?; // Still the king, but he got up to stretch his legs? -perrinoia
}
}
deleteObject($Kingset); //delete the old set
$Kingset = %set; //and replace with new set
schedule("checkKingsThrone();", 1);
}
// Where is the code that makes someone king? -perrinoia
// Appointed by admin, control switch, points? -perrinoia
// The following variables are very redundant. As far as I can tell, you only need 1 to determine who doesn't get boosted. -perrinoia
// if(%obj.isKing) %obj = King's Player ID.
// if(%clientID.isTheKing) %clientID = King's Client ID.
// if(%obj.onThrone) Player is contained in the box.
// if(%clientId.KingonThrone) Client is contained in the box.
Re: [Map] The Lost City
%obj.izking this is what makes the player invincible (for everyone in OZ).
%clientId.KingonThrone this is something i made to access invo on the throne (only for me, though i never used it. need to delete.).
%obj.onThrone = 1 + $Kingevenodd; this creates two sets, so it makes a new set, before deleting the old one (hmmm, after looking at it, seems i messed up with this, and it's only used atm to check if they not on throne).
I'll have to show you what this does sometime.
%clientId.KingonThrone this is something i made to access invo on the throne (only for me, though i never used it. need to delete.).
%obj.onThrone = 1 + $Kingevenodd; this creates two sets, so it makes a new set, before deleting the old one (hmmm, after looking at it, seems i messed up with this, and it's only used atm to check if they not on throne).
I'll have to show you what this does sometime.
Re: [Map] The Lost City
Not knowing what the rest of that shit was for, I rewrote it... LOL
Code: Select all
function checkKingsThrone()
{
if(!$Legendz::Throne)
return;
%set = newObject("temp", SimSet); // Not saving this shit beyond the scope of this function.
%num = containerBoxFillSet(%set, $SimPlayerObjectType, Vector::add("-155.5 0 5.5", $Arena::Spawn), 14, 14, 20, 0); // No need for Group::objectCount, as this command returns the number of objects found.
while(0 <= %num--) // Count down from max to zero... Less typing for lazy scriptors.
{
%player = Group::getObject(%set, %num); // Naming variables appropriately.
%client = Player::getClient(%player);
if(%client != $Elvis) // Using global variables which are easier to retrieve and reset.
{
Player::applyImpulse(%obj, Vector::getFromRot(GameBase::getRotation(%obj), -3000, 3000)); // Combined multiple lines of code
if(!Player::isAIControlled(%player)) // If a bot ever did stroll into the throne, your console would be spammed with error messages from trying to message them.
AI::soundHelper(%client, %client, "bye"); // Send the message using the client's own voice instead of hard coding.
}
else
echo(%royals++ @") King "@ Client::getName(%client) @" is on the throne."); // Count number of kings on the throne (maybe there's more than 1, who knows?).
}
if(%royals < 1) // Checks if the king was found.
echo("King "@ Client::getName($Elvis) @" is not on the throne."); // Announces who the king is, in console.
deleteObject(%set); // Honey badger don't care, delete this shit.
schedule("checkKingsThrone();", 1);
}
// Stands a DropPointMarker up-right, so players don't get tipsy when they spawn.
function DropPointMarker::cureHangOver(%this)
{
GameBase::setRotation(%this, "0 0 "@ getWord(GameBase::getRotation(%this), 2));
}
// Only need to do this once per mission, rather than fixing every player (on the throne), every second.
Group::iterateRecursive(nameToID("MissionGroup"), GameBase::virtual, "cureHangOver"); // stands all of the drop points in the mission up-right.
Group::iterateRecursive(nameToID("MissionCleanup"), GameBase::virtual, "cureHangOver"); // stands all of the other drop points up-right, too.
Re: [Map] The Lost City
haha, Elvis...
Re: [Map] The Lost City
Did you want the version in the original post added so we can test it?
Re: [Map] The Lost City
Changed the type in .dsc to
$MDESC::Type = "Capture the Flag Ground";
and added to the server. I didn't add any code or make any of the changes talked about on page 1. If you want them make them and reup.
$MDESC::Type = "Capture the Flag Ground";
and added to the server. I didn't add any code or make any of the changes talked about on page 1. If you want them make them and reup.
Re: [Map] The Lost City
thank you^^
<--Click here to subscribe to S_hift's youtube
Click here for full access to all my tribes downloads
Click here for full access to all my tribes downloads