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

Members Online

»
0 Active | 11 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
Category: CoD Mapping
CoD mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: sp tank problem
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Sunday, Feb. 11, 2007 04:54 am
Ok all fixed! [thumbs_up]
This new version is SP only, all FX are usable in both Cod and UO.

Here is a pic to prove it works :)

In the test map I had four tanks as targets, they all have to be destroyed for the obj1 to complete.
I was so worried about getting the final boom on the last tank that I forgot to get all the other tanks in the screenshot as well... LOL

To make it work from your own map gsc you may need to alter the obj parameters to suit.
This is all I used for testing.
test map gsc
Code:
main()
{
maps\_load::main();
level thread obj1();
}

obj1()
{
//this is just a script origin near the tanks
obj1 = getent("tank_obj", "targetname");
objective_add(1, "active", obj1.origin);
//I didnt bother with a compass, just set the obj for testing
objective_current(1);

//These are the two main lines you need to worry about
//for calling the additional tank obj script.
//The tank obj script will post a level notify when all targets
//are destroyed

level thread maps\my_SP_tank_obj::main();
level waittill("Targets destroyed");

objective_state(1, "done"); //Objective 1 is done
obj1 delete(); //Delete the origin
wait(2);
iprintlnbold("Tank Objective Complete, well done!");
}


And now for the updated tank obj script:

Code:
// Single player
// Destroy Single or multiple Tanks objective script
// By Grassy

main()
{

	//All effects are Cod and UO usable
	level._effect["tankmetalexp"]	   = loadfx ("fx/explosions/tank_explosion.efx");
	level._effect["smallfire"] = loadfx ("fx/fire/tinybon.efx");
	level._effect["ashsmoke"] = loadfx ("fx/smoke/ash_smoke.efx");
  level._effect["steam"] = loadfx ("fx/smoke/whitesmoke_straight.efx"); 


	//Trigger_damage triggers on the tank/s
	//all targetnames MUST be "tank_trig"
	//all triggers MUST target UNDAMAGED tank/s
	
	trig = getentarray("tank_trig", "targetname");
	if(isDefined(trig))
	{
    level.target_num = trig.size;
    level.target_count = 0;
    
	  if(trig.size > 1)
	  {
	    for(a = 0 ; a < trig.size ; a++)
	      trig[a] thread tank_effects();
    }
    if(trig.size == 1)
      trig[0] thread tank_effects();

    thread monitor_targets();
    level waittill("Targets destroyed");
	}
}

monitor_targets()
{
  while(1)
  {
    wait(0.5);
  	if(level.target_count == level.target_num)
		{
		  level notify("Targets destroyed");
		  break;
		}
	}
}

tank_effects()
{
	//If any of these entities are missing exit safely from the script
	
  //Undamaged tank model targeted from it's trigger_damage
  //make the model a script_model
  
	goodmodel = getent(self.target, "targetname");
	if(!isDefined(goodmodel))
   return;

   
  //Destroyed tank model targeted from Undmaged model
  //make the model a script_model
  
	destroyedmodel = getent(goodmodel.target, "targetname");
	if(!isDefined(destroyedmodel))
   return;

   
  //Script origin targeted from Destroyed model
  //place the origin where fx will play on tank
  
 	fxpos = getent(destroyedmodel.target, "targetname");
	if(!isDefined(fxpos))
   return;
	
	//Hide the destroyed model
	destroyedmodel hide();
   
	//Get the fx origin to play effects on   
	fxpos_org = fxpos getorigin();

	//Define a few variables
	hit_count = 0;
	level.fx = true;
  
	//Loop until damage level reaches 90 then exit loop		   
	while(1)
	{
   		
		//waits here for each hit on the trigger
		self waittill("trigger");

		//Increment the variable hit_count by 30
		//this is for panzerfaust hits as they will cause a lot of damage each hit
		//and three hits should be enough to kill a tank
		hit_count += 30;
		
		//When the hit_count reaches 30 play a small smoke fx
		if(hit_count == 30)
		{
			thread loopfx("ashsmoke", fxpos_org, 0.5, 1);
		}
		
		//When hit_count reaches 60 increase the fx a little more
		if(hit_count == 60)
		{
			//level.fx = false;
			//wait(0.5);
			//level.fx = true;
			thread loopfx("steam", fxpos_org, 0.5, 1);
			thread loopfx("smallfire", fxpos_org, 0.3, 1);
		}

		//When we get to 90 play a nice BOOM!
		//then delete the goodmodel and show the damaged one
		//and exit the main loop, trigger is still there but dosn't do anything
		if(hit_count == 90)
		{
			wait(2);
			thread loopfx("steam", fxpos_org, 0.5, 1);
			playfx(level._effect["tankmetalexp"], (fxpos_org));
			goodmodel delete();
			destroyedmodel show();
	    level.target_count += 1;
	    break;
		}
	
	}
}	
	
   

loopfx(fxId, fxPos, waitime) {
if( (!isDefined(fxPos)) || (!isDefined(fxId)) )
   return;
if(!isDefined(waitime))
   waitime = 1;

   while (level.fx) {
      playfx(level._effect[fxId], fxPos);
      wait (waitime);
   }
 }
 


In the editor:
You only need to add targetnames to the triggers (trigger_damage) themselves, all the rest will adopt their own targetnames when they are targeted.

Order of targeting:
[trigger]----->[goodmodel]----->[destroyed model]------>[script origin]----->[info null]

The tank models I used for testing were:
Good model
xmodel/static_vehicle_tank_tiger
Destroyed model
xmodel/static_vehicle_tank_tiger_d

Good luck with it, I hope you all find it useful.
Grassy

edited on Feb. 10, 2007 11:56 pm by WHC_Grassy
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoD Mapping
Posted: Wednesday, Feb. 14, 2007 09:30 pm
Anyone tried this yet? [biggrin]
Share |
ilikepotatoes
General Member
Since: Jan 30, 2007
Posts: 35
Last: Dec 3, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Wednesday, Feb. 28, 2007 06:41 am
lol, sorry if it seemed like i didn't care, i didn't notice that there was a page 2 to this thread, my bad. Anyway, thanks for your script, you rock, testing now!
Share |
ilikepotatoes
General Member
Since: Jan 30, 2007
Posts: 35
Last: Dec 3, 2009
[view latest posts]
Level 2
Category: CoD Mapping
Posted: Sunday, Mar. 4, 2007 06:30 am
The script works a treat! I couldn't thank you more for it, Grassy. There's just one tiny little problem. The effects have no sound. The smoke, fire and the final explosion are all silent ... a bit of a turnoff. Does anyone know how to fix this? If this is solved then this script would be perfect!
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty : CoD 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

»