Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 95 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 MP Mapping
CoD 4 mapping and level design for multiplayer.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: How to play effect in Random Dir?
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Wednesday, Apr. 30, 2014 08:38 am
Hey everyone, I searched but couldn't find what I was looking for. I'm trying to play an effect in a random direction using the "playFx".

Like this:

Code:

playFx (level.myEffect, source.origin);


The problem I'm having is that, in the effects editor, I can only get the effect to play up or down, for the life of me, I can't get it to play sideways. But, what I wanted to know is, if there is a way I can play the effect in a Random direction each time it plays. I'd like it to play in a random direction every time it plays. Does anyone know how to make that happen, using this method?

I also have it choose between 6 different effects already. When the effect plays, it randomly picks one of the 6 effects. This is my current code that plays the effect.

Code:

playFx (level._effect["orb"] [randomint(6)], source.origin);


Does anyone know how I can implement a completely random direction into this? Because currently it is only playing up. Which is default.
Share |
BUSH1DO
General Member
Since: Apr 2, 2014
Posts: 40
Last: Sep 9, 2016
[view latest posts]
Level 2
Category: CoD4 MP Mapping
Posted: Wednesday, May. 7, 2014 03:57 pm
HI
not shure what you mean
do you use any triggers to playeff
or you need code for random chose of eff
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 MP Mapping
Posted: Thursday, May. 8, 2014 06:31 pm
I solved it using a different effect. I found a similar effect that already uses random dir. I don't use a trigger, just this code.

Code:

main()
{
	level._effect["orb"][0] = loadfx ("misc/a_red_orb");
	level._effect["orb"][1] = loadfx ("misc/a_green_orb");
	level._effect["orb"][2] = loadfx ("misc/a_blue_orb");
	level._effect["orb"][3] = loadfx ("misc/a_orange_orb");
	level._effect["orb"][4] = loadfx ("misc/a_yellow_orb");
	level._effect["orb"][5] = loadfx ("misc/a_white_orb");
	level._effect["orb"][6] = loadfx ("misc/a_multi_orb");

	thread colorOrbs();
}

colorOrbs()
{
	source = getEntArray ("orb_source", "targetname");

    while (1)
    { 
		randOrb = randomInt (source.size);
		wait (10 + randomFloat (14) );
		
		playFx (level._effect["orb"] [randomInt(7)], source[randOrb].origin);
		
		wait (3);
		
		playFx (level._effect["orb"] [randomInt(7)], source[randOrb].origin);
		
//		iprintLn ("Random Orb");
		
		wait (5);
	}
}


I ended up using this code. Worked just fine cause the effect was pretty much random. But, I did find that I could have also used this code "BELOW" just as well.

Code:

main()
{
	level._effect["orb"][0] = loadfx ("misc/a_red_orb");
	level._effect["orb"][1] = loadfx ("misc/a_green_orb");
	level._effect["orb"][2] = loadfx ("misc/a_blue_orb");
	level._effect["orb"][3] = loadfx ("misc/a_orange_orb");
	level._effect["orb"][4] = loadfx ("misc/a_yellow_orb");
	level._effect["orb"][5] = loadfx ("misc/a_white_orb");
	level._effect["orb"][6] = loadfx ("misc/a_multi_orb");

	thread colorOrbs();
}

colorOrbs()
{
	source = getEntArray ("orb_source", "targetname");

	dirX = RandomFloatRange( -999.0, 999.0 );
	dirY = RandomFloatRange( 1.0, 100.0 );
	dirZ = RandomIntRange( 1, 360 );

    while (1)
    { 
		randOrb = randomInt (source.size);
		wait (10 + randomFloat (14) );
		
		playFx (level._effect["orb"] [randomint(7)], source.origin, ( dirZ, dirY, dirZ ) );		//(dir, +left/-right, angle)
		
//		iprintLn ("Random Orb");
		
		wait (5);
	}
}


I was mostly playing with the random directions, but I ended up NOT using the bottom code, but it could work.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 MP Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»