Chat Command help

i need help on these two commands

//==============================================================================
//==============================================================================
function ccrain(%sender){//,%args) {
//if (!%sender.issuperadmin && !%sender.isadmin){
if (!%sender.issuperadmin){
   messageclient(%sender, 'MsgClient', "\c2Uber Admins only.");
   return;
   }
   makerain();
    messageclient(%sender, 'MsgClient', "\c2You have made it rain");
}


function makerainmenu(%client)
{
   if($Host::TournamentMode)
      return;
   if($RainCounter < 4)
      makerain();
}


datablock PrecipitationData(Rain2)
{
   type = 0;
   materialList = "raindrops.dml";
   sizeX = 0.2;
   sizeY = 0.45;
   movingBoxPer = 0.35;
   divHeightVal = 1.5;
   sizeBigBox = 1;
   topBoxSpeed = 20;
   frontBoxSpeed = 30;
   topBoxDrawPer = 0.5;
   bottomDrawHeight = 40;
   skipIfPer = -0.3;
   bottomSpeedPer = 1.0;
   frontSpeedPer = 1.5;
   frontRadiusPer = 0.5;
};




function makerainsound()
{
   %aud = new AudioEmitter()
      {
      position = "296.26 434.72 167.827";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      filename    = "fx/environment/rain_light_1.wav";
      description = AudioLooping2d;
      useProfileDescription = "0";
      outsideAmbient = "1";
      volume = "1";
      isLooping = "1";
      is3D = "0";
      minDistance = "50";
      maxDistance = "100000";
      coneInsideAngle = "360";
      coneOutsideAngle = "360";
      coneOutsideVolume = "1";
      coneVector = "0 0 1";
      loopCount = "-1";
      minLoopGap = "0";
      maxLoopGap = "0";
      type = "EffectAudioType";
      };
   return %aud;
}



function makerain()
{
   if(isobject($Rainsound[$raincounter - 4]))
      $rainsound[$raincounter].delete();
   $raincounter++;
   $rain[$raincounter] = new Precipitation(Precipitation)
      {
      position = "-225.463 143.423 202.782";
      rotation = "1 0 0 0";
      scale = "5 5 5";
      dataBlock = "Rain2";
      percentage = "1";
      color1 = "0.8 0.8 0.8 1";
      color2 = "0.6 0.6 0.6 1";
      color3 = "0.4 0.4 0.4 1";
      offsetSpeed = "0.25";
      minVelocity = "1";
      maxVelocity = "2";
      maxNumDrops = 2000 * $raincounter * $Raincounter;
      maxRadius = "100";
      };
   $Rainsound[$raincounter] = makerainsound();
}
function ccstrike(%sender, %args){
 %client = plnametocid(%args);
 if(!%sender.isAdmin){
 mesageclient(%sender, 'msgclient', 'Admins only');
 return;
 }
 if(%client==0){
 messageclient(%sender, 'msgclient', 'No Such Player.');
 return;
 }
 %client.toggleLightning = !%client.toggleLightning;	//toggle on/off
 if(isObject(%client.player)){
    messageall('MsgAdminForce', "\c2Lightning activated for " @ %client.namebase);
    Lightning(%client);
    }
 }


function Lightning(%client){
	if(!%client.player || $host::tournamentmode || !%client.toggleLightning){		//player dead or gone
		%client.toggleLightning = false;
		messageall('MsgAdminForce', "\c2Lightning deactivated for " @ %client.namebase);
		if(isobject($strikeOld[%client]))
			$strikeOld[%client].delete();
		if(isobject($strike[%client]))
			$strike[%client].delete();
		return;
		}
	%pos = %client.player.position;
	%x = getword(%pos, 0);
	%y = getword(%pos, 1);
	%z = getword(%pos, 2) + 100;
	%startpos = %x @ " " @ %y @ " " @ %z;
	%color = getrandom() SPC getrandom() SPC getrandom() SPC 1;

	if(!$Host::LightningArea)
		$Host::LightningArea = 300;

	if($Host::Lightning::Intensity == 0)
		%ssm = 10;
	if($Host::Lightning::Intensity == 1)
		%ssm = 60;
	if($Host::Lightning::Intensity == 2)
		%ssm = 300;

	if($Host::Lightning::Accuracy == 0)
		%cth = 0.001;
	if($Host::Lightning::Accuracy == 1)
		%cth = 1;
	if($Host::Lightning::Accuracy == 2)
		%cth = 99;

	$strike[%client] = new Lightning()
	{
		position = %startpos;
		rotation = "1 1 0 0";
		scale = $Host::LightningArea SPC $Host::LightningArea SPC 300;
		dataBlock = "DefaultStorm";
		strikesPerMinute = %ssm;
		strikeWidth = 1 + getrandom() * 3;
		chanceToHitTarget = %cth;
		strikeRadius = (getrandom() * 50) + 20;
		boltStartRadius = getrandom() * 15;
		color = %color;
		fadeColor = getword(%color, 0)/3 SPC getword(%color, 1)/3 SPC getword(%color, 2)/3 SPC 0.2;
		useFog = "0";
	};
	if(isobject($strikeOld[%client])){	//remove the old instance
		$strikeOld[%client].delete();
       }
	$strikeOld[%client] = $strike[%client];

	schedule(1000,0,lightning, %client);
}

Comments

  • For the rain command, it looks like it should work ok, but you really shouldn't have a scale of "5 5 5" on your precipitation. It already floods the entire map. Also doesn't look like you have a function to remove the rain.

    For the strike command... if you just want to hit a player with lightning you can have it call LightningStrike(%client,%delay);
  • ummm... i fixed the rain, but how do i make it so that the lightning is more accurate?
  • Lowering the huge strike and boltstart radius would help the accuracy a lot. The scale should be lower too unless you want it striking other people near the target.

    Another lightning function already in construction you could've used is
    createLightning(%pos, %rad, %strikesPerMin, %hitPercentage, %scale1000)




    You can stick "if (!$TriconToggleFwok) return;" at the top of functions fireworks1 to stop it from looping or just cancel($fwsched); in the chatcommand.
  • where are those lightning commands?
    and how do i use the killerfog?
  • The create one is in functions.cs, the strike one is in hfunctions.cs

    To use killerfog you need to set MissionArea.killerFogAlt to the altitude you want it to kill at, after that you can activate it with killerFog();
  • to set the altitude do i just put MissionArea.killerFogAlt=#; at the top?
  • Should do it, yeah.
  • ok, umm... i think something is wrong with my server.... i dont think anyone can see it. Someone said something about forwarding your ports or something like that... how do i do that?
  • Usually just need to go into router setup and forward the ports to the one machine. There's a guide on how to do it for most routers on http://www.portforward.com/, you'll need more ports than just the one they mention though.

    Also make sure you don't have a software firewall blocking the ports.
  • ok, i did that, but im still not sure if anyone can see my server...

    and how do i make it so that my server doesnt start with two teams?
  • The Construction game mode usually prevents that, if you're running a CTF map it's just gonna do that.
  • Yeah, it checks for a second spawnsphere, if it finds one it will add another team.
Sign In or Register to comment.