Author |
Topic: how wierd :< |
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
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
|
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
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?
|
|
|
|
IzNoGoD |
General Member Since: Nov 29, 2008 Posts: 694 Last: Nov 10, 2012 [view latest posts] |
|
|
|
BraX |
|
General Member Since: Apr 29, 2008 Posts: 413 Last: May 26, 2012 [view latest posts] |
|
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
|
voidsource |
General Member Since: May 5, 2007 Posts: 1513 Last: Sep 1, 2013 [view latest posts] |
|
|
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. |
|
|
|
acedlol |
General Member Since: Jul 19, 2011 Posts: 18 Last: Aug 6, 2011 [view latest posts] |
|
|
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 |
|
|
|
Xylozi |
General Member Since: Jul 12, 2008 Posts: 218 Last: Mar 1, 2012 [view latest posts] |
|
|
|
|