kakagoegie 0 Posted September 24, 2005 I want to know if it's possible to make a gas grenade out of a smoke grenade. I don't want to kill the soldiers affected by the gas. They need to fall down. Here are some things which must happen: - You throw a BIS smoke grenade - Smoke pops out, after 2 sec people in a 10 meter radius faint. - after 5 sec, people in a 20 meter radious faint - after 8 sec, people in a 30 meter radious faint - All people who faint must playmove "HandGunCrouchDead" (I don't want the enemy soldiers to shoot at me when they fainted) - multiple (4) gas grenades can be thrown If you know anything, plz help me Share this post Link to post Share on other sites
thobson 38 Posted September 24, 2005 I presume small is the name of a trigger? Instead of the switchmove try: {while {canStand _x} do {_x setDammage getDammage _x + 0.01}} forEach list small Note there is no need to end the line with a semi-colon I presume you want them to be injured as well? Â This will do both. EDIT: Looking agian at your script the ? lines only have a condition there is no instruction. Â It is not clear to me what spot2 is. Also why is the player's distance relevant? Share this post Link to post Share on other sites
thobson 38 Posted September 24, 2005 Okay I have had another look at what you are trying to do. Â Try this: ~3 {if (_x distance spot2 < 10) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach list small ~5 {if (_x distance spot2 < 20) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach list small ~7 {if (_x distance spot2 < 30) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach list small I assume spot2 is the location where the grenade has gone off and small is the name of a trigger that captures all units within 30 meters. If I am correct then there is still a refinement needed. Â List small will contain vehicles that are occupied, but will not contain the occupants of the vehicles. Â So if you are going to have vehilces around you would need something like: ~3 {{if (_x distance spot2 < 10) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach crew _x }forEach list small ~5 {{if (_x distance spot2 < 20) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach crew _x }forEach list small ~7 {{if (_x distance spot2 < 30) then {while {canStand _x} do {_x setDammage getDammage _x + 0.01}}} forEach crew _x }forEach list small I am reluctant to go further as I am not sure if this really is what you want. Share this post Link to post Share on other sites
kakagoegie 0 Posted September 24, 2005 Ok edited 1th post, a fresh start There aren't any soldiers in vehicles around @THobson, I hope you understand it now. Share this post Link to post Share on other sites
thobson 38 Posted September 24, 2005 Well you have editied it beyond recognition. I suggest you put it back to what it was and then add your new comments. Share this post Link to post Share on other sites
thobson 38 Posted September 24, 2005 Pending the re-edit: Â So you want them to get down but not be injured and there are definitely no vehicles around. Â Then play around with this: ~3 {if (_x distance spot2 < 10) then {_x switchMove "HandGunCrouchDead"}} forEach list small ~5 {if ((_x distance spot2 < 20) and (_x distance spot2 >= 10)) then {_x switchMove "HandGunCrouchDead"}} forEach list small ~7 {if ((_x distance spot2 < 30) and (_x distance spot2 >= 20)) then {_x switchMove "HandGunCrouchDead"}} forEach list small I am assuming that spot2 is the location of the grenade and small is the name of a trigger that detects anybody present in the area. If this does the sort of thing you want then you could think about putting some random delays in so they don't all get down together. Â That would need a bit of restructuring of the code. EDIT: Is this what you really want? I have just played around with it and all the soldiers suddenly drop on their backs. I suggest you find some Dieing switchmove so they actually animate to the ground. Share this post Link to post Share on other sites
DBR_ONIX 0 Posted September 24, 2005 "if it's possible" - Yep, the VME_PLA addons had working gas grenades, they worked okay, made your screen black out etc (It was tear-gas grenades, acctualy) And they seemed to screw the AI up pretty well too - Ben Share this post Link to post Share on other sites
kakagoegie 0 Posted September 25, 2005 It will have to contain a playmove. So something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~3 {if (_x distance spot2 < 10) then {_x playmove "HandGunCrouchDead"}} forEach list small ~5 {if ((_x distance spot2 < 20) and (_x distance spot2 >= 10)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~7 {if ((_x distance spot2 < 30) and (_x distance spot2 >= 20)) then {_x playmove "HandGunCrouchDead"}} forEach list small But it's still not working. I only copied it from another script. And I don't know what "small" is. What do I have to name "small" for the script to work.. @THobson, thank you for putting so much time in this. I know it's a bit unclear to you what I want. But I can't explain it any further. Share this post Link to post Share on other sites
thobson 38 Posted September 25, 2005 I believe I explained what small is.  It is the name of a trigger that detects when anyone is present. Create a trigger that covers the area where the gas grande will be activated - it could cover the whole map if you are not sure.  in the Activation field use the drop down menu to get Anybody  and in the name field put: small You now have a trigger called small that returns a list of all the units in the trigger area. A big lesson here - don't use other people's scripts unless you know how they work. Share this post Link to post Share on other sites
kakagoegie 0 Posted September 25, 2005 Aha, now i get it. Now there's only one problem left. I throw a smoke grenade. Where the smoke grenade lands should be "spot 2". So how can i make the spot where the grenade lands be called 'spot 2"? I think this topic will be of use. Only I don't know what they're saying exactly. Share this post Link to post Share on other sites
thobson 38 Posted September 25, 2005 spot2 needs to be an object or unit otherwise distance will not work. Just call the grenade spot2, or create a gamelogic called spot2 and move it to the location of the granade. Share this post Link to post Share on other sites
kakagoegie 0 Posted September 25, 2005 spot2 needs to be an object or unit otherwise distance will not work. Â Just call the grenade spot2, or create a gamelogic called spot2 and move it to the location of the granade. uhm, how do I call the smoke grenade spot2? Share this post Link to post Share on other sites
thobson 38 Posted September 25, 2005 Well I suppose you could use nearestObject to find it, probably better to use the game logic option. Share this post Link to post Share on other sites
kakagoegie 0 Posted September 25, 2005 Ok, so something like this, activated by an eventhandler "fired" Quote[/b] ]spot2 setpos [(getpos gamelogic select 0),(getpos gamelogic select 1),0] ~3 {if (_x distance spot2 < 10) then {_x playmove "HandGunCrouchDead"}} forEach list small ~5 {if ((_x distance spot2 < 20) and (_x distance spot2 >= 10)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~7 {if ((_x distance spot2 < 30) and (_x distance spot2 >= 20)) then {_x playmove "HandGunCrouchDead"}} forEach list small Only how can I make "gamelogic" get the position of the smoke shell? Share this post Link to post Share on other sites
thobson 38 Posted September 25, 2005 I suggest you look through this, paying particular attention to setPos: http://www.ofpec.com/editors/comref.php Share this post Link to post Share on other sites
thobson 38 Posted September 26, 2005 I started responding to this question when I thought it was a simple matter of fixing some code.  I think your need is more than that.  It seems to me you have two options: 1. Find somebody else’s gas grenade code and use that 2. Use this as a way of learning about coding yourself If you are going to do the second then I suggest you consider the process of what will be going on. You will need a fired event handler that is attached to any unit that could throw the gas grenade.  That event handler should run a script. The first thing the script should do is determine if the object ‘fired’ was a smoke shell.  If it wasn’t then the script should exit.  Using nearestObject the script should be able to get a handle on the smoke shell. The script should wait until the smoke shell is stationary before it starts causing an effect on units nearby. Your original code had sudden jumps in the range of the effect of the smoke.  I suggest you actually have a smooth increase in range.  The script should find each unit that is to be effected (based on the distance of the unit from the smoke shell) and could run a script for each unit. The unit specific script could start with a small random delay followed by randomly selected switch(play)Move instructions that cause the units to get down on the ground and then to lie down in randomly selected positions. So that in outline is what I think you are looking for. Share this post Link to post Share on other sites
kakagoegie 0 Posted September 26, 2005 Ok, this is what I have and it seems to work: You'll need a trigger called "small" wich covers the entire area, activated by "anybody". You'll need 4 Gamelogics called "spot1" - "spot4". And you'll need four scripts, they look very the same. Quote[/b] ]GAS.SQSplayer setcaptive false player removeAllEventHandlers "fired" player AddEventHandler ["fired",{_this exec "gas2.sqs"}] ammo1 = nearestObject [player, "smokeshell"] ~6 spot1 setpos [getpos ammo1 select 0,getpos ammo1 select 1,0] ~1 {if (_x distance spot1 < 5) then {_x playmove "HandGunCrouchDead"}} forEach list small ~2 {if ((_x distance spot1 < 10) and (_x distance spot1 >= 5)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~2 {if ((_x distance spot1 < 15) and (_x distance spot1 >= 10)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~2 {if ((_x distance spot1 < 20) and (_x distance spot1 >= 15)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~2 {if ((_x distance spot1 < 25) and (_x distance spot1 >= 20)) then {_x playmove "HandGunCrouchDead"}} forEach list small ~2 deletevehicle ammo1 {if ((_x distance spot1 < 30) and (_x distance spot1 >= 25)) then {_x playmove "HandGunCrouchDead"}} forEach list small It works good enough for me. The player only carries the smoke grenades and each script gives a new eventhandler "fired" with a new script in it to the player. Works good enough for me. Thanks for all the help THobson, you will get the credits for it in my new mission. Share this post Link to post Share on other sites
thobson 38 Posted September 26, 2005 I just noticed this. I have not looked in detail at it but the title caught my eye: http://www.ofpec.com/editors/resource_view.php?id=803 Share this post Link to post Share on other sites