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

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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: Working artillery system
XICXAC
General Member
Since: Jun 3, 2007
Posts: 91
Last: Mar 28, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Aug. 4, 2007 11:04 am
Hey guys. I'm trying to set up a working artillery system, that randomly plays an explosion effect on one of the script_origins with the targetname "artilleryspot" (random one in the array). I want this to work to fire like 30 - 40 shells every artillery barrage but when I try my script nothing happens.
Code:

level._effect["flak_artillery"] =  loadfx("fx/explosions/artilleryExp_dirt_libya.efx");
artillery_spots = getentarray("artilleryspot","targetname");
for(i=0;i>30;i++) { // play fx 30 times
wait(1);
rand = randomint(artillery_spots.size);
fx_origin = artillery_spots[rand] getorigin();
playfx(level._effect["flak_artillery"], fx_origin);
}

This is for sp. Can anyone tell me what's wrong?

edited on Aug. 4, 2007 07:04 am by XICXAC
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Saturday, Aug. 4, 2007 11:18 am
try

Code:
for(i=0;i<30;i++)


instead.
Share |
XICXAC
General Member
Since: Jun 3, 2007
Posts: 91
Last: Mar 28, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Aug. 4, 2007 11:23 am
omg... that easy? aja it worked.. thx
Share |
kalieck
General Member
Since: Aug 9, 2006
Posts: 161
Last: Feb 14, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Sep. 1, 2007 09:36 am
i also wanna make a ramdom artillery system ... can you maybe send the hole code and what i have to make in radiant .... thx
Share |
ahoji
General Member
Since: May 16, 2006
Posts: 74
Last: Jun 27, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Sep. 1, 2007 06:05 pm
I tryied do a script on artillery - randomly plays efx and do radius damage in origin ( still without making holes - but it won't be difficult)

mainly used script on making mortal holes
Code:

main()
{
level._effect["mortexplosion"] = loadfx("fx/explosions/artilleryExp_dirt_brown.efx");

thread bradio();
level.bombing = false;

}

bradio()
{
bradio=getent("bradio","targetname");
trig=getent("bradiotrig","targetname");

 while(1)
 {
 trig waittill ("trigger",other);

 if((isplayer (other)) && (other.pers["team"] == "allies") && !level.bombing)
 {
 level.bombing = true;
 bradio playsound("sound1sg");
 wait 5;
 bradio playsound("sound3sg");
 wait 5;
 thread bombing();
 }
 }
}

bombing()
{
 orig_boom = getentarray ("orig_boom","targetname");
 for(i=0;i<10;i=i+1)
 {
 k=randomint(31); //nums of origins on map + 1

 origin = orig_boom[k] getorigin();
 
 orig_boom[k] playsound("incoming_mortar");
 wait (1);

 orig_boom[k] playsound("explosion_ground");
 playfx(level._effect["mortexplosion"], origin);
 radiusDamage(origin, 200, 200, 100);

 wait (1);

 }
level.bombing = false;
}
Share |
kalieck
General Member
Since: Aug 9, 2006
Posts: 161
Last: Feb 14, 2009
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Sep. 2, 2007 11:13 am
what i have to make in radient?
Share |
ahoji
General Member
Since: May 16, 2006
Posts: 74
Last: Jun 27, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Sep. 2, 2007 04:56 pm
add some trigger , brushmodel for speaker and planty of origins with same targetname (but change line k=randomint to fit you)
Share |
XICXAC
General Member
Since: Jun 3, 2007
Posts: 91
Last: Mar 28, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Sep. 2, 2007 05:42 pm
Well here's my code. Before you add it to your source code, make a bunch of script_origins, all with the key/value of targetname/artilleryspot .

Now I made this an own function so you have to call it to get it working. In your code, write
Code:

thread artillery(10)
or
Code:
artillery(10)

The "10" means it will "fire" 10 shells.
you also need to add the main artillery function
Code:

artillery(shells) {
	artillery_spots = getentarray("artilleryspot","targetname");

	for(i=0;i<shells;i++) {
		wait(0.5 + randomfloat(1));
		rand = randomint(artillery_spots.size);

		origin = artillery_spots[rand] getorigin();
		playfx(level._effect["flak_artillery"], origin);
		if(distance(artillery_spots[rand].origin,level.player.origin) > 100) {
			level.player playsound("explosion_ground");
			earthquake(0.5, 2, level.player.origin, distance(artillery_spots[rand].origin,level.player.origin));
		}
	}
	}


The earthquake is just something i played with, and as I can't get the sounds working, there are no sounds played in this script. You gonna have to add that yourself.
Share |
Snake-nl
General Member
Since: May 30, 2004
Posts: 394
Last: Jan 23, 2011
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Nov. 3, 2007 02:42 pm
srry for using this topic but i have a question about the same subject.

i also want a artillery system. But this time i want to trigger it. so when the player hits the trigger the artillery must start.

i have made the origins and used the script of XICXAC and that works perfect (no sound yet but working on that) . only the artillery starts when the map starts.

now i made a trigger named:

Key: targetname
value: startartillery


And i use this code but i doens't work.

Code:

artillery()
{
	startartillery = getent ("startartillery", "targetname");
	trig = getent ("startartillery_trigger", "targetname");
	
	{
	trig waittill ("trigger");
	
	level._effect["flak_artillery"] =  loadfx("fx/explosions/artilleryExp_dirt_libya.efx");
	artillery_spots = getentarray("artilleryspot","targetname");
	for(i=0;i<30;i++) { // play fx 30 times
	wait(1);
	rand = randomint(artillery_spots.size);
	fx_origin = artillery_spots[rand] getorigin();
	playfx(level._effect["flak_artillery"], fx_origin);
	}
	}
}
Share |
XICXAC
General Member
Since: Jun 3, 2007
Posts: 91
Last: Mar 28, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, Nov. 13, 2007 06:02 pm
Try

Code:
artillery()
{
	startartillery = getent ("startartillery", "targetname");
	
	{
	startartillery waittill ("trigger");
	
	level._effect["flak_artillery"] =  loadfx("fx/explosions/artilleryExp_dirt_libya.efx");
	artillery_spots = getentarray("artilleryspot","targetname");
	for(i=0;i<30;i++) { // play fx 30 times
	wait(1);
	rand = randomint(artillery_spots.size);
	fx_origin = artillery_spots[rand] getorigin();
	playfx(level._effect["flak_artillery"], fx_origin);
	}
	}
}
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

»