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

Members Online

»
0 Active | 85 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
Page
Next Page
subscribe
Author Topic: knife tutorial help
basketrobin_4
General Member
Since: Nov 30, 2008
Posts: 129
Last: Apr 4, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 09:23 am
hey,

i followed this tutorial : http://www.modsonline.com/Tutorials-read-636.html
this is my .gsc file:

Code:
#include common_scriptsutility;

#include maps_utility;

#include maps_anim;

#include maps_stealth_logic;


 main()  
{ 
 maps\_load::main(); 
 level.player giveWeapon ("mp5"); 
 level.player givemaxammo ("mp5"); 
 level.player setViewmodel( "viewhands_black_kit" );
 maps_stealth_logic::stealth_init();
 maps_stealth_behavior::main();
 knife_setup();

   }

#using_animtree("generic_human");
knife_setup()
{
 flag_init( "knife_sequence_starting" );
 flag_init( "knife_sequence_done" );

 precacheModel( "weapon_parabolic_knife" );

 level.player thread stealth_ai();

 createthreatbiasgroup( "friendly" );
 createthreatbiasgroup( "victims" );
 setignoremegroup( "friendly", "victims" );

 knifer_spawner = getent( "knifer", "targetname" );
 knifer_spawner add_spawn_function( ::stealth_ai );
 knifer_spawner add_spawn_function( ::set_ThreatBias_Group, "friendly" );
 level.knifer = knifer_spawner stalingradSpawn(); 

 level.knifeKillNode = getnode( "knife_node", "targetname" ); 
 knifee_spawner = getent( "knife_me", "targetname" ); 
 knifee_spawner add_spawn_function( ::AI_hostile_think );
 knifee_spawner add_spawn_function( ::stealth_ai );
 knifee_spawner add_spawn_function( ::set_ThreatBias_Group, "victims" );
 level.badguy = knifee_spawner stalingradSpawn();

 level._effect["knife_stab"] = loadfx ("misc/parabolic_knife_stab");
 level.scr_anim[ "knifer" ][ "knifekill" ]    = %ICBM_patrol_knifekill_winner;
 level.scr_anim["hostile"][ "phoneguy_idle_start" ]   = %patrol_bored_idle_cellphone;
 level.scr_anim["hostile"][ "phoneguy_idle" ][0]    = %patrol_bored_idle_cellphone;
 level.scr_anim["hostile"][ "phoneguy_alerted" ]    = %parabolic_phoneguy_reaction;
 level.scr_anim["hostile"][ "phoneguy_death" ]    = %ICBM_patrol_knifekill_looser;
}

begin_knife()
{
 level.badguy thread AI_hostile_knife_kill_think();
 level.badguy waittill( "death" );
 level.flag_set( "knife_sequence_done" );
}

AI_hostile_think()
{
 self endon( "death" );
 
 self.animname = "hostile";
 self.allowdeath = true;
 self.ignoreme = true;
 self.health = 1;
 self thread stealth_enemy_endon_alert();
 
 level.knifeKillNode  anim_reach_solo( self, "phoneguy_idle_start" );
 level.knifeKillNode thread anim_loop_solo( self, "phoneguy_idle", undefined, "stop_idle" );
 
 
 self waittill( "stealth_enemy_endon_alert" );
 
 self setthreatbiasgroup();
 self.ignoreme = false;
 level.knifer.ignoreAll = false;
 level.knifeKillNode  notify( "stop_idle" );
}

AI_hostile_knife_kill_think()
{
 self endon( "death" );
 self endon( "stealth_enemy_endon_alert" );

 level.knifer setgoalpos( self.origin );
 flag_set( "knife_sequence_starting" );
 
 level.knifeKillNode anim_reach_solo( level.knifer, "knifekill" );
 
 self thread knife_kill_fx();
 self thread AI_hostile_knife_kill_abort_think();
 level.knifer attach( "weapon_parabolic_knife", "TAG_INHAND" );
 level.knifer playsound ( "scn_icbm_knife_melee" );
 
 level.knifeKillNode thread anim_single_solo( level.knifer, "knifekill" );
 level.knifeKillNode thread anim_single_solo( self, "phoneguy_death" );
 
 time =  getanimlength( self getanim( "phoneguy_death" ) );
 time -= 2.75;
 self delaythread( time, ::AI_hostile_knife_kill_finish_anim );
 self delaythread ( time, ::set_ignore_all );
 
 level.knifeKillNode waittill( "phoneguy_death" );
 
 level notify( "knife_kill_done" );
 level.knifer.ignoreAll = false;
 level.knifer setgoalpos( level.knifer.origin );
 level.knifer stopanimscripted();
 
 self.a.nodeath = true;
 self.allowdeath = true;

 self dodamage( self.health + 50, ( 0, 0, 0 ) );
}

AI_hostile_knife_kill_finish_anim()
{
 self endon( "stealth_enemy_endon_alert" );
 
 self notify( "_stealth_stop_stealth_logic" );
 self.allowdeath = false;
 self.a.nodeath = true;
}
set_ignore_all()
{
 self.ignoreall = true;
}

