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

Members Online

»
0 Active | 93 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Throwable Fireball, which explodes on contact
csocsi96
General Member
Since: Aug 9, 2010
Posts: 75
Last: Aug 24, 2014
[view latest posts]
Level 3
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Saturday, Mar. 30, 2013 08:46 pm
Hi there,

Currently I am working on a Fireball which people can throw and kill enemies with it, since it will explode on contact.

I can't figure out how not to make it instant. I mean when I throwed this thing it immediately appeared at the target. (The code has been modified, now with the speed implementation we can't see anything, I guess because of the for loop)

I think I have the code which would make this to travel with speed just can't implement this into the script.

Here is the current progress:

Code:

init()
{
	level._effect["fireball"] = loadfx("fx/explosions/flak_puff.efx");
}

check()
{
	self endon("disconnect");
	self endon("killed_player");	

	while(!self meleebuttonpressed())
		wait(0.05);

	playfx(level._effect["fireball"],traceTarget());
}

traceTarget()
{
	for(i=0;i<100;i++)
	{
		forward=anglestoforward(self getplayerangles());
		trace=bullettrace(self geteye()+ (0, 0, 20), self geteye()+maps\mp\_utility::vectorScale(forward, 50) + (0, 0, 100000), false, self);
		origin = trace["position"] - maps\mp\_utility::vectorScale(forward, 5);
		trace=bullettrace(origin, origin - (0,0,i), false, self);
	
		return trace["position"];
		wait .05;
	}
}


I bet anyone knows what I'm doing wrong. (I know what I'm doing wrong, just dunno how to do it well [lol])

edited on Mar. 30, 2013 01:49 pm by csocsi96
and please a tutorial on how does bullettrace and things like this work?
Share |
ukdjaj
General Member
Since: Jun 1, 2008
Posts: 2726
Last: Nov 15, 2020
[view latest posts]
Level 9
Category: CoD2 Scripting
Posted: Saturday, Mar. 30, 2013 10:39 pm
Couldn't you look at the panzersherk file? Or even the animations of it, as that has a separate projectile which obviously fires along its own course :)

Thanks, Ukdjaj[thumbs_up]
Share |
Spik3d
General Member
Since: Jan 30, 2008
Posts: 130
Last: Feb 19, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Mar. 31, 2013 12:11 pm
That for loop is only going through until it hits the first return trace["position"], once code hits a return it will return to where that was called from. If it was threaded, it basically just ends.

So you're only having that playfx called with the first origin returned from the loop. You'd need the playfx(fireball, origin), to be in the function with the loop.

I didn't really look at your code to see if that would work and play a line of fire from the player to it's end with an explosion at the end though.
Share |
UnnamedNewby
General Member
Since: Jan 26, 2013
Posts: 12
Last: Jun 27, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Thursday, May. 16, 2013 07:57 pm
Well, if I correctly understood you, there is a simplier way. Have you ever been to any Zombie server? There is such stuff, like potatoes or body parts that only explode on contact with players. It is provided via \projImpactExplode\ , I mean, do it as a usual grenade with new xmodel/xanim/fx or whatever...
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»