Home   Help Search Login Register  

Author Topic: RUG_BodyArmor v.1.1 (ACCEPTED)  (Read 16813 times)

0 Members and 2 Guests are viewing this topic.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #30 on: 23 Aug 2008, 01:21:40 »
Understood, however if you have the setdammage at -5, wouldn't there be enough of a delay to get the info of dammaged before doing setdammage -5 again?

Luke
Pesky Human!!
Wort Wort Wort.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #31 on: 23 Aug 2008, 11:08:35 »
As I said: the dammaged eventhandler DOES NOT FIRE if the damage of the player is set to -5. Try this:

Have a unit, name him, say, unit1. We'll make a global variable that should update with each eventhandler and then displayed in a hint. So, define a global variable named EH_Hint = []; someplace, say in the init field of a unit. First, add only this eventhandler:

unit1 addeventhandler ["dammaged", {EH_Hint = EH_Hint + [_this]; hint str (EH_Hint)}];

Now shoot unit1, and you'll probably (unless you killed him) get a hint with all the contents of the dammaged eventhandler (unit hit, area hit, total damage to area etc.).

Now, add a second eventhandler:

unit1 addeventhandler ["hit", {EH_Hint = EH_Hint + [_this]; hint str (EH_Hint)}];

And shoot unit1: see which hint displays last (i.e., you should first get the "hit" information and then the "dammaged" information). So far so good, eh?

Now, change the "hit" eventhandler:

unit1 addeventhandler ["hit", {unit1 setdamage -5;EH_Hint = EH_Hint + [_this]; hint str (EH_Hint)}];

Also, change the init of the unit to include the line : this setdamage -5 (will keep the first shot from being an insta-kill). Leave the dammaged eventhandler as it is.

And...whatever happened? :O The dammaged eventhandler NEVER FIRES anymore! This is because, as mentioned, it never has time to fire, since the hit eventhandler always resets damage to -5. However, the unit is happily invulnerable.

Now, as a final test, try adding a tiny sleep to the hit eventhandler, to allow the dammaged to fire:

unit1 addeventhandler ["hit", {sleep 0.02;unit1 setdamage -5;EH_Hint = EH_Hint + [_this]; hint str (EH_Hint)}];

And try to kill unit1 -> you will find you can kill him again, which defeats the purpose of the whole body armor script.

Thank you for your suggestions, but I -have- tried some stuff before making it. ;) If you -do- come up with a fully working alternative "head shot allowing" version, please do give me an example script or example mission where it works! I'm sure I haven't tested -everything- yet. :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #32 on: 23 Aug 2008, 17:20:06 »
Hey Wolf,  I just read this entire thread (but I'm an old dude, and retention aint that good), and I didn't hear mention of the idea of replacing a downed unit with a cloned unit.

Maybe using damage event handler alone, if dead, you could replace him with a newly created identical unit (loading him with exact equipment from dead guy, setdir, setpos, same animation, etc.).   This might open up the option of using hit locality better.

Just a thought.   Great script BTW.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #33 on: 24 Aug 2008, 23:22:46 »
If you have setdammage -60, and you get hit, is the getdammage command at 0, or some negative value?

Luke
Pesky Human!!
Wort Wort Wort.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #34 on: 25 Aug 2008, 02:42:16 »
getdammage

Value is from 0 - 1
Damage 0 means fully functional, damage 1 means completely destroyed / dead
Xbox Rocks

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #35 on: 25 Aug 2008, 04:57:59 »
Yes, granted and established under normal conditions.

but within the functionality of the script it sets damage to Negative numbers.

What I am wondering is after being struck by a bullet will it still yield a negative value,
(if the 0 threshold is not crossed) or is the damage automatically set back to 0?

Luke
Pesky Human!!
Wort Wort Wort.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #36 on: 25 Aug 2008, 08:59:20 »
A unit with damage set to a negative value will have damage set to a positive value when hit. It's pretty simple to test this in the editor.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #37 on: 25 Aug 2008, 10:44:56 »
Hey Wolf,  I just read this entire thread (but I'm an old dude, and retention aint that good), and I didn't hear mention of the idea of replacing a downed unit with a cloned unit.

Maybe using damage event handler alone, if dead, you could replace him with a newly created identical unit (loading him with exact equipment from dead guy, setdir, setpos, same animation, etc.).   This might open up the option of using hit locality better.

Just a thought.   Great script BTW.

In theory possible, but in practice complicated. 1) The equipment would NOT be the same, since there's no way to copy the exact number of bullets in the gun, in the magazines etc. Even if you could look past that, we've got 2) There's no real way of listing custom eventhandlers, addactions and vehicle variables added to each unit, and since these are attached to one particular unit, replacing that unit with another (even if it has the same name) will cause all of this data to disappear. And finally, 3) Would be hard to get to work with the Player unit, although in principle lightning-fast teamswitching might do the trick, but 1 and 2 would be rather glaringly obvious to the player, even if overlookable in AI.

