Jump to content

Rothwell

Member
  • Content Count

    22
  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About Rothwell

  • Rank
    Private First Class
  1. well the problem is, say I have a list of bases, each with their templates, say "base_1.sqf","base_2.sqf"....."base_n.sqf". I will set up a trigger for each one (by calling an init script for each base at the beginning of the mission), but the variable templateName will change with each base, so at the end of all bases, templateName will equal "base_n.sqf", and so when any of the triggers are tripped, "base_n.sqf" will always be called, so I suppose I don't have a choice other than to make some changes so each base has it's own trigger code
  2. Hi, I'm setting up a series of bases that will spawn once the player is 300m away from them, and despawn once the player leaves that radius... I really don't want to hardcode in the .sqf file of each base for it's trigger... this is a matter of making the script generic and saving code. but here's the problem, I can't pass in local variables like down below, And if I have a global variable, the trigger statement won't take a snapshot of the variable when the trigger's created... it'll grab the value of the variable when the trigger is switched (which will end up being the filename for the last base added to the list) _templateName = _this select 0; //i.e. "Base1_mission.sqf" _trig = createTrigger ["EmptyDetector",_location]; _trig setTriggerArea [300,300,0,false]; _trig setTriggerActivation ["ANY","PRESENT",true]; _trig setTriggerStatements ["vehicle player in thislist","hint ""hello there!""; _n = execVM _templateName;","hint ""so long"""]; NOTE: this is just a snippit of my test code.. the whole thing works except the _templateName thing is there any way to get around writing code for a trigger for every single base?
  3. Hi, this is a problem I've always had... I'm trying to make a base in the 3D editor, but I just can't get inspiration; I don't know what to put in, how many enemies to have it be challenging but not ridiculous, what and how to place items to make it seem natural and immerse players. does anyone have tips on making bases? references you look at, general outlines, etc? Thanks for any help
  4. Hi, I'm creating a mission that will have quite a few bases (maybe around 20); I'm planning on placing items for each base in the 3D editor, so each base will have it's own .sqf template. My question is, would it be more efficient to have a trigger that spawns all these objects when the player is 500m away from the base or so, and then despawn all the objects once the player leaves, or do you think ARMA2 OA handles this kind of stuff better than that, so I should spawn everything at once and leave it? (I feel like ArmA2 had issues with lots of stuff spread over an entire map...) Please, I'm interested in any tips to make things as efficient as possible.
  5. Hi, I'm trying to make an RscButton that, instead of text, is a picture of an arrow. I figured I could create a class that extends RscButton, but change the style to be a picture, and then I could set the text the same way I would a picture, and the button would appear as my picture: class RscAButton: RscButton { style = 48; //ST_PICTURE text = "my_arrow.paa"; }; instead, it's a regular button that literally says "my_arrow.paa" on it....
  6. Thank you both for your help! I figure I might as well post my solution if anyone else has the same question (I know it doesn't handle turrets within turrets yet... but that's a job for another night): edit: ok, I figured I'd just post the code when it's working 100%... /////////////find gunner & commander positions//////////////////////// if(isClass (_ConfigEntry >> "Turrets")) then { //function start//////////////////////////////////////////////////// TurTrav_func = { private ["_turretClass","_recurse","_i"]; _turretClass = _this select 0; for [{_i = 0}, {_i < (count _turretClass)}, {_i = _i+1}] do { if( isClass (_turretClass select _i) ) then { //see if it has "gunnerName" in it... if( isText ( (_turretClass select _i) >> "gunnerName") ) then { if( getText ( (_turretClass select _i) >> "gunnerName") == "commander") then { TCommanderSeats = TCommanderSeats + 1; } else { TGunnerSeats = TGunnerSeats + 1; }; }; //explore this class _recurse = [(_turretClass select _i)] call TurTrav_func; }; }; }; //function end////////////////////////////////////////////////////// TGunnerSeats = 0; TCommanderSeats = 0; _tscript = [(_ConfigEntry >> "Turrets")] call TurTrav_func; };
  7. Hi, I'm trying to see if a vehicle has a gunner position in my code, but I am getting "0" no matter what... _hasGun = getNumber (configFile >> "cfgVehicles" >> _ClassName >> "hasGunner"); As I understand, this should be the correct segment of code to get what I want! (I read on a forum that with Arma2, "hasGunner" applies to the turret, and not the vehicle itself, but it didn't go into any more detail... what does this mean?) I use this code to find the number of cargo spots, and it works perfectly fine... TCargoSeats = getNumber (configFile >> "cfgVehicles" >> _ClassName >> "transportSoldier");
  8. Hi, I am wondering if it is possible to store variables with triggers; I have a 2D array with triggers and other info whose indexes correspond with another array of locations. say I have 3 locations... row 1 represents the locations array, row 2 represents the triggers array [table=width: 500] [tr] [td]loc1[/td] [td]loc2[/td] [td]loc3[/td] [/tr] [tr] [td][trigger east, trigger west, east present?, west present?][/td] [td][trigger east, trigger west, east present?, west present?][/td] [td][trigger east, trigger west, east present?, west present?][/td] [/tr] [/table] here is the code where I initialize the array containing the triggers for[{_x = 0},{_x < count Spawns},{_x = _x + 1}] do { //[trigger east, trigger west, east present, west present] _eTrig = createTrigger["EmptyDetector", getMarkerPos (Spawns select _x)]; _eTrig setVariable["index", _x]; _eTrig setTriggerArea[15,15,0,false]; _eTrig setTriggerActivation["EAST","PRESENT",true]; _eTrig setTriggerStatements[ "this" , "_x = _this getVariable ""index""; hint format[""%1"",_x]; //PRINTS "any" WHEN TRIGGER IS ACTIVATED!! _temp = Spawn_Trigs select _x; _temp set [2, true]; Spawn_Trigs set [_x, _temp];" , "_x = _this getVariable ""index""; _temp = Spawn_Trigs select _x; _temp set [2, false]; Spawn_Trigs set [_x, _temp];" ]; _wTrig = createTrigger["EmptyDetector", getMarkerPos (Spawns select _x)]; _wTrig setVariable["index", _x]; _wTrig setTriggerArea[15,15,0,false]; _wTrig setTriggerActivation["WEST","PRESENT",true]; _wTrig setTriggerStatements[ "this" , "_x = _this getVariable ""index""; _temp = Spawn_Trigs select _x; _temp set [3, true]; Spawn_Trigs set [_x, _temp];" , "_x = _this getVariable ""index""; _temp = Spawn_Trigs select _x; _temp set [3, false]; Spawn_Trigs set [_x, _temp];" ]; Spawn_Trigs set[_x, [_eTrig,_wTrig,false,false]]; hint format["%1",((Spawn_Trigs select _x) select 0) getVariable "index"]; //prints correct index when initializing the triggers sleep .5; };
  9. How do you map your own custom keys? For example, ACE has a bunch of their own custom mapped keys, like deploying a bipod... I want to be able to press a button (lets say, the 'Home' key), and have it run a script.
  10. I'm making a dialog, and have a button of type 16; I have the button all set up, and initialized to say "Join Squad". I then want the button to say "Leave Squad" when pressed. Here's my code: hint format["clicked: %1",_idc]; _text = ctrlText _idc; hint format["says: %1",_text]; ctrlSetText [_idc, "Leave Squad"]; the hints show me that i have the correct idc being sent, but the second hint prints out "says: ", so ctrlText isn't working. Also, the text on the button never changes. To be sure I had the right idc, i put in: ctrlShow [_idc, false]; which successfully hid the button.... any ideas why the text won't work for me?
  11. Rothwell

    Structured Text

    Ok, I figured all of those #define lines were if you wanted to set a type or something and then enter a number instead of typing out the name. Like: style = 0;, instead of style = ST_LEFT;. AHHH... i figured out what was wrong. I had this piece of code left over sitting at the top of my init.sqf that I had overlooked it works perfectly now! thanks for your help! EDIT: I meant to say also, i haven't got shadow to work either. not a big deal to me though.
  12. Rothwell

    Structured Text

    So this works... kinda. And I'm willing to bet it's not working how it should because of my shakey at best understanding of these dialogs... is (#include "define.hpp") the only thing I actually put in my description.ext, and make a file named define.hpp with the rest of the code in it? I'm not sure what exactly .hpp files are all about, i'm assuming they're used to keep the description.ext from getting too cluttered... at least this is what I've observed from code others have written. Aside from that, I say it kinda works because when I'm in-game all it says is "Yo". but when I press esc and pause the game, it shows the structured text.
  13. Rothwell

    A bunch of errors

    I think it mostly depends on the mission, just today I tried to open up a mission from the PMC DLC and pboView gave me that error, however, it will open the missions from the original Arma2 campaign, and user-made missions
  14. Hi, I need some help with structured text. Basically, I want to do something like a counter that would be equivalent to: format["time: %1", timeLeft] and display it in the center-top of the screen 1.) I can't figure out how to get it to display! I know I need to get my titlersc to display structured text instead of regular text, but something I'm doing isn't right. I know I need to have this somewhere: _x = "<t color='#ffff00'>" + format["%1",name player]+"</t>"; _y = "<t color='#00ff00'>" + " is my name"+"</t>"; _z = _x + _y; //I'm assuming these are the id's i want. probably where i'm wrong ((findDisplay 300) displayCtrl 301) ctrlSetStructuredText parseText _z; however I dont know where this is supposed to go. Anywhere I want to change the method? init.sqf for testing? 2.) I have only gotten a titlersc to display on the screen, however, when i set y=0, it wasn't at the very top of the screen, how do I get it to be flush with the top of the screen? here's my description.ext file I'm trying to use class MyRscStructuredText { idc = 303; type = CT_STRUCTURED_TEXT; style = ST_LEFT; colorBackground[] = {0,0,0,.5}; x=0.4; y=0.0; w=0.2; h=0.1; size = 0.018; text = null; class Attributes{ font = "TahomaB"; color = "#FF0000"; align = "left"; valign = "top"; shadow = false; shadowColor = "#ffoooo"; size = "1"; }; }; class RscTitles { titles[]={}; class MyRscTitle { idd=300; movingEnable=0; duration=12; name="title1"; controls[]={"text1"}; class text1 : MyRscStructuredText { idc = 301; }; }; };
  15. try the CanUnloadInCombat script command. Here's the wiki page on it: http://community.bistudio.com/wiki/canUnloadInCombat EDIT: at least, it will help you troubleshoot
×