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

Members Online

»
1 Active | 58 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 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: World at War
Category: CoDWW Scripting
Scripting and coding with Call of Duty: World at War.
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: Auto turret health help
[ZCT]Titan
General Member
Since: Feb 23, 2009
Posts: 172
Last: Apr 5, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Tuesday, Jul. 27, 2010 02:39 pm
Ok,so i need help yet again on adding a set health to the turret i have in my map and making it so the players nades and bullets hurt it. I also want to reset the wait so if you destroy it with the menu it resets the time so the next time you place it it waits the full 60 secs and not like 10 of the left over time from the last one and i have tried everything and cant figure it out.

And they also shoot players if your infront of the zombie it targets lol. Cant figure that out either.

Code:
SetupTurret()
{
    pos = self.origin;
	self endon("kill_turret");
	self endon("joined_spectators");
	self endon("disconnect");
	self endon("death");
    weaponinfo = "30cal_bipod_prone";

	if( isDefined(self.turret_gun) )
	{
	 self iPrintLn("^1You already have a turret spawned.");
	 return;
	}

	iprintln("^1" + self.playername + " ^7deployed a defence turret." );

	self.turret_bipod = spawn( "script_model", pos );
	self.turret_gun = spawnTurret( "misc_turret", pos + (0, 0, 30), weaponinfo );

	self.turret_gun setModel( "weapon_minigun" );
	self.turret_bipod setModel( "sentry_bipod" );

	self.turret_gun setContents( 0 );
	self.turret_bipod setContents( 1 );
	self.turret_gun.targetname = "test"+self.entity_num;
	self.turret_gun.owner = self;
	//self.turret_gun thread CheckForPlayers();
	//elf.turret_gun thread rotate();
	self.turret_gun thread shoot(self);
	self.fx_or = spawn("script_model",(0,0,0));
	self.fx_or.origin = self.origin;
	self.fx_or setmodel("tag_origin");
	self.fx_or.angles = (-90,0,0);
	playFXOnTag( level._effect["zombie_turret_base"], self.fx_or, "tag_origin" );
	playsoundatposition("sentry", (0,0,0));
	
	self thread turretwatch( self, self.turret_gun );
	self thread turretwatch( self, self.turret_bipod );


	wait 60;
	self.turret_gun delete();
	self.turret_bipod delete();
	self.fx_or delete();

	self.turret_gun notify("kill_turret");
	self notify("kill_turret");
}

turret_delete()
{
	self.turret_gun delete();
	self.turret_bipod delete();
	self.fx_or delete();
}

shoot(player)
      {
   tgtname = "test"+player.entity_num;
   mgs = getentarray( tgtname, "targetname" );
	for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
	  mg.owner = self;
      mg setTurretTeam( "allies" );
      mg SetMode( "auto_nonai" );
      mg thread maps\_mgturret::burst_fire_unmanned();
   }
   wait(60); // Leave turrets on for 30 seconds
   for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
      mg notify("stop_burst_fire_unmanned");
      mg SetMode( "manual" );
   }
}

turretwatch(player, mine)
{
	self endon("joined_spectators");
	self endon("disconnect");
	self endon("spawned");
	self endon("kill_turret");

	player waittill("death");
	mine delete();
}



Any help would be great guys.

Titan
Share |
[ZCT]Titan
General Member
Since: Feb 23, 2009
Posts: 172
Last: Apr 5, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 06:31 am
bump? :o
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 07:30 am
Lol, I love how ages ago when I gave Brax my turret code for cod2, parts of it are now turning up in everyones "turret" scripts.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 09:49 am
Im unclear what you are wanting, but if I do understand you correctly, try this:

Code:
SetupTurret()
{
    pos = self.origin;
	self endon("kill_turret");
	self endon("joined_spectators");
	self endon("disconnect");
	self endon("death");
    weaponinfo = "30cal_bipod_prone";

	if( isDefined(self.turret_gun) )
	{
	 self iPrintLn("^1You already have a turret spawned.");
	 return;
	}

	iprintln("^1" + self.playername + " ^7deployed a defence turret." );

	self.turret_bipod = spawn( "script_model", pos );
	self.turret_bipod setModel( "sentry_bipod" );
	self.turret_bipod setContents( 1 );
	
	self.turret_gun = spawnTurret( "misc_turret", pos + (0, 0, 30), weaponinfo );
	self.turret_gun setModel( "weapon_minigun" );
	self.turret_gun setContents( 0 );
	self.turret_gun.targetname = "test"+self.entity_num;
	self.turret_gun.owner = self;
	self.turret_gun thread shoot(self);
	self.turret_gun thread 
	
	self.fx_or = spawn("script_model",(0,0,0));
	self.fx_or.origin = self.origin;
	self.fx_or setmodel("tag_origin");
	self.fx_or.angles = (-90,0,0);
	playFXOnTag( level._effect["zombie_turret_base"], self.fx_or, "tag_origin" );
	playsoundatposition("sentry", (0,0,0));
	
	self thread turretwatch( self, self.turret_gun );
	self thread turretwatch( self, self.turret_bipod );


	wait 60;
	self.turret_gun delete();
	self.turret_bipod delete();
	self.fx_or delete();

	self.turret_gun notify("kill_turret");
	self notify("kill_turret");
}

