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

Members Online

»
0 Active | 66 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: Creating a list and adding to it
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Wednesday, Mar. 23, 2011 02:43 am
I'm trying to make a list and add integers to it, and also check if an element is in the list, but I don't know the syntax for that in CoD-code.
Share |
zbw
General Member
Since: Jan 2, 2011
Posts: 22
Last: Mar 23, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Wednesday, Mar. 23, 2011 05:10 am
i don't know how to build a list in gsc
but ,there are lot of array related func in _utility.gsc
such as array_reverse() array_add() and so on
maybe they will help you
Share |
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Wednesday, Mar. 23, 2011 07:20 am
I found a list in killhouse_code and implemented it, here's the gist of it (initializing the list and adding an element to a specific index). It may not work for other applications, but it worked for me.
Code:
dummysAlive = [];
dummysAlive[i] = selection;

And this is just what I did for the check, but I'd rather use a built in function if there is one.
Code:
is_in(element, list)
{
	for (i=0;i<list.size;i++)
	{
		if (element == list[i])
			return true;
	}
	return false;
}
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Wednesday, Mar. 23, 2011 07:53 am
Code:

randomarray[randomarray.size]=var;
Share |
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Mar. 24, 2011 10:53 pm
Thanks, but I don't really need it since what I have works fine.

Another question, would anybody know how I'd go about getting the game to waittill trigger1 or trigger2 is triggered?

i.e.
Code:
trigger1 or trigger2 waittill ( "trigger" );
Share |
Samuel033
General Member
Since: Dec 10, 2009
Posts: 484
Last: Dec 25, 2015
[view latest posts]
Level 5
Category: CoD4 Scripting
Posted: Friday, Mar. 25, 2011 08:09 am
Look at the detect icon waiter thread in weapons gsc for an example. It controls the clay head icons when a bombsquad player is in a close enough range to see it.
Share |
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Friday, Mar. 25, 2011 04:16 pm
I couldn't find what you meant to look for in that function, but I came up with this the other day. Is this the best way to do it, or is there a better way?

Code:
	trigger = getEntArray ( targets[selected_target].target, "targetname" );	
	flag_clear( "dummy_killed" );
	thread trigger1( trigger[0] );
	thread trigger2( trigger[1] );
	flag_wait( "dummy_killed" );
	level notify ( "dummy_killed" );
Code:
trigger1( trigger_1 )
{
	level endon ( "dummy_killed" );
	trigger_1 waittill ( "damage" );
	flag_set( "dummy_killed" );
}

trigger2( trigger_2 )
{
	level endon ( "dummy_killed" );
	trigger_2 waittill ( "damage" );
	flag_set("dummy_killed");
}
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Friday, Mar. 25, 2011 06:08 pm
Code:

main()
{
	trigger=getentarray(targets[selected_target].target,"targetname");
	for(i=0;i<trigger.size;i++)
		trigger[i] thread trig();
	level waittill("dummy_killed");
}

trig()
{
	level endon("dummy_killed");
	self waittill("damage");
	level notify("dummy_killed");
}

try this
Share |
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Saturday, Mar. 26, 2011 12:27 am
Thanks.

Now I've got NPCs' firing at targets with a make-shift accuracy using magicbullet, but when they "fire" it doesn't show them firing, holding up their gun, or reloading once they've unloaded their magazine.

Is there another way to force AI to shoot at a target (with one shot at a time)? Or how would I get them to do all of those anims without scripting it?
Share |
EraVulg
General Member
Since: Mar 10, 2011
Posts: 25
Last: Mar 29, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Mar. 29, 2011 10:09 pm
I found this line in cargoship's gsc files to make the AI shoot.
Code:
self shoot();	

And this to set their target/make them aim.
Code:
self setentitytarget ( trigger[0] );
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

»