@Luke

bedges is correct: there's no way to find out if the damage is set to negatives either, since the getdamage command does not return the "correct" negative number when queried if the number IS negstive. And yes, one shot = back to 0.

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #38 on: 26 Aug 2008, 01:13:09 »
With dammage at 0 and you get shot in the head, but with the hit event handler setting dammage back to -5,
would you 'zombify' (that is, still stand there with the player dead screen)?

Luke
Pesky Human!!
Wort Wort Wort.

Offline samsamps

  • Members
  • *
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #39 on: 15 Sep 2008, 18:24:13 »
I've been testing your body armor mod for use in a MP map and i've been encountering some strange things. I cant seem to get it to work right; what happens is  when someone goes down from losing all their armor when they get up they look as if they are still on the ground and they move at normal speed, just prone. Also other mp players dont seem to have the first aid option in their action menu to revive their fallen comrades.

Is there something I need to do to make it mp friendly?

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #40 on: 16 Sep 2008, 11:11:33 »
Hi there samsamps

I'm sorry to say I never designed the body armor script for MP. The bugs you describe all seem to be tied to the phenomenon of locality, something which continually escapes me. :D

In short, I believe the problems to be as follows: apparently switchMove is local: it switchmoves you down ("DeadState") but the switchmove back to normal (can't remember the exact name, but it's one of the prone animations) doesn't seem to register. Maybe changing the switchmove to just "" would fix it, but then the unit would jump up from prone to standing in an instant.

Same thing with the addaction: this is an entirely local happening, the actions aren't broadcasted to the other players at all.

And finally, I'd assume that the actual VEHICLE VARIABLES are also local - see, there's a vehicle variable (added with setVariable) on each unit that has the bodyarmor script running which checks how much bodyarmor it still has, what mode it's in, what it's maximum armor is and so on. I don't actually know if these even need to be made global, but as of this moment at least they're as local as they come.

So. To make it work I'd assume you'd need to make each of these three things global somehow. As to how : no idea! I'd like to make my scripts MP-compatible, but sadly I haven't got the machine power to run any tests by myself, nor do I have a clan/server/bunch of people who can do the testing for me - especially since I'm such a noob at MP scripting it'd probably be rather tedious to test stuff with me ;)

Anyone else have any ideas?

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #41 on: 16 Sep 2008, 13:46:53 »
You are right! All those things you are talking about are local to the machine and would need to be communicated across the network to affect everyone in an MP game. Unfortunately, making this all happy in MP would require quite a bit of rewriting (sorry, bit much for me at the moment).

Additionally, you would also have to broadcast the stuff to tell the AI to come and help you as well, since unless you are their direct leader, they will be local to the server, not your machine, and so will ignore the commands. I'd suggest that in MP games (missionName != "") you ensure that you only attempt to call in your own AI followers to ensure that this still works (without needing to mess around a great deal with MP scripting).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline samsamps

  • Members
  • *
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #42 on: 17 Sep 2008, 19:54:30 »
:(

Ah well, I guess I wont  put in armored enemy in my maps. Apparently Having the unit affected with the crawling bug get into a vehicle seems to fix it but I dont know how useful that will be in terms of making it mroe MP-friendly.

Offline ZachHox

  • Members
  • *
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #43 on: 19 Oct 2009, 14:35:33 »
So to run in this evolution or warfare I would have to put this "[UnitName, Mode, Init] execVM "RUG_BodyArmor.sqf"" in my init.sqf file right?

And furthermore just copy:
injuries.sqs
M05.paa
Outro.sqs
Outro2.sqs
RUG_BodyArmor.sqf
Add whatever it says in stringtable.csv into the same file in my directory
And last copy the sound folder into the same directory

And I want it for all West so can I put that at UnitName and that would just work for my entire west team/squad soldiers?

And how can I get to 4 bullet hits per kill? Like -1.3 at Init?

Just asking to be sure. :D


Thanks.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: RUG_BodyArmor v.1.1 (ACCEPTED)
« Reply #44 on: 20 Oct 2009, 10:54:45 »
Hi there!

Actually, you only need to copy RUG_Bodyarmor.sqf, the rest are parts of the demo mission. Sorry for that being unclear :) And yes, putting that line in the init.sqf should do the trick (with the appropriate numbers and entries, e.g. [Player, 2, -1].

The amount of bullets depends on range, bullet type, where it hits and so on, so...experiment!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"