sentry_damage()
{
	self endon("death");
	self endon("end_sentry_turret");

	self setCanDamage(true);
	self.maxhealth = 999999;
	self.health = self.maxhealth;
	attacker = undefined;

	while(1)
	{
		self waittill( "damage", dmg, attacker );
		
		if(dmg < 5)
			continue;

		self.owner.sentryTurretDamageTaken += dmg;

		if(self.owner.sentryTurretDamageTaken >= level.sentryTurretHealth)
			break;
	}
	
	if( !isDefined(self) )
		return;

	self.owner thread sentry_explode();
}

turret_delete()
{
	self.turret_gun delete();
	self.turret_bipod delete();
	self.fx_or delete();
}

shoot( player )
{
   tgtname = "test"+player.entity_num;
   mgs = getentarray( tgtname, "targetname" );
	for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
	  mg.owner = self;
      mg setTurretTeam( "allies" );
      mg SetMode( "auto_nonai" );
      mg thread maps\_mgturret::burst_fire_unmanned();
   }
   wait(60); // Leave turrets on for 30 seconds
   for(i=0;i<mgs.size;i++)
   {
      mg = mgs[i];
      mg notify("stop_burst_fire_unmanned");
      mg SetMode( "manual" );
   }
}

turretwatch(player, mine)
{
	self endon("joined_spectators");
	self endon("disconnect");
	self endon("spawned");
	self endon("kill_turret");

	player waittill("death");
	mine delete();
}


That sets a function so that the turret takes damage from an attacker. For it to work, it depends whether zombie mode/CoOp has the same functions for damaging an entity (I believe it does so it should work).
Share |
[ZCT]Titan
General Member
Since: Feb 23, 2009
Posts: 172
Last: Apr 5, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 10:27 am
Thanks demon ill try that later and see if it works.

MattY i love how because you see something named the same in your old script you assume all the scripts are using yours. Thats like saying you put in
Code:
 players[i] hasperk("etcetc")
in your script anyone elses script is copying yours. Like i said before please dont come on my topics starting issues im here to get help. Not get into fights over scripts.

Titan
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 10:38 am
[ZCT]Titan writes...
Quote:
Thanks demon ill try that later and see if it works.

MattY i love how because you see something named the same in your old script you assume all the scripts are using yours. Thats like saying you put in
Code:
 players[i] hasperk("etcetc")
in your script anyone elses script is copying yours. Like i said before please dont come on my topics starting issues im here to get help. Not get into fights over scripts.

Titan


No, the custom named functions are the same or are you gonna say that coincidence? For example the "turretwatch" function was orginally written for my mines, hence the "mine" parameter + lots of other stuff in there is the same.

I'm not starting an argument, it's just nice to see my talent being used in other peoples work!

Share |
[ZCT]Titan
General Member
Since: Feb 23, 2009
Posts: 172
Last: Apr 5, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 10:43 am
Yes that function is yours im not taking it from you but for the most part the rest of the code isnt yours. Just the way you are wording your response to my topics seem like you are trying to start stuff with me.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 10:47 am
A compromise would be to credit Matty for the functions he did create.

BTW - you should always expect modders to stand up for code that is theirs when they see it used without their knowledge or credits to them.
Share |
[ZCT]Titan
General Member
Since: Feb 23, 2009
Posts: 172
Last: Apr 5, 2011
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 11:07 am
Thing is demon my understanding was it was brax's code so i gave brax the credit now that i know its MattYs i will give credit where credit is due or if its that much of a problem ill jsut rewrite the whole turret script and remove all the code he keeps talking about. I understand its his and he wants credit and i plan to give him the credit he needs. But spamming all my topics about the turret with the fact it is his and all that is a little annoying if you get what im saying the last time he said that i told him i would give credit and if he didnt want me using it then i would take it out. But he doesnt pay attention to what i say.
Share |
tHMatt
General Member
Since: Sep 11, 2007
Posts: 473
Last: Mar 20, 2013
[view latest posts]
Level 5
Category: CoDWW Scripting
Posted: Sunday, Aug. 1, 2010 11:19 am
I am not spamming anything, I simply mentioned that "oh my code is in there" as it was a shock as I didnt think brax had released it... I dont care your using it, I never released my cod2 mod so it's nice to see some of the work I put in being used for something constructive. I can see your not using the full code, as my code was build to target player clients and not bots, but its still very easy to notice my "mistakes" in the code to easily detect, even with your dissection, that it is still mine :)

For the record, I never EVER release my scripts due to the amount of people in the broken COD2 community who will just rip open the IWD and steal everything and pose it as their own, which happens day on day with the 12 year old kids who are "COOL MODDERS" - This also added to my sudden posting on the topic, as I'm very defensive towards anything I code.

Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty: World at War : CoDWW 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

»