PDA

View Full Version : Show FX not the same for the teams?



Loveboy
23rd December 2013, 23:57
Hello Guys, I want to play a fx, which should be not show the same for the teams.
Like if I am in allies, then my team (which are too allies) should show friendly fx, and if axis see the fx, then should they see it in red.
I prepared the FX, but I don't know if it's possible with the script.
I tried it, but I failed. Somebody said me it works with the showTo, but the script error said that it's an unknown function.

Here is the script what I tried:


level._effect["carepackage_friendly"] = loadfx ("fx/carepackage/carepackage_friendly.efx");
level._effect["carepackage_enemy"] = loadfx ("fx/carepackage/carepackage_enemy.efx");

players = getentarray("player", "classname");
for (i = 0; i<players.size; i++)
{
if(self.pers["team"] == "allies" && players.pers["team"] == "allies")
{
maps\mp\_fx::loopfx("carepackage_friendly", self.origin) showTo(players.pers["allies"]);
}
else if(self.pers["team"] == "allies" && players.pers["team"] == "axis")
{
maps\mp\_fx::loopfx("carepackage_enemy", self.origin) showTo(players.pers["axis"]);
}
else if(self.pers["team"] == "axis" && players.pers["team"] == "axis")
{
maps\mp\_fx::loopfx("carepackage_friendly", self.origin) showTo(players.pers["axis"]);
}
else if(self.pers["team"] == "axis" && players.pers["team"] == "allies")
{
maps\mp\_fx::loopfx("carepackage_enemy", self.origin) showTo(players.pers["allies"]);
}
}


Is it maybe possible what I want to do?

Would be very very nice if it's possible :)

IzNoGoD
24th December 2013, 00:19
Not possible, sorry

