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

Members Online

»
0 Active | 46 Guests
Online:

LATEST FORUM THREADS

»
Using Teamspeak
Teamspeak Servers

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 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Grenades
Samuel033
General Member
Since: Dec 10, 2009
Posts: 484
Last: Dec 25, 2015
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Sunday, Mar. 14, 2010 04:41 pm
Can the preset grenade timer be overridden without getting into the weapons file? A sample use could be a random detonation time. Another would be a grenade that lays in wait until someone gets close... in a sense a thrown claymore.

Havent seen anything in the code and the only way I see around it is to replace the stock grenade with a custom made one before it explodes. Used that method already for something else but it took some doing and I hope 'solid' would allow it to bounce off walls and such.
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Mar. 15, 2010 06:22 am
Samuel, I am sorry to say this, but I do believe all of the gernade code is handled through the engine itself. I have never seen anything in script about grenades before (other than giving them in loadouts and stuff like that). The only way would be to modify the grenade weapon file, which would not be a random time, or you would have to make your own type of grenade script that acts like a grenade, but isn't (if that makes sense). Hope find a way!
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
BraX
General Member
Since: Apr 29, 2008
Posts: 413
Last: May 26, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Monday, Mar. 15, 2010 06:32 am
You can try this fun script for detonating grenades [machine_gun][lol]

Code:
detonate_grenades()
{
	grenades = getEntArray( "grenade", "classname" );
	if( !grenades.size )
		return;

	for( i = 0; i < grenades.size; i++ )
	{
		grenades[i] detonate();
	}
}


edited on Mar. 15, 2010 09:32 am by BraX
Share |
Samuel033
General Member
Since: Dec 10, 2009
Posts: 484
Last: Dec 25, 2015
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Monday, Mar. 15, 2010 11:14 am
That one might be interesting. Set the grenade weapon file timer to 999999 but detonate it manually when the right conditions are met. Might work.

Actually it would be nice if it were possible in the script to access all weapon file variables and modify them as needed. [casanova]

edited on Mar. 15, 2010 03:45 pm by Samuel033

For grenades it should have hit me immediately that since its the same type of file as c4/claymores it already had a 'no timer' function built in. Bah.
Share |
playername
Preferred Member
Since: Aug 24, 2006
Posts: 821
Last: Apr 15, 2011
[view latest posts]
Level 7
Forum Moderator
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Mar. 16, 2010 06:11 am
Converted to memory :P I did not know of this function since I do not map for CoD4. I have found there are more useful functions avaliable than there were CoD2. Thanks for the find BraX!
nullFew tips for coding.
1. Keep the script as short as possible.
2. Don't comment every line. Only comment portions where they may be needed to point something out.
3. Don't over complicate the script, keep it organized and easy to read.

These help you find simple errors and makes it easy to make changes.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»