Author Topic: Mounting a image to a player with serverCmd  (Read 1904 times)

I have made a function, and there is a package and other functions to my commands, but, this one will say that they are on fire, but the image is not mounted. I also want to make it keep mounting the image... Here is the code:
Code: [Select]
function serverCmdMakeMeFire(%client)
{
announce("<color:FFFFFF>" SPC %client.getPlayerName() SPC "<color:FFFF00>is now on fire.");
%client.player.mountImage(BurnEmitterB);
}

What is wrong?
« Last Edit: December 08, 2012, 09:20:14 PM by Advanced Bot »

BurnEmitterB is not an image.

I know, but I don't know why I put it there, it's a particle. But I want that Image to repeat and I am not sure how..


What you're probably going to want to do is to make a real shapeBaseImageData with an emitter on it, much like the wand (hint hint). Then you can mount this image.

Would this work?

Code: [Select]
datablock ParticleData(PlayerRainbowFireParticle)
{
textureName          = "base/data/particles/cloud";
dragCoefficient      = 0.0;
gravityCoefficient   = -3.0;
inheritedVelFactor   = 0.0;
windCoefficient      = 0;
constantAcceleration = 5.0;
lifetimeMS           = 400;
lifetimeVarianceMS   = 100;
spinSpeed     = 0;
spinRandomMin = -90.0;
spinRandomMax =  90.0;
useInvAlpha   = false;

colors[0] = "1 0 0 1";
colors[1] = "0 1 0 1";
colors[2] = "0 0 1 1";
colors[3] = "1 0 1 0";

sizes[0] = 0.0;
sizes[1] = 1.0;
sizes[2] = 0.8;
sizes[3] = 0.6;

times[0] = 0.0;
times[1] = 0.4;
times[2] = 0.7;
times[3] = 1.0;
};

datablock ParticleEmitterData(PlayerRainbowFireEmitter)
{
   ejectionPeriodMS = 12;
   periodVarianceMS = 0;
   ejectionVelocity = 0.1;
   ejectionOffset   = 0.00;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 35;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;

   orientParticles = False;

   particles = PlayerRainbowFireParticle;   

uiName = "Player Rainbow Fire";
};

datablock ShapeBaseImageData(PlayerColorFireImage)
{
shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = $HeadSlot;

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 0.350;
stateEmitter[1] = PlayerRainbowFireEmitter;
stateEmitterTime[1] = 0.350;

stateName[2] = "Done";
stateScript[2] = "onDone";
};

function serverCmdMakeMeFire(%client)
{
if(%client.IsAdmin)
  {
announce("<color:FFFFFF>" SPC %client.getPlayerName() SPC "<color:FFFF00>is now on fire.");
MakeEmitter();
  }
  else
  {
  %client.chatmessage("<color:FFFFFF>You must be admin to use this command.");
  }
}

function MakeEmitter(%client)
{
%client.mountImage(PlayerColorFireImage);
schedule(50, 0, mountImage(PlayerColorFireImage), %client.player, 0.1);
$loel::Schedule = schedule(100, 0, MakeEmitter);
}

//The functions are already in a package, it is just taken off.

Everything besides makeEmitter() looks fine to me.

Code: [Select]
function MakeEmitter(%client)
{
%client.mountImage(PlayerColorFireImage); // This needs a slot. Use slot 3, I guess.
schedule(50, 0, mountImage(PlayerColorFireImage), %client.player, 0.1); // Incorrect
$loel::Schedule = schedule(100, 0, MakeEmitter);
}
Well, first, just for syntaxical correctness, that line would be:
schedule(50, 0, mountImage, PlayerColorFireImage, %client.player, 0.1);

But, the last two variables are useless, and you need a slot. If you were actually going to use this, do this:
schedule(50, 0, mountImage, PlayerColorFireImage, 3);
But, there's no reason to do this because there's a schedule that does it again and there's no reason to do it every 50ms, so just remove that line.

Then the last line, $loel::Schedule, this is pointless. Players cannot unequip slot 3, and if it's an item that gives them this effect you can just use the callbacks for that item instead of scheduling it. Just remove it. Final code:

