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

Members Online

»
0 Active | 52 Guests
Online:

LATEST FORUM THREADS

»
re: enabling cheats on Eli...
Star Trek Voyager: Elite F...
Using Teamspeak
Teamspeak Servers
eXtreme+ v2.9
CoDBO Map + Mod Releases

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: CoDUO Mapping
CoD United Offensive mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: trigger_damage - getting info on the player doing the damage
|DA|DarkDilbert
General Member
Since: Jun 5, 2006
Posts: 675
Last: Apr 29, 2008
[view latest posts]
Level 6
Category: CoDUO Mapping
Posted: Wednesday, Aug. 1, 2007 04:08 pm
hi

does anyone know how to get the game to give the name of the player (iprintln) who damages a wall or something that uses trigger_damage?
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoDUO Mapping
Posted: Thursday, Aug. 2, 2007 03:14 am
Yup :)

With this little gem you can have any script_model or script_brushmodel take damage and blow up or something without the need to use trigger_damage triggers. [thumbs_up]

Note this script will only report info to the screen so you can see that the "ent" is in fact notifying that it's taking hits.
It shows all the info you can collect and how to set health levels, and how to reduce health levels with each hit.

Enjoy, Grassy

Code:

collect_dmg_ents() {
 ent = getent("dmg_ent","targetname");
  if(isDefined(ent))
   ent thread monitor_ent_dmg();
}


monitor_ent_dmg() {

   // turn on the damage notifies
   self settakedamage(true);

   // set a base health
   health = 1000;

while(1) {
   self waittill ("damage", dmg, who, dir, point, mod);
   org1 = who getorigin();
   org2 = self.origin;
   health = health - dmg;
   iprintln("***********************");
   iprintln("Damage level = " +dmg);
   iprintln("Who = " ,who);
   iprintln("Who position = " ,org1);
   iprintln("Self position = " ,org2);
   iprintln("Hit Direction = " +dir);
   iprintln("Hit Position = " +point);
   iprintln("Direction = " +angles);
   iprintln("Damage type = " +mod);
   iprintln("Current Health = " +health);
   iprintln("***********************");
  }
}
Share |
|DA|DarkDilbert
General Member
Since: Jun 5, 2006
Posts: 675
Last: Apr 29, 2008
[view latest posts]
Level 6
Category: CoDUO Mapping
Posted: Thursday, Aug. 2, 2007 04:45 am
don't think that's any good to me. Can that code be used with an entity that already has trigger_damage triggers? Also, have you got the complete code please because i'm getting a load of undefined and mismatched errors and i don't really understand that piece of code lol. cheers
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoDUO Mapping
Posted: Thursday, Aug. 2, 2007 06:44 pm
Complete code? Define complete.

That bit of code shows all you need to make great scripts. :)

I dont think people realise how good this is, imagine having heaps of objects in your map that react with damage and no triggers used.

And they can all react in a different way too, either by moving, falling, smoking, blow up, or smash.
They can also react to splash damage from grenades.

Imagine you have a cable car in your map that moves back and forwards over a deep valley, you could script it so the cable car detects and accumulates damage, starts smoking and stuttering while moving and eventualy disconnects and falls from the cables to blow up on the valley floor [biggrin]
This can be done without the hassle of making a trigger and then scripting it follow the car.

Imagine you have lots of crates and barrels around your map. A lot of the barrels could be set to take damage and explode if damaged enough, you would never know which ones explode and which ones wont :) Same with crates.

Sorry I've got so many ideas and not enough time to do them all. hehehe.
Maybe I should start making some small tutes with small example maps to explore all this stuff.


But if you still want to persist with triggers, just do this.

trig waittill("trigger",other);
iprintln("Damage done by: " ,other.name);


Regards Grassy
Share |
macklebee
General Member
Since: Dec 5, 2006
Posts: 104
Last: Aug 24, 2008
[view latest posts]
Level 4
Category: CoDUO Mapping
Posted: Thursday, Aug. 2, 2007 11:09 pm
thats actually fantastic... it would make scripting alot more compact and you would have less entities to deal with in your map...

unfortunately the function settakedamage doesn't exist for cod1... dang it..[mad]
Share |
codmp
General Member
Since: Feb 6, 2006
Posts: 905
Last: Jul 31, 2011
[view latest posts]
Level 7
Category: CoDUO Mapping
Posted: Friday, Aug. 3, 2007 01:27 am
Ya unfortunately it doesnt exist for COD2 either =\
Share |
|DA|DarkDilbert
General Member
Since: Jun 5, 2006
Posts: 675
Last: Apr 29, 2008
[view latest posts]
Level 6
Category: CoDUO Mapping
Posted: Friday, Aug. 3, 2007 04:50 am
WHC_Grassy writes...
Quote:
Complete code? Define complete.

That bit of code shows all you need to make great scripts. :)

I dont think people realise how good this is, imagine having heaps of objects in your map that react with damage and no triggers used.

And they can all react in a different way too, either by moving, falling, smoking, blow up, or smash.
They can also react to splash damage from grenades.

Imagine you have a cable car in your map that moves back and forwards over a deep valley, you could script it so the cable car detects and accumulates damage, starts smoking and stuttering while moving and eventualy disconnects and falls from the cables to blow up on the valley floor [biggrin]
This can be done without the hassle of making a trigger and then scripting it follow the car.

Imagine you have lots of crates and barrels around your map. A lot of the barrels could be set to take damage and explode if damaged enough, you would never know which ones explode and which ones wont :) Same with crates.

Sorry I've got so many ideas and not enough time to do them all. hehehe.
Maybe I should start making some small tutes with small example maps to explore all this stuff.


But if you still want to persist with triggers, just do this.

trig waittill("trigger",other);
iprintln("Damage done by: " ,other.name);


Regards Grassy



cheers. unfortunately the maps already been long compiled, and it's one that takes the best part of a century to compile properly, so I'm stuck trying to fix the trigger_damage trigger. As for:

"trig waittill("trigger",other);
iprintln("Damage done by: " ,other.name);"

I should have bloody guessed it was something that simple, doh! cheers again :) I hate C
Share |
|DA|DarkDilbert
General Member
Since: Jun 5, 2006
Posts: 675
Last: Apr 29, 2008
[view latest posts]
Level 6
Category: CoDUO Mapping
Posted: Friday, Aug. 3, 2007 05:07 am
about the code, this is the error i get

pair has unmatching types 'string' and 'undefined': (file pair has unmatching types 'string' and 'undefined': (file 'maps\mp\triggertest.gsc', line 52)
iprintln("Hit Position = " +point);
called from:
(file 'maps\mp\triggertest.gsc', line 41)
self waittill ("damage", dmg, who, dir, point, mod);

same with dir, angles and mod. the code works if i disable those lines, but you only get the player's name, location, trigger's location and object health. How do i define dir, angle and all?
Share |
WHC_Grassy
General Member
Since: Apr 20, 2005
Posts: 1426
Last: Aug 25, 2007
[view latest posts]
Level 8
Category: CoDUO Mapping
Posted: Friday, Aug. 3, 2007 03:52 pm
Are you refering to the code above?

Your not trying to do that on a trigger_damage are you?
That code above will only work on an entity, like a brushmodel or a script_model.

Grassy
Share |
|DA|DarkDilbert
General Member
Since: Jun 5, 2006
Posts: 675
Last: Apr 29, 2008
[view latest posts]
Level 6
Category: CoDUO Mapping
Posted: Saturday, Aug. 4, 2007 06:24 am
ah, that'll be it. got it working now, but angles didn't work, but that's not essential. Cheers :)
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty : CoDUO 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

»