Loveboy
24th December 2013, 00:29
Ah ok :( But then I will show both teams same FX, should be this right, because the FX will not play :D



level._effect["carepackage"] = loadfx("fx/carepackage/carepackage.efx");

maps\mp\_fx::loopfx("carepackage", self.origin, 0.3); //Can I set here self.origin? I need to play the FX where the play is currently.

IzNoGoD
24th December 2013, 01:29
self is not defined.

Tally
24th December 2013, 08:23
Not possible, sorry

Yes, it is - by using showtoplayer(). This is from my killconfirmed script:


spawnDogtagEffect()
{
dogtag = playLoopedFx( level._effect["dogtags"] , 1.0 , self.origin );
dogtag thread showToTeam( self.pers["team"] );

level.dogtags[level.dogtags.size] = dogtag;
}

showToTeam( team )
{
self endon( "deleted" );

for( ; ; )
{
self hide();

players = getEntArray( "player" , "classname" );

for( i = 0 ; i < players.size ; i++ )
{
player = players[i];

if( isDefined( player.pers["team"] ) && player.pers["team"] == team )
self ShowToPlayer( player );
}

level waittill( "joined_team" );
}
}


original code by serthy.

Loveboy
24th December 2013, 08:49
Nice script, but I don't understand it. There aren't two effects, I need one effect for showing for the friendly players and enemy players.
And here is team undefined -> if( isDefined( player.pers["team"] ) && player.pers["team"] == team )

Tally
24th December 2013, 10:57
Nice script, but I don't understand it. There aren't two effects, I need one effect for showing for the friendly players and enemy players.
And here is team undefined -> if( isDefined( player.pers["team"] ) && player.pers["team"] == team )


{

carepackage_friendly = playLoopedFx( level._effect["carepackage_friendly"], 1.0, self.origin );
carepackage_friendly thread showToTeam( "allies" );

carepackage_enemy = playLoopedFx( level._effect["carepackage_enemy"], 1.0, self.origin );
carepackage_enemy thread showToTeam( "axis" );


}

showToTeam( team )
{
self endon( "death" );

for( ;; )
{
self hide();

players = getEntArray( "player" , "classname" );
for( i = 0 ; i < players.size ; i++ )
{
player = players[i];

if( isDefined( player.pers["team"] ) && player.pers["team"] == team )
self ShowToPlayer( player );
}

wait( 0.05 );
}
}

Loveboy
24th December 2013, 11:15
Wow very nice! I never thought that it's possible :)

Hmm did I something wrong so that the FX don't play? :D It doesn't matter where I define level._effect?



level._effect["carepackage_friendly"] = loadfx ("fx/carepackage/carepackage_friendly.efx");
level._effect["carepackage_enemy"] = loadfx ("fx/carepackage/carepackage_enemy.efx");

carepackage_friendly = playLoopedFx( level._effect["carepackage_friendly"], 1.0, self.origin );
carepackage_friendly thread showToTeam( "allies" );

carepackage_enemy = playLoopedFx( level._effect["carepackage_enemy"], 1.0, self.origin );
carepackage_enemy thread showToTeam( "axis" );




showToTeam(team)
{
self endon( "death" );

for( ;; )
{
self hide();

players = getEntArray( "player" , "classname" );
for( i = 0 ; i < players.size ; i++ )
{
player = players[i];

if( isDefined( player.pers["team"] ) && player.pers["team"] == team )
self ShowToPlayer( player );
}
}
}

Tally
24th December 2013, 12:14
I will not hold your hand on this. You will have to play around with the timing of the FX in order to get it to work. I put in a default of 1 second, but I have no idea what time is actually needed as I have never seen your fx file.

I really wish you people would stop using this forum for copy-and-paste scripting. You ask for help, but you actually want someone to code it all for you, so that you can just copy-and-paste it, all ready to work. This forum is for help - as in advice on which direction to take. It is not for copy-and-paste code.

Loveboy
24th December 2013, 12:19
It's an quick FX, if you don't use it in loop, then it play only 1 second (it's how like a light), and I want to play it in loop, so there shouldn't show only 1 secound.
I think carepackage_friendly = playLoopedFx( level._effect["carepackage_friendly"], 1.0, self.origin ); is why that doesn't work. The FX does exist, the path is correct.
I will ask other guys now too, maybe they know how it can work.

IzNoGoD
24th December 2013, 15:34
self is not defined.

Please try reading.

Loveboy
24th December 2013, 16:26
I don't understand what you mean.
I did



player = getent("player","classname");
playfx(level._effect["carepackage"], player.origin);

IzNoGoD
24th December 2013, 16:43
player is an array, or your script should already crash due to the fact that there are multiple players

Loveboy
24th December 2013, 17:10
Just look, I want to play an fx, and if you are as example on killstreak 5, then this thread will be called: playfxforcarepackage()



playfxforcarepackage()
{
player = getent("player","classname");
while(1)
{
playfx(level._effect["carepackage"], player.origin);
wait 0.5;
}
}


And this doesn't work. I just want to play an FX, which all can see this fx and it should spawn on the player origin, it should play loop, but it should't follow the player, just spawn on the player origin and play there loop. And at one point, I want to stop it. Here I have got problems :(

Tally
24th December 2013, 17:50
Just look, I want to play an fx, and if you are as example on killstreak 5, then this thread will be called: playfxforcarepackage()



playfxforcarepackage()
{
player = getent("player","classname");
while(1)
{
playfx(level._effect["carepackage"], player.origin);
wait 0.5;
}
}


And this doesn't work. I just want to play an FX, which all can see this fx and it should spawn on the player origin, it should play loop, but it should't follow the player, just spawn on the player origin and play there loop. And at one point, I want to stop it. Here I have got problems :(

It doesn't work because you don't know how to script. It's getEntArray(), not getEnt() = there are more than 1 player hence you use getEntarray() (plural) and not getEnt() (singlular).

This is basic stuff. If you don't know the difference now, given that you've been scripting for Call of Duty for over 1 year, you should really give it up, because you are not getting the very basics. In other words, you don't have an aptitude for COD scripting. Take up knitting instead. It's much easier.

YuriJurek
24th December 2013, 18:23
Take up knitting instead. It's much easier.
Lol, just like my grandma, started scripting for CoD2 and ended up in this kind of shit ;xd