Ironsight 1 Posted October 19, 2005 OK please don't laugh at me because this is my first time I try some scripting. I want to modify this IED script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_bomb = _this select 0 _sol=((units goodguys) select 0) ?(isnull _sol):goto"exit" _distance = 1 _goodguysnothere = true #checkloop _i=-1 #smalloop _i=_i+1 _sol=((units goodguys) select _i) ?((_sol distance _bomb < _distance)||(getdammage _bomb>.9)):_Goodguysnothere=false ~1 ?(isnull _bomb):goto"exit" ?(_i< count units goodguys-1):goto "smalloop" ?(_Goodguysnothere):goto "checkloop" @(alive leader BadGuys) ?(isnull _bomb):goto"exit" _bomb setdammage 1 #exit exit Basically I want the mine to be set of by any soldier or vehicle (instead of "goodguys" group) and I don't want any group ("badguys") who is detonating it. This is my modified script: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_bomb = _this select 0 _sol = _this select 1 ?(isnull _sol):goto"exit" _distance = 1 _bomb setdammage 1 #exit exit So I thought that this might do but when I load it in the mission editor the mine is already exploded. Apparently I am missing something, can anybody help me out? Share this post Link to post Share on other sites
klavan 0 Posted October 19, 2005 Let me know: do you want the bomb to detonates the moment someone is near it independently from his side? Anyway I need to know how this script is fird (via trigger or init field, or somethhing else). Klavan Share this post Link to post Share on other sites
Ironsight 1 Posted October 19, 2005 Let me know: do you want the bomb to detonates the moment someone is near it independently from his side?Anyway I need to know how this script is fird (via trigger or init field, or somethhing else). Klavan Doesn't matter who is near. Any soldier or vehicle west, east, resistance or civilian doesn't matter. The script is started with an eventhandler in an addon and by typing "goodguys = group this" and "badguys = group this" in the init field of a soldier you define who are the good guys and who the bad guys but that doesn't matter anymore since I want the mine to explode when ANY soldier or vehicle comes near Share this post Link to post Share on other sites
klavan 0 Posted October 19, 2005 Since _bomb is an object there's a simpliest way to achieve the result instead of using a script. Place a trigger over the bomb: Activation:anyone, once Size: up to you "Activation" field: this "On activation": bombname setdamage 1 klavan Share this post Link to post Share on other sites
Ironsight 1 Posted October 19, 2005 Well the problem is that I want to include it in an addon so I need a script that can run from an eventhandler Share this post Link to post Share on other sites
Rastavovich 0 Posted October 19, 2005 Your modified script cannot work, because you actually took out the distance checking of the mine and ordered instead to just explode. I would suggest you use a trigger with a fixed name (needs to be set by the missiondesigner) and a script that checks for the units that can activate that trigger. In that case you can fast set up if mines are detonated by one side or by all, and you need only one trigger for all mines/bombs/whatever. Assuming you have a trigger called "MineActivator" with Activation: All, Multiple times, you can use: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _bomb = _this select 0; #check  _activatedBy= list MineActivator;  _index = (count _activatedBy) - 1;  #check2   ? (_bomb distance (_activatedBy select _index)): goto "boom"   ? (_index > 0): _index = _index - 1; goto "check2"   ~1   goto "check" #boom  _bomb setDammage 1  exit Edited: _index was initialized with value out of range, but noone spotted so far Share this post Link to post Share on other sites
Ironsight 1 Posted October 19, 2005 Your modified script cannot work, because you actually took out the distance checking of the mine and ordered instead to just explode. LOL I said it is the first time I am making a script Quote[/b] ]I would suggest you use a trigger with a fixed name (needs to be set by the missiondesigner) and a script that checks for the units that can activate that trigger. In that case you can fast set up if mines are detonated by one side or by all, and you need only one trigger for all mines/bombs/whatever.Assuming you have a trigger called "MineActivator" with Activation: All, Multiple times, you can use: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _bomb = _this select 0; #check _activatedBy= list MineActivator; _index = count _activatedBy; #check2 ? (_bomb distance (_activatedBy select _index)): goto "boom" ? (_index > 0): _index = _index - 1; goto "check2" ~1 goto "check" #boom _bomb setDammage 1 exit So there's no way I can make a mine run like that with only a script activated by an eventhandler? And what I was wondering too if there's any way to make a vehicle or soldier immune for mine blasts? So that the mine explodes but doesn't harm the vehicle? Would be handy for mine protected vehicles Share this post Link to post Share on other sites
klavan 0 Posted October 19, 2005 I don't think there's any appropriate heventhandler usefull for your pourpouses. Quote[/b] ]And what I was wondering too if there's any way to make a vehicle or soldier immune for mine blasts? So that the mine explodes but doesn't harm the vehicle? Would be handy for mine protected vehicles It's impossible: there was an appropriate command long time ago (allowdamage) but it has been removed with one of the patches. Klavan Share this post Link to post Share on other sites
Rastavovich 0 Posted October 20, 2005 So there's no way I can make a mine run like that with only a script activated by an eventhandler? Â Actually that script would be called over the init-eh of the mine. But it would be configured over the trigger. Else it would be quite a bit harder to get a list of vehicles that can set it of. Share this post Link to post Share on other sites
Ironsight 1 Posted October 20, 2005 So there's no way I can make a mine run like that with only a script activated by an eventhandler? Actually that script would be called over the init-eh of the mine. But it would be configured over the trigger. Else it would be quite a bit harder to get a list of vehicles that can set it of. OK thanks for your help guys Share this post Link to post Share on other sites
UNN 0 Posted October 20, 2005 Quote[/b] ]So there's no way I can make a mine run like that with only a script activated by an eventhandler? Yeah it is possible to trigger mines using only event handlers, but just for vehicles I'm afraid Quote[/b] ]And what I was wondering too if there's any way to make a vehicle or soldier immune for mine blasts? So that the mine explodes but doesn't harm the vehicle? Would be handy for mine protected vehicles  You might be able to match up exploding mines, with vehicles that received damage (of a certain type and amount) at roughly the same time the mine explodes. Then it should just be a case of using SetDammage to restore it's health, if it's the correct type of vehicle? Share this post Link to post Share on other sites
Ironsight 1 Posted October 20, 2005 Quote[/b] ]And what I was wondering too if there's any way to make a vehicle or soldier immune for mine blasts? So that the mine explodes but doesn't harm the vehicle? Would be handy for mine protected vehicles You might be able to match up exploding mines, with vehicles that received damage (of a certain type and amount) at roughly the same time the mine explodes. Then it should just be a case of using SetDammage to restore it's health, if it's the correct type of vehicle? But would you have to define that vehicle ingame then or can you just fill in the classnames of the vehicles you want to be mine protected in the script? Share this post Link to post Share on other sites
UNN 0 Posted October 20, 2005 Quote[/b] ]But would you have to define that vehicle ingame then or can you just fill in the classnames of the vehicles you want to be mine protected in the script? Yeah, you just have a function that registers the Class name in a global array. But proably better if you use it on event driven, vehicle landmines, and not regular or scripted land mines. On the plus side, the event driven mines work with any vehicle class if you want them to, not just armour. Share this post Link to post Share on other sites
Ironsight 1 Posted October 22, 2005 OK I got a basic system to work in OFP. Thanks again guys But now I stumbled upon a new problem. When I wanted to try something new out which didn't work and put back the original config I got this error (or something like it): IRO_m19\cfgvehicles no entry armorlights Before it worked fine and I had my perfectly working config backed up but when I started trying some new things but when I put it back it suddenly stopped working. Here's the config by the way: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#define TCivilian 3 #define TSideUnknown 4 #define TEnemy 5 #define TFriendly 6 #define TLogic 7 #define true 1 #define false 0 // type scope #define private 0 #define protected 1 #define public 2 class CfgPatches { class IRO_mines { units[]={}; weapons[]={}; requiredVersion=1.96; }; }; enum { DestructNo, DestructBuilding, DestructEngine, DestructTree, DestructTent, DestructMan, DestructDefault, }; class CfgVehicles { class All {}; class Static : All {}; class Building: Static {}; class NonStrategic: Building {}; class IRO_mineBASE: NonStrategic { nameSound="unknown"; ladders[]={}; scope = 0; vehicleClass="IRO Mines"; armor=10; destrType=DestructEngine; icon="Unknown_object"; displayName=""; cost=0; mapSize = 2; side=3; }; class IRO_M19: IRO_mineBASE { model="\IRO_mines\m19"; displayName="M19 AT mine"; scope = 2; class EventHandlers { init = "[(_this select 0)] exec ""\IRO_mines\explosion.sqs"";[(_this select 0)] exec ""\IRO_mines\mineInit.sqs"";" }; }; }; Share this post Link to post Share on other sites
Ironsight 1 Posted October 23, 2005 OK I got it to work again, it was a problem in the explosion script Are there any good tutorials about costum explosions by the way? I wasn't able to find any Share this post Link to post Share on other sites
UNN 0 Posted October 25, 2005 I would like a tute on creating explosions myself. In the mean time you can always use the default OFP effects. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SmokeSource" CreateVehicle (GetPos _Mine) I think the reason it's called smokesource, is because it's used in conjunction with Class Explosion. Explosion gives you the fire ball effect: So perhaps something like? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Explosion" CreateVehicle (GetPos _Mine) "SmokeSource" CreateVehicle (GetPos _Mine) Share this post Link to post Share on other sites
Ironsight 1 Posted October 25, 2005 I would like a tute on creating explosions myself. In the mean time you can always use the default OFP effects. Only thing that comes close is The Drop tutorial by Vektorboson which shows how to add particles to explosions But I haven't seen any other explosion tutorials yet Share this post Link to post Share on other sites
Trapper 0 Posted October 25, 2005 Custom high quality explosions consist of: fire (drop command) smoke (drop command) sparks (drop command) (drops are able to spawn new drops after death, so combinations are possible) debris with longer lifetime (I don't know) light source (defined in confing.cpp and placed in center of the explosion) sound (.wss or .ogg file, defined in config.cpp and played at the explosion site) Most of the needed graphic effects are based on drop command, and Vektorboson's tutorial is the best. To find out how light and debris are done, depbo addons with such effects. Adding sound should be easy. Share this post Link to post Share on other sites