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

Members Online

»
0 Active | 23 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 2
Category: CoD2 MP Mapping
CoD 2 mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Does exploder script work on prefabs
rob034
General Member
Since: Jan 30, 2007
Posts: 72
Last: Mar 5, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 12:06 pm
I am making a new map and in the map I have a birdge over a small canal. The idea is to have the SD spawn point for the attackers at 1 side of the water and the targets at the other side. The easiest way to the targets is crossing the bridge but to make things more difficult for the attacking team I want to have the option to destroy the bridge by the defenders. A bit like in the map Commando where you need to detonate the bomb on the gate to let it explode so you can go through it. I have made a bridge as prefab and placed it in my map.

Having taken a look at the script used in this map it doesn't use the exploders script but deletes the gate and shows the destroyed parts.

I have seen the exploder tut and wondered if I could convert the prefab in such a way to incorporate the items of the exploder tut into it. Make a prefab of a destroyed bridge and do the same and make it appear when the explosion occurs.

If some of you have experience with this I would like to know.

Thanks in advance

edited on Mar. 4, 2010 07:09 am by rob034
Share |
techno2sl
General Member
Since: Aug 5, 2004
Posts: 2977
Last: Oct 14, 2010
[view latest posts]
Level 9
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 12:43 pm
Enter the prefab of your bridge - Exploders in different prefabs will not work together.

I could have exploder 1 in the map - and exploder 1 in a prefab, they won't work in game.

The reason for this (I assume) is so that, let's say you make a prefab of a destroyable fence (so the fence is script exploders and just saved and loaded into your map as a prefab), you could have that fence copied multiple times, now all the fences have script_exploder blah on them but when you compile an run, you shoot one and only one will destroy/explode.

So what's happening I guess is the compiler changes the number on the exploder during compile to make them all different.
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 03:23 pm
well i know that in cod4 you can put some exploders into prefabs, idk if in cod2 it has that same feature. although you have to give them key values of
Code:

script_prefab_exploder
# ( <--- the number of our choice )


of course if you have another exploder in your map with the same value as the script prefab, then both will blow up as the same time that whenever you call either one of them.

hope that helps.
Share |
rob034
General Member
Since: Jan 30, 2007
Posts: 72
Last: Mar 5, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 04:19 pm
So I have done the following.

1. I created a prefab of the bridge and selected all brushes and made them a script-brushmodel. I named them bridge.
2. I created a second prefab, this time of a destroyed bridge, selected again all brushes and made them a script_brushmodel and named these bridge_destroyed.
3. I placed both prefab models on exact the same location in my map.
4. I created another prefab to be used as detonator, the handle of the detonator I made a script_brushmodel again and named it detonator_up.
5. I placed the trigger prefab in my map and place a trigger_use around it. Named the trigger -> trigger_bridge

Saved the map and made the following script

Code:

main()
{
// load fx
level._effect["water_explosion"] = loadfx ("fx/explosions/dock_explosion.efx");
level._effect["bridge_explosion"] = loadfx ("fx/explosions/eldaba_boat_explosion.efx");
level._effect["water_hit"] = loadfx ("fx/explosions/large_waterhit_rhine.efx");


// go to explosion thread
thread blow_bridge();
}

// explosion thread
blow_bridge()
{
// define the model before the explosion
before_exp = getent("bridge","targetname");

// define the model after the explosion
after_exp = getent("bridge_destroyed","targetname");

// Define the trigger
trigger = getent("trigger_bridge","targetname");

//Define the handle on the detonator
handle = getent(""detonator_up","targetname");

// Determine the location of the effect and sound
fxorigin_1 = getent("bridge_explosionfx","targetname");
fxorigin_2 = getent("water_explosion","targetname");
fxorigin_3 = getent("water_hit","targetname");


//show the bridge before the explosion as solid and hide the destroyed bridge
before_exp show();
before_exp solid():
after_exp hide();
after_exp notsolid();

// wait for the trigger to be activated and move the handle of the detonator
trigger waittill("trigger");
trigger playsound ("US_1_order_cover_detonation");
wait(2);
handle rotateyaw(-90, 0.2);
handle playsound("detone");

wait(0.3);

handle movez(-7, 0.2);
wait(0.2);
handle playsound("minefield_click");

// Play fx
playfx (level._effect["bridge_explosion"], fxorigin_1.origin);

// Create damage in the area
radiusDamage (fxorigin_1.origin, 2000, 2000, 0);

// Shake the earth in the area of the explosion
earthquake(0.3, 3, fxorigin_1.origin, 400);

// Play the explosion sounds
fxorigin_1 playsound ("exp_armoredcar");

//splash the water underneath and around the bridge
wait(0.1);
playfx (level._effect["water_explosion"], fxorigin_2.origin);
playfx (level._effect["water_hit"], fxorigin_3.origin);
fxorigin_2 playsound("truck_splash");

// Hide the model of the bridge from before the explosion and make it non solid
before_exp hide();
before_exp notsolid();

// Show the destroyed bridge after the explosion and make it solid
after_exp show();
after_exp solid();
}


When I run this a get an error "Bad syntax
Can some one tell me where it goes wrong.

edited on Mar. 4, 2010 11:19 am by rob034
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 07:21 pm
handle = getent(""detonator_up","targetname");

Let's see if you can spot it.
Share |
Pedro699
General Member
Since: Jun 19, 2006
Posts: 781
Last: Dec 18, 2010
[view latest posts]
Level 7
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 08:33 pm
Yup, /developer 1 helps in these situations.

Setting this before loading map will give you the error location straight away.
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 MP Mapping
Posted: Thursday, Mar. 4, 2010 08:50 pm
lol just tell him he put an extra set of quotes in the ( " " detatnotaor_...

also i think theres ways of having somethings in radiant do some of the job you have done in scripting but either way is fine. just saying in case you didnt know.
Share |
rob034
General Member
Since: Jan 30, 2007
Posts: 72
Last: Mar 5, 2010
[view latest posts]
Level 3
Category: CoD2 MP Mapping
Posted: Friday, Mar. 5, 2010 08:46 am
Thanks for the help, I managed to get a few of these typo's out of the script and now it comes up with a whole different error, see below:

Code:

********* script run time error *******
undefined is not an array, string, or vector, (file 'maps/mp/_load.gsc', line 113)
if (!isdefined (level._effect["latern_light"]))

called from:
(file 'maps/mp/_load.gsc', line 12)
laterns[i] thread laterns();

called from:
(file 'maps/mp/mp_veghel.gsc', line 3)
maps/mp/_load::main();

started from:
(file 'maps/mp/mp_veghel.gsc', line 1)
main()
*
********************************************


Do you guys have any idea what this is about?
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: CoD2 MP Mapping
Posted: Friday, Mar. 5, 2010 02:11 pm
In your main() function, add this before your level._effect definitions.

maps\mp\_load::main();
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 |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD2 MP Mapping
Posted: Friday, Mar. 5, 2010 11:37 pm
its not recognizing your array of light effects. i think this is maybe because theres one entity? if so then its getent( blah blah bla. Try and see if that works, or maybe u forgot to compile? idk re post your entire script so we can see what it really looks like.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 MP Mapping

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

»