Code: [Select]
function MakeEmitter(%client)
{
%client.mountImage(PlayerColorFireImage, 3);
}

I have tried it, it has a console error with "unable to call function: 'mountImage'" Here is the code to it:
Code: [Select]
function MakeEmitter(%client)
{
%client.mountImage(PlayerColorFireImage, 3);
     schedule(100, 0, MakeEmitter);
}

Oh, duh. %client.player.mountImage()

Lol wow, I also noticed I need to add the ".player" also..

If you just give it two states, and have no transition on the second, the emitter should be permanent.

You're also going to want to do something like this.

Code: [Select]
function serverCmdFire(%client)
{
%player = %client.player;

if(isObject(%player))
%player.mountImage(PlayerColorFireImage, 3);
}

Otherwise, it will throw a console warning every time a dead or connecting client does /fire.

It is still doing nothing...

I need you to clue me in on a few things.

1. What are you trying to do (overall)?
2. Where do you want this image mounted?
3. What is the image supposed to do?

What I am trying to do is is that when they type the command, the image is on them, and it stays there, like an emitter. And the mount point I actually want it to be at is at the pants. The image is supposed to show rainbow fire on them. Here is the code, but it not showing up on them...

Code: [Select]
datablock ParticleData(PlayerRainbowFireParticle)
{
textureName          = "base/data/particles/cloud";
dragCoefficient      = 0.0;
gravityCoefficient   = -3.0;
inheritedVelFactor   = 0.0;
windCoefficient      = 0;
constantAcceleration = 5.0;
lifetimeMS           = 400;
lifetimeVarianceMS   = 100;
spinSpeed     = 0;
spinRandomMin = -90.0;
spinRandomMax =  90.0;
useInvAlpha   = false;

colors[0] = "1 0 0 1";
colors[1] = "0 1 0 1";
colors[2] = "0 0 1 1";
colors[3] = "1 0 1 0";

sizes[0] = 0.0;
sizes[1] = 1.0;
sizes[2] = 0.8;
sizes[3] = 0.6;

times[0] = 0.0;
times[1] = 0.4;
times[2] = 0.7;
times[3] = 1.0;
};

datablock ParticleEmitterData(PlayerRainbowFireEmitter)
{
   ejectionPeriodMS = 12;
   periodVarianceMS = 0;
   ejectionVelocity = 0.1;
   ejectionOffset   = 0.00;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 35;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;

   orientParticles = False;

   particles = PlayerRainbowFireParticle;   

uiName = "Player Rainbow Fire";
};

datablock ShapeBaseImageData(PlayerColorFireImage)
{
shapeFile = "base/data/shapes/empty.dts";
emap = false;

mountPoint = $PantsSlot;

stateName[0] = "Ready";
stateTransitionOnTimeout[0] = "FireA";
stateTimeoutValue[0] = 0.01;

stateName[1] = "FireA";
stateTransitionOnTimeout[1] = "Done";
stateWaitForTimeout[1] = True;
stateTimeoutValue[1] = 0.350;
stateEmitter[1] = PlayerRainbowFireEmitter;
stateEmitterTime[1] = 0.350;

stateName[2] = "Done";
stateScript[2] = "onDone";
};

//package is there, and other functions, but will not be seen.

function serverCmdMakeMeFire(%client)
{
if(%client.IsAdmin)
  {
announce("<color:FFFFFF>" SPC %client.getPlayerName() SPC "<color:FFFF00>is now on fire.");
MakeEmitter();
  }
  else
  {
  %client.chatmessage("<color:FFFFFF>You must be admin to use this command.");
  }
}

function MakeEmitter(%client)
{
%client.player.mountImage(PlayerColorFireImage, 3);
        schedule(100, 0, MakeEmitter);
}
« Last Edit: December 09, 2012, 08:03:11 PM by Advanced Bot »

Nvm guys, its works, its just I forgot to add ""
Code: [Select]
%client.player.mountImage("PlayerColorFireImage", 3);