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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Damage accumulation before trigger
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Thursday, Jul. 1, 2010 11:05 am
Hey.
When I want to trigger my script, I need to fire around 3 rounds with a MP44 before it starts working, but after I have done that, it works perfectly fine. It is supposed to be triggered when there is done more than 200 damage; the accumulate function in the editor didn't seem to work so I did it this way.
I tried adding the iprintln in to check where it went wrong.

And well... The trigger doesn't seem to respond to any damage taken in the beginning. It doesn't even write the messages with damage and total damage.

Code:
accumulate()
{
trig = getent("test_accumulate1","targetname");
box = getent("test_accumulate1_brush","targetname");
trig.accDamage = 0;

while(1)
{
trig waittill("damage",amount);
trig.accDamage = trig.accDamage + amount;
wait(0.005);
iprintln("Damage: ^1" +amount);
iprintln("Total Damage: ^1" +trig.accDamage);

if (trig.accDamage > 200)
{
	trig.accDamage = trig.accDamage - 200;
	box movez(200,1);
	box waittill("movedone");
	wait(3);
	box movez(-200,1);
	box waittill("movedone");
}
else iprintln("You did not do enough damage");
}
}


I tried making another trigger - which would just display damage given and the total damage (without getting reset or moving a box or anything). The same thing happened. Except that this time it took a lot longer time for them to activate. But then they both started working at the same time. The code for the other one is:

Code:
accumulate2()
{
trig = getent("test_accumulate2","targetname");
trig.accDamage = 0;

while(1)
{
trig waittill("damage",amount);
trig.accDamage = trig.accDamage + amount;
wait(0.005);
iprintln("Damage: ^1" +amount);
iprintln("Total Damage: ^1" +trig.accDamage);
}
}

Any ideas?
Share |
Uzumakibro93
General Member
Since: Sep 6, 2009
Posts: 118
Last: Jul 5, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Jul. 1, 2010 01:16 pm
Are you sure you're defining your variable labeled "amount"?
I see no references to it's size in the script...
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Thursday, Jul. 1, 2010 02:33 pm
Uzumakibro93 writes...
Quote:
Are you sure you're defining your variable labeled "amount"?
I see no references to it's size in the script...

trig waittill("damage",amount);

Amount = the amount of damage done. I found it by checking other mods and tutorials (the exploding barrel tutorial).

It is like using this:
Code:
trig waittill("trigger",player);
player iprintlnbold("you triggered this thing");


That part works fine.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Friday, Jul. 2, 2010 02:15 am
I've had similar trouble with trigger_damages. They're just uncooperative.
Share |
n3BuL
General Member
Since: Nov 10, 2008
Posts: 44
Last: Jul 2, 2010
[view latest posts]
Level 2
Category: CoD2 Scripting
Posted: Friday, Jul. 2, 2010 07:38 pm
So there's nothing that can be done to help it?
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»