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

Members Online

»
0 Active | 56 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
Page
Next Page
subscribe
Author Topic: how wierd :<
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 08:50 am
Okay, so in this map I have a simple breakable wall.

I do this using this script:

main()
{
thread breakableWall();
}

breakableWall()
{
normalbrush = getEnt("normalbrush", "targetname");
wall = getEnt("damageTrigger", "targetname");
wall waittill("trigger");
normalbrush hide();
normalbrush notSolid();
}

--------

Normalbrush being the wall to be destroyed, and wall being the damage trigger.

When I want this wall, to say have 200 damage over its life time, I want it to vanish, so surely I should use accumulate and threshold to do this?

Problem is when I set it to accumulate I can be there for 10 minutes spamming infinite deagle ammo straight into it, but nothing happens, and when a nade is thrown it vanishes like it should do. However in this map, there will be only guns, so I want this wall to be destroyed after say 5-20 bullets. The closest I got was a threshold of 45, it took around 4 bullets of AKU ammo from long range, but only 1 from close in. If I take this threshold any higher, I get the same error as the accumulate error, it doesn't blow up for anything but a grenade.

Could I change this:

wall waittill("trigger");

to:

wall waittill("hurt" 200);

? Or something equivalent?

Need help please :)

Thanks

[cry]
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 08:54 am
breakablewall()
{
health=200;
while(health>0)
{
wall waittill("damage",dmg)
health-=int(dmg);
}
normalbrush notsolid();
normalbrush hide();
}
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 09:07 am
IzNoGoD writes...
Quote:
breakablewall()
{
health=200;
while(health>0)
{
wall waittill("damage",dmg)
health-=int(dmg);
}
normalbrush notsolid();
normalbrush hide();
}


Getting bad syntax at:

health-=int(dmg);

However I don't see how that script works without:

normalbrush = getEnt("normalbrush", "targetname");
wall = getEnt("damageTrigger", "targetname");

Surely I have to give the health value to the normalbrush?

Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 12:30 pm
Ye you have to add those 2 lines ofcourse.
Also, add a ; after the line with the waittill, it will solve the syntax error.
Share |
BraX
General Member
Since: Apr 29, 2008
Posts: 413
Last: May 26, 2012
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 12:40 pm
Remove trigger_damage, you dont need it if you use this script:

Code:
breakablewall()
{
	brush = getEnt( "normalbrush", "targetname" ); 

	brush setCanDamage( true ); // enable damage tracking
	health = 400;

	while( health )
	{
		brush waittill( "damage", dmg );
		health -= dmg;
	}

	brush notsolid();
	brush hide();

	brush setCanDamage( false ); // don't take more damage
}
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 04:17 pm
Say if I needed to create hundreds of these blocks, I cannot just copy+paste and change the targetname everytime ? Thanks for your help so far, beginning to understand this scripting lark :P
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Thursday, Jul. 21, 2011 07:27 pm
Hmm, on further inspection, brax's script isn't working on some occasions, like in promod, and with certain guns on the stock game. I will try the other one, and learn arrays? As I heard that's how you assign one function to a range of things [banghead]
Share |
voidsource
General Member
Since: May 5, 2007
Posts: 1513
Last: Sep 1, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Friday, Jul. 22, 2011 04:50 am
i dont do mp but i can try and modified just a bit to what has already been posted to see if it will work for u. try this:

Code:


breakablewall()
{
       //our array of brushes
	brushes = getentarray( "normalbrush", "targetname" ); 
        for( i = 0; i < brushes.size; i++ )
                  brushes[i] thread damage_count();
}

damage_count()
{
        self.health = 400;
	self setCanDamage( true ); // enable damage tracking
	
	while( self.health > 1 )
	{
		self waittill( "damage", dmg );
		self.health = self.health -- dmg;

                if( self.health =<  0 )
                 {
                         self notsolid();
                         self hide();
                         self setcandamage( false );
                          break;
                  }

                 wait .015;
	}

}



not sure about this part "if( self.health =< 0 )"

alternatively if your gonna make it like that where its just a one time use just use an exploder in your map. would be much more easier and less scripting. just saying.
Share |
acedlol
General Member
Since: Jul 19, 2011
Posts: 18
Last: Aug 6, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Friday, Jul. 22, 2011 10:22 am
Hmm, several syntax errors in there, first one popped up at:

self.health = self.health -- dmg;

Changed the -- to the - (not sure if thats right), then that worked but I got the error at :

if( self.health =< 0 )

Removed the = (again probably stupid), and I got another error at the wait command.

It might help explaining what I want to do first,



I want to create loads of these boxes between two spawns, and then the players must choose whatever route they want to kill people. This will be on promod. I have calculated that there are 700 boxes, probably more. I don't mind given them separate target names, but I'm not sure what script is more appropriate.

One of the biggest problems that I have so far (only tested with Brax's) is that if you rapid fire at the box, it doesn't take in the information, and doesn't vanish in the end. You have to shoot relatively slowly, but also some guns don't work, like sniper for example. Which is really wierd. I did try using exploders but I got another syntax error, so if anyone can at least point me in the right direction I would be very grateful :>

edited on Jul. 22, 2011 06:50 am by acedlol
Share |
Xylozi
General Member
Since: Jul 12, 2008
Posts: 218
Last: Mar 1, 2012
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Friday, Jul. 22, 2011 11:52 am
Your going to hit the entity limit if you have 700+ boxes. Do you really need that many?
Share |
Restricted Access Topic is Locked
Page
Next Page
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

»