effects on demand

Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 15th, 2010, 6:04 pm

Yep, that's it.
play loopeffect....stop effect when triggered....wait 60 seconds......then play the loopeffect again.
(it's for the spawneffect of the weapons in deck16)

Can't seem to figure it out.

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: effects on demand

Post by BatterY » August 16th, 2010, 8:00 am

If i remember correct, the weapons only spawn with some kind of a light fx, not loopfx until its picked up.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 9:26 am

That's right but in CoD2 the weapons are very small compared to the weapons in UT, so they are harder to spot.
Just to make em more noticible I want to add a small effect.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: effects on demand

Post by Rezil » August 16th, 2010, 9:33 am

Code: Select all

main()
{
	level.THIS_WEAPON_picked_up = false; //change to the weapon you want
	thread triggeredLoopFX();
	thread pickupWeapon();
}

triggeredLoopFX()
{
	fx = loadfx("blah");
	o = getent("origin_blah","targetname");
	
	while(!level.THIS_WEAPON_picked_up)
	{
		playfx(fx, o.origin);
		wait 0.5;
	}
}

pickupWeapon()
{
	t = getent("trigger_blah","targetname");
	
	for(;;)
	{
		t waittill("trigger", user);
		//do stuff
		level.THIS_WEAPON_picked_up = true;
		wait 60;
		//respawn weapon
		level.THIS_WEAPON_picked_up = false;
		thread triggeredLoopFX();
	}
}
Untested, try it and post results. Also, you could use the weapon pickup script and just add the global variable there instead of a seperate function.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 10:13 am

Thx, m8. I'll test it when I get home today.
Finally I can finish my map :)
On to the next one... Spacenoxxx

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 7:36 pm

I tried the code and this is what happends (get no error btw);

- the loopfx plays (stays looped untill triggered)
- when I trigger the ..uhm...trigger the fx dies out (like it wasn't looped)
- weapon spawns after 60 sec but fx doesn't

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: effects on demand

Post by Rezil » August 16th, 2010, 8:01 pm

Code: Select all

main()
{
	level.THIS_WEAPON_picked_up = false; //change to the weapon you want
	thread triggeredLoopFX();
	thread pickupWeapon();
}

triggeredLoopFX()
{
	fx = loadfx("blah");
	o = getent("origin_blah","targetname");

	while(1)
	{
		if(!level.THIS_WEAPON_picked_up)
		{
			playfx(fx, o.origin);
			wait 0.5;
		}
		wait 0.05;
	}
}

pickupWeapon()
{
	t = getent("trigger_blah","targetname");

	while(1)
	{
		t waittill("trigger", user);
		//do stuff
		level.THIS_WEAPON_picked_up = true;
		wait 60;
		//respawn weapon
		level.THIS_WEAPON_picked_up = false;
		thread triggeredLoopFX();
	}
}
Test this, it should work. I forgot that if the statement in the while loop doesn't hold true anymore, the loop breaks.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 9:00 pm

It still doesn't remove the effect, shouldn't this be done with a delete(); command or something ?
It spawns the effect after 60 seconds though.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: effects on demand

Post by Rezil » August 16th, 2010, 9:21 pm

Remove thread triggeredLoopFX(); in the last line.
It still doesn't remove the effect,[...]It spawns the effect after 60 seconds though.
? Surely if it's spawned again it has to be removed.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 10:22 pm

did it but got the same result.
What I mean by it respawns is;

- when I trigger the trigger (pick up weapon).
- the effect is (I think) played again but not looped. The effect destroys itself after 20 seconds or so and then respawns after 60 seconds (what's in the script)

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: effects on demand

Post by Rezil » August 16th, 2010, 10:54 pm

I tested the code I posted myself(without the last line), it works like it should, or at least it does what you said you wanted it to do.

http://www38.zippyshare.com/v/19328532/file.html

See for yourself. Run mp_effect_test in deathmatch and press the trigger.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 16th, 2010, 11:35 pm

You are right m8. I used the print text lines in my script and it works like it should (scripting wise).
Finally figured out the problem (I think), the effect has some sort of fall off curve. I changed the life-time of the effect and now it works. Still has a little bit of fall off curve, but I can live with that.

Thx for all the effort m8 !

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: effects on demand

Post by BatterY » August 21st, 2010, 1:17 pm

Do morpheus next! :D

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: effects on demand

Post by <LT>YosemiteSam[NL] » August 21st, 2010, 4:54 pm

BatterY wrote:Do morpheus next! :D
:D Definately 1 I'm gonna make. But first i want to make Spacenoxxx ... bit smaller and I can experiment more with the low gravity and jumpheight. Morbias is also on my list 8)

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests