PDA

View Full Version : Playing a FX with a use_Touch_trigger in a map



lovemakers
30th July 2013, 19:12
Hey guys,

following problem: As you can see below, I posted the script. If I start the map, only the music gets played, and no FX appears.
Is it proper, if I take player.origin?
I already used developer, but no errors. Music plays fine, only the FX doesn't appear. I need it only in one room, so I thought it would be okay to play the FX on the player which used the use_Touch_trigger.
I've added a few wait commands between the FXs, because I want to play the FXs in certain moments of the song, so I've calculated when which FX is needed. Did I do that in the correct way? Or is there any other way?
Do I have to add any .csv file to load the FXs ? In Call of Duty 4 actually you always have to type in the mod.csv the effects you need.

Please help me.
Thanks in advance!


main()
{
maps\mp\_load::main();

thread _PrecacheFX();
thread song1();
thread song2();


setExpFog(0.0001, 0.55, 0.6, 0.55, 0);
// setCullFog(0, 16500, 0.55, 0.6, 0.55, 0);
ambientPlay("ambient_france");

game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "allies";
game["defenders"] = "axis";
game["american_soldiertype"] = "normandy";
game["german_soldiertype"] = "normandy";

setCvar("r_glowbloomintensity0", ".25");
setCvar("r_glowbloomintensity1", ".25");
setcvar("r_glowskybleedintensity0",".3") ;

}

_PrecacheFX()
{
level._effect["mp_lmfao_blinking_diff_colors"] = loadfx ("fx/fire/mp_lmfao_blinking_diff_colors.efx");
level._effect["mp_lmfao_blue_circle_5sec"] = loadfx ("fx/fire/mp_lmfao_blue_circle_5sec.efx");
level._effect["mp_lmfao_cyan_smoke_40_sec"] = loadfx ("fx/fire/mp_lmfao_cyan_smoke_40_sec.efx");
level._effect["mp_lmfao_flash_light_7sec_blue"] = loadfx ("fx/fire/mp_lmfao_flash_light_7sec_blue.efx");
level._effect["mp_lmfao_flash_light_7sec_pink"] = loadfx ("fx/fire/mp_lmfao_flash_light_7sec_pink.efx");
level._effect["mp_lmfao_flash_light_7sec_red"] = loadfx ("fx/fire/mp_lmfao_flash_light_7sec_red.efx");
level._effect["mp_lmfao_flash_light_7sec_white"] = loadfx ("fx/fire/mp_lmfao_flash_light_7sec_white.efx");
level._effect["mp_lmfao_flash_light_7sec_yellow"] = loadfx ("fx/fire/mp_lmfao_flash_light_7sec_yellow.efx");
level._effect["mp_lmfao_green_smoke_40_sec"] = loadfx ("fx/fire/mp_lmfao_green_smoke_40_sec.efx");
level._effect["mp_lmfao_pink_circle_5sec"] = loadfx ("fx/fire/mp_lmfao_pink_circle_5sec.efx");
level._effect["mp_lmfao_red_circle_5sec"] = loadfx ("fx/fire/mp_lmfao_red_circle_5sec.efx");
level._effect["mp_lmfao_white_circle_5sec"] = loadfx ("fx/fire/mp_lmfao_white_circle_5sec.efx");
level._effect["mp_lmfao_yellow_circle_5sec"] = loadfx ("fx/fire/mp_lmfao_yellow_circle_5sec.efx");
}

song1()
{
music = getEnt("trigger_roll", "targetname");
while(1)
{

music waittill("trigger");
musicStop();
musicPlay("song1");
wait 1;
}
}

song2()

{
music = getEnt("trigger_bang", "targetname");
player = getent("player","classname");
while(1)
{
music waittill("trigger");
wait 26;
player iprintlnbold("Disco!");
musicStop();
musicPlay("song2");

playfx ( level._effect["mp_lmfao_cyan_smoke_40_sec"], player.origin );
playfx ( level._effect["mp_lmfao_flash_light_7sec_blue"], player.origin );
playfx ( level._effect["mp_lmfao_flash_light_7sec_white"], player.origin );
wait 18;

playfx ( level._effect["mp_lmfao_yellow_circle_5sec"], player.origin );
playfx ( level._effect["mp_lmfao_green_smoke_40_sec"], player.origin );
wait 5;
playfx ( level._effect["mp_lmfao_flash_light_7sec_yellow"], player.origin );
wait 7;
playfx ( level._effect["mp_lmfao_white_circle_5sec"], player.origin );
playfx ( level._effect["mp_lmfao_cyan_smoke_40_sec"], player.origin );
wait 34;

playfx ( level._effect["mp_lmfao_blinking_diff_colors"], player.origin );
wait 10;
playfx ( level._effect["mp_lmfao_red_circle_5sec"], player.origin );
playfx ( level._effect["mp_lmfao_flash_light_7sec_red"], player.origin );
wait 5;
playfx ( level._effect["mp_lmfao_pink_circle_5sec"], player.origin );
playfx ( level._effect["mp_lmfao_flash_light_7sec_white"], player.origin );
wait 7;
playfx ( level._effect["mp_lmfao_flash_light_7sec_pink"], player.origin );
wait 7;
playfx ( level._effect["mp_lmfao_blue_circle_5sec"], player.origin );
playfx ( level._effect["mp_lmfao_green_smoke_40_sec"], player.origin );
wait 10;
playfx ( level._effect["mp_lmfao_blinking_diff_colors"], player.origin );
wait 1;
}
}

randall
30th July 2013, 19:23
What the hell it is????
player = getent("player","classname");

Use getEntArray(). And dont try to play the effects on all players, because the fps will fall to 0.

lovemakers
30th July 2013, 19:25
So I only have to change

player = getent("player","classname");

to

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

?

lovemakers
30th July 2013, 19:25
So I only have to change

player = getent("player","classname");

to

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

?

randall
30th July 2013, 19:29
Yes, and you will get an array, NOT an object! But i think the simplest way if you change this line:
music waittill("trigger");
to this:
music waittill("trigger", player);

lovemakers
30th July 2013, 19:40
Awesome, it works now!

I just changed the music waittill("trigger"); to music waittill("trigger", player); and changed player = getent("player","classname"); to player getEntArray("player", "classname");

Thank you randall!

megazor
1st August 2013, 01:50
I just changed the music waittill("trigger"); to music waittill("trigger", player); and changed player = getent("player","classname"); to player getEntArray("player", "classname");

You definitely should gain a better understanding of coding - before coding. The latter change is not only unnecessary, it is wrong in general:

player getEntArray("player", "classname");
This doesn't make sense at all. You'd better remove this line from your script and try to find out by yourself why it's wrong.