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 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: Carepackage.gsc script
rrider17
General Member
Since: Jun 30, 2012
Posts: 1
Last: Jun 30, 2012
[view latest posts]
Level 0
Category: CoD4 Scripting
Posted: Saturday, Jun. 30, 2012 04:23 pm
Hi guys so i'm starting this topic because i need your help,i'm making my own COD 4 mod and i'm using Openwarfare mod as my base,so i decided to put Carepackage hardpoint in to my mod ,but i'm having trouble with scripting because i'm noob at scripting so i need help,well in my hardpoints.gsc file i already have scipt for Tactical Nuke addon ,and AC130 and they work so i decided to combine the carepackage with rest of them so the can be one file,but after i compile a new mod i'm getting a lot of "script compile error " and i need help with this:
Code:
Error:  ******* script compile error ******* Error: uninitialised variable 'grenadecount': (file 'maps/mp/gametypes/_hardpoints.gsc', line 1701)    carepack_grenade_mp setSecondaryGrenades( self GetSecondaryGrenadeName(), grenadeCount );                                                                              * ************************************ Loaded zone 'mp_almeria'       dvar set cl_paused 0       dvar set loc_language 0       dvar set loc_forceEnglish 0       dvar set com_errorTitle Error       dvar set com_errorMessage script compile error uninitialised variable 'grenadecount'    carepack_grenade_mp setSecondaryGrenades( self GetSecondaryGrenadeName(), grenadeCount ); (see console for details)  ******************** ERROR: script compile error uninitialised variable 'grenadecount'    carepack_grenade_mp setSecondaryGrenades( self GetSecondaryGrenadeName(), grenadeCount ); (see console for details)


Please help me fix this because i'm [banghead]
And this is that part from _hardpoints.gsc:

Code:
}  setCarePackagePoint() {    grenadeCount = self getWeaponAmmoClip( self GetSecondaryGrenadeName() );    self takeWeapon( self GetSecondaryGrenadeName() );     if( self getOffhandSecondaryClass() == "flash" )       self setOffhandSecondaryClass( "smoke" );        self setSecondaryGrenades( "carepack_grenade_mp", 1 );          self ExecClientCommand( "+smoke" );    wait 0.05;    self ExecClientCommand( "-smoke" );     wait( 1 );        if ( self GetSecondaryGrenadeName() == level.weapons["flash"] )       self setOffhandSecondaryClass( "flash" );     self setSecondaryGrenades( self GetSecondaryGrenadeName(), grenadeCount ); }




edited on Jun. 30, 2012 09:23 am by rrider17
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Sunday, Jul. 1, 2012 01:25 pm
Code:

	if (!isDefined(grenadeCount))
		grenadeCount = 0;


Just think about that...
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Sunday, Jul. 1, 2012 01:30 pm
scillman writes...
Quote:
Code:

	if (!isDefined(grenadeCount))
		grenadeCount = 0;


Just think about that...


Uninitialized IS NOT undefined. (actually, it is, but its more than that, read on)

Undefined means that it has no value whatsoever.
Uninitialized means that the var has never been used before, and thus the engine cannot determine what kind of var (string, int, float, long) should be used.

You (startpost) copied something from somewhere without even reading what it does and assumed that it might work. It didnt, gave a clear error which you didnt understand.

Use grenadecount somewhere before, by giving it a value (scillmann's code doesnt fix this as that also error on "uninit var") like grenadecount=3;

Good luck
Share |
scillman
General Member
Since: Nov 23, 2006
Posts: 360
Last: Sep 1, 2012
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Sunday, Jul. 1, 2012 01:44 pm
Oops, sorry but he is right [banghead]
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

»