set_threatbias_group( group )
{
 assert( threatbiasgroupexists( group ) );
 self setthreatbiasgroup( group );
}

AI_hostile_knife_kill_abort_think()
{
 flag_wait( "knife_sequence_starting" );
 
 self waittill_either( "death", "stealth_enemy_endon_alert" );
 level.knifer detach( "weapon_parabolic_knife", "TAG_INHAND" );
 level.knifer stopanimscripted();
}

knife_kill_fx()
{
 self endon( "death" );
 
 self waittillmatch( "single anim", "knife hit" );
 playfxontag( level._effect[ "knife_stab" ], self, "j_neck" );
}


and i get this error:
Error:
******* script compile error *******
Error: bad syntax: (file 'maps/sp_test3.gsc', line 56)
level.flag_set( "knife_sequence_done" );
*
************************************
Loaded zone 'sp_test3'
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
bad syntax
level.flag_set( "knife_sequence_done" );
(see console for details)

********************
ERROR: script compile error
bad syntax
level.flag_set( "knife_sequence_done" );
(see console for details)


i'm not an advanced scripter but i really want to do this so plz help :)


edited on Oct. 3, 2009 05:24 am by basketrobin_4
Share |
pinedsman
General Member
Since: Feb 27, 2007
Posts: 85
Last: Nov 28, 2012
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 12:48 pm
Hmm, that's supposed to be
flag_set( "knife_sequence_done" );

not:
level.flag_set( "knife_sequence_done" );

must have been a typo while I was making the tutorial. Could a moderator correct this in the tutorial as well? Thanks.

Sorry about that.
Share |
pinedsman
General Member
Since: Feb 27, 2007
Posts: 85
Last: Nov 28, 2012
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 01:23 pm
Also these lines

#include common_scriptsutility;
#include maps_utility;
#include maps_anim;
#include maps_stealth_logic;

Should be:
#include common_scripts\utility;
#include maps\_utility;
#include maps\_anim;
#include maps\_stealth_logic;

If that could be corrected too, I would appreciate it. Thanks!
Share |
basketrobin_4
General Member
Since: Nov 30, 2008
Posts: 129
Last: Apr 4, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 07:23 pm
ow i get this error:

script runtime error *******
size cannot be applied to undefined: (file 'maps/_utility.gsc', line 5410)
self.spawn_functions[ self.spawn_functions.size ] = func;
*
Error: called from:
(file 'maps/sp_test3.gsc', line 36)
knifer_spawner add_spawn_function( ::stealth_ai );
*
Error: called from:
(file 'maps/sp_test3.gsc', line 17)
knife_setup();
*
Error: started from:
(file 'maps/sp_test3.gsc', line 6)
main()
*
Error: ************************************
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 runtime error
(see console for details)
size cannot be applied to undefined
********************
ERROR: script runtime error
(see console for details)
size cannot be applied to undefined
Share |
pinedsman
General Member
Since: Feb 27, 2007
Posts: 85
Last: Nov 28, 2012
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 07:54 pm
It means you don't have an spawner with a key/value "targetname" : "knifer"

did you set up your map properly?
Share |
basketrobin_4
General Member
Since: Nov 30, 2008
Posts: 129
Last: Apr 4, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Saturday, Oct. 3, 2009 08:34 pm
yes, i have one in my map :)

so i don't understand the error
Share |
pinedsman
General Member
Since: Feb 27, 2007
Posts: 85
Last: Nov 28, 2012
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Sunday, Oct. 4, 2009 03:40 am
Did it have the spawner box checked?
Share |
basketrobin_4
General Member
Since: Nov 30, 2008
Posts: 129
Last: Apr 4, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Sunday, Oct. 4, 2009 11:43 am
no, stupid of me
and now i get tis error:

******* script runtime error *******
undefined is not an object: (file 'maps/sp_test3.gsc', line 72)
level.knifeKillNode anim_reach_solo( self, "phoneguy_idle_start" );
*
Error: called from:
(file 'maps/_spawner.gsc', line 843)
thread [[ func[ "function" ] ]]();
*
Error: called from:
(file 'maps/_spawner.gsc', line 804)
thread run_spawn_functions();
*
Error: called from:
(file 'maps/_spawner.gsc', line 787)
spawn thread spawn_think( self.targetname );
*
Error: started from:
(file 'maps/_spawner.gsc', line 765)
self waittill( "spawned", spawn );
*
Error: ************************************
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 runtime error
(see console for details)
undefined is not an object
********************
ERROR: script runtime error
(see console for details)
undefined is not an object
Share |
pinedsman
General Member
Since: Feb 27, 2007
Posts: 85
Last: Nov 28, 2012
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Sunday, Oct. 4, 2009 02:01 pm
do you have a node_scripted with a key/value of "targetname" : "knife_node" ?
Share |
basketrobin_4
General Member
Since: Nov 30, 2008
Posts: 129
Last: Apr 4, 2011
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Sunday, Oct. 4, 2009 04:02 pm
i didn't had it :p
but now he doesn't give any errors but he just shoot him. Not knife.

I think it's something with call the function how do you do that ?
Share |
Restricted Access Topic is Locked
Page
Next Page
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

»