igneous01
-
Content Count
924 -
Joined
-
Last visited
-
Medals
Posts posted by igneous01
-
-
you forgot one thing: killed eventhandler returns the killer object, so you can actually check if p1 killed a zombie by getting it from the event handler (I believe its the second index)
ex:
{ _x addEventHandler ["killed", { private ["_dead", "_killer"]; _dead = _this select 0; _killer = _this select 1; if (_killer == p1 || _killer == p2 || etc) then { addMoney here };] } foreach zombiesthat would be one way to do it. It might be better though if u create function that handles money, and just call that inside the eventhandler.
or if you dont want to use global variables, just make the money function, then check like this:
_killer = _this select 1; nul = [_killer] call MoneySystem
now you can check this all inside another script.
---------- Post added at 17:32 ---------- Previous post was at 17:16 ----------
heres a function that I wrote that can take care of the money: rather than using global variables, it uses setVariable on the unit, so its easier to manage.
not tested, but should work
add this to the init.sqf, in the array add all the units you want to receive money
{_x setVariable ["Money", 0, true]} foreach [p1, p2, p3, p4, p5]; // units start with 0 moneyand add this function to the init.sqf as well, it needs to be processed first in order to call it.
Fnc_MoneySystem = { private ["_MoneyUnits", "_killer"]; _moneyUnits = [p1, p2, p3, p4]; // this is an array of all the guys that are going to get money based on kills _killer = _this; // the killer that was returned from the killed event handler (which is passed here) { if (_killer == _x) then { private ["_curMoney"]; _curMoney = _x getVariable "Money"; _x setVariable ["Money", _curMoney + 50]; // adding 50 money to the unit that killed the zombie }; } foreach _moneyUnits; };then you can either add the eventhandler to each zombie individually, in a script (if you are spawning zombies) or, if you have an array of all your zombie units, you can use this:
{ _x addEventHandler ["killed", { private ["_killer"]; _killer = _this select 1; 0 = _killer call Fnc_MoneySystem; };]; } foreach zombie_units;assuming your array of zombies is named 'zombie_units'
if you are not using an array, just remove the brackets of the foreach:
this addEventHandler ["killed", { private ["_killer"]; _killer = _this select 1; 0 = _killer call Fnc_MoneySystem; };];- you can use this in the zombies init.
-
I do not know how campaigns are linked together. I assume you create several different missions and then you can link those together. To ensure consistency from one mission to the next you use scripting and saveVars right?The comment you posted seems like it would only work if the next mission had a unit with the same name in the editor. I believe the comment is to be be understood like you can't save objects. You can only save primitive data like numbers, strings, booleans and arrays.
Unfortunately I doubt you can do what you want without saving each single piece of data in simple primitive types and recreating from that data.
yes, which is why I am creating the units in the editor in all the missions with their respected names. Then I can unstring the array (which should reference the name I gave it in the editor) and remove it from the available units you can assign on a mission if they are killed or wounded or whatever.
However im still deciding how I want to save how many missions have passed in a campaign - ex: wounded units unavailable for 1 mission (healing), units in critical condition require two mission turns to pass (in a worse state, requires more time to heal) then somehow add these units back in when the proper amount of time has elapsed.
-
Well you always know your variable names. Either you wrote them directly eg. in the editor name field or you created them through scripting, eg. myGlobal = nearestObjects ... or something like that.If you don't know the names of the variables how would you reference them in the next mission?
I think you are confusing the issue of converting an object to something you can store with finding the variable name. If you use 'str' on an object you might get something back like: <3dObject: #someID g4rb4g3 - can't remember exactly how it looks. There is no way you can find the real object that string is in a next mission.
Let me ask why are you storing this information? Is it to have the battlefield looking like it continues from the previous mission? Then perhaps something like this:
BattlefieldState = [ [getPos veh_a, getDir veh_a, typeOf veh_a, getDamage typeOf veh_a], ..... ]; saveVar "BattlefieldState";
Then in your next mission you read the data and recreate it.
Actually in some cases variables were created without me knowing their exact names: ie using format:
for "_i" from 0 to (count array -1) do { _string = format ["_name = s%1", _i]; call compile _stringThe reason for converting to string is from a post under saveVar that says this:
If you try to saveVar a vehicle saved in your variable (SavedVars = [Car1]; saveVar "SavedVars"), then Car1 will not be properly "saved", refering to ObjNull if you try to use it in subsequent missions, even if a vehicle with the same vehicle varname exists. To get around this, save the vehicle's varname as a string (SavedVars = [str(Car1)]) and then when you need it just use call compile to "unstring" the varname (_car = call compile (SavedVars select 0);). --Wolfrug 22:56, 28 January 2009 (CET)hence why I am doing this. Currently My workaround has been to add another input for the function, so it now reads as this:
0 = [[original arrays here], [arrays as string names]] call Fnc_SaveArray
I tested it quickly using two test missions, and dumping the values of the variables into rpt in each mission - also having the init access these variables to make sure they initialized correctly in the first mission. The conversion works as expected: you can load the objects back in and reference them.
The reason I am doing this, is because I am creating a campaign around controlling a platoon of men, and so 40 or so units need to be checked to see if they are alive, wounded, and another wounded state that is critical condition. I figure I would rather use a constant that contains all the units in it and save it, then do some addition/subtraction of men that are wounded/etc from the constant, and make this the available units in that mission. ie -
AVAILABLEUNITS = ALLUNITS - KILLEDUNITS - WOUNDEDUNITS - CRITICALUNITS
All I am trying to save right now are the arrays, im using eventhandlers to add units into proper arrays (killed/etc) anyway. It would be alot easier then trying to handle a huge array containing all units alive/ damage/ group status etc.
-
arma shines not as an fps solely, but as a pseudo tactical - rts - fps game. What makes it rewarding is that the primary goal is not getting kills, its about carrying your buddy in mp that got shot while the rest of your team cover you. Its when priority changes from "Heh im gonna try to take out all these guys here by myself and that tank too" to "I have to keep giving covering fire, otherwise my teammate who is dragging that other guy will be killed"
Or if your into high command like me, your priority is about the positioning of your units, and reaction to enemy response, telling these teams to offer cover fire, while other teams advance.
As has been said so many times: this game does not gratify spontaneously, and it shouldn't either: real life doesn't gratify you either, the priorities are similar too. Arma has always forced the player to think about the big picture, not the small component of the amount of kills you got.
-
sure, the array starts as follows:
GP_ALLUNITS = [s1, s2, s3, s4, s5, s6, s7... etc]
and I need to convert it into strings so that they can be saved with saveVar
GP_ALLUNITS = ["s1", "s2", "s3", "s4", "s5", ... etc]
then I need to somehow convert the variable name into a string, because saveVar needs that:
GP_ALLUNITS = "GP_ALLUNITS"
Then there is another function that simply call compiles each index in the array and using set, changes the index value from a string back into an object.
-
A soundtrack below from an old (but still great!) Vietnam movie Platoon is a great example (IMO) what kind of music makes any scene dramatic, adds various emotions to it:yup, this is why classical should be used for a decent portion of the soundtrack.
slightly offtopic: its a shame most people only know Samuel Barber from the movie, and dont know that this piece is actually 1 movement from his string quartet. He is probably the most famous american composer who was also part of the modern revolution of classical music.
-
I still cannot find a tutorial on how to use the mortars and backpacks in the boot camp or any official (or even unofficial) sources. I can use mortars in a basic way but I just cant figure out how to pack them and move them and load them into vehicles and stuff like that which would be a cool feature to play with. Its as simple as adding a bootcamp mission for mortars and believe me I will check again. More bootcamp missions for things like mortars and backpacks should be added with major patches if not allready.
the mortar packup/setup isnt working anymore as far as I know. It was there on OA release, but its been on the back burner I guess. I know because I also tried to use it, but the actions are not there when you have the equipment. AI don't setup either (I think they did before)
I am hoping with my CIT, they will fix it, and atleast add an option in high command for these teams to setup their weapons. Right now I have to use a make shift script I wrote for that, and its not fully completed either.
-
I am working on a function for my campaign that allows me to store arrays of objects with saveVar. There is a limitation with saveVar that does not store the objects inside an array, so when referencing them in a later mission, you get objNull.
So with my handy dandy function, it converts all the objects in the arrays into strings, then saves the array into campaign space. I have another function that call compiles the strings to convert the strings back into objects when I load the next mission.
The problem, is that saveVar requires the string of the variable, and using str or format, only converts the value it holds into a string, which is not what I want.
Is there a way to convert the variable name into a string?
Here is the code of the function:
// Fnc to convert all arrays with objects to strings, save in campaign space // 0 = [GP_ALLUNITS, GP_AVAILABLE, GP_ASSIGNED, GP_KILLED, GP_WOUNDED, GP_CRITICAL] call Fnc_SaveArray Fnc_SaveArray = { private ["_arrays"]; _arrays = _this; // Convert all object based arrays into strings { private ["_array", "_index", "_indexValue"]; _array = _x; if (count _array > 0) then { for "_i" from 0 to ((count _x) - 1) do { _index = _i; _indexValue = _x select _i; _array set [_index, str _indexValue]; }; }; } foreach _arrays; // Save the variables for "_i" from 0 to ((count _arrays) - 1) do { private ["_array"]; _array = _arrays select _i; saveVar (format ["%1", _array]); }; }; -
I know this topic is a little old but still a relevant question:
If you save a variable using saveVar or saveStatus, does it also save any variables that were set on the object using setVariable? Can I in a later mission simply use
CampaignVar getVariable "variable"
?
-
How do I get this to properly show? I am trying to make a basic medical assessment report that follows this format:
MAIN TITLE
Wounded:
- list of names
Critical Condition:
- list of names
I am storing separate parts of the string into variables, and adding them all together later to create the final string.
Here is the code of the string variables being created:
_reportTitleMain = "MEDICAL ASSESSMENT & REPORT <br/> <br/> <br/>"; _reportTitle1 = "Small Wounds: <br/> <br/>"; _reportWounded = ""; {_reportWounded = _reportWounded + (format ["%1 <br/>", name _x])} foreach WoundedUnits; _reportTitle2 = "<br/>Critical Condition: <br/> <br/>"; _reportCritical = ""; {_reportCritical = _reportCritical + (format ["%1 <br/>", name _x])} foreach CriticalUnits; _report = _reportTitleMain + _reportTitle1 + _reportWounded + _reportTitle2 + _reportCritical;I tried showing _report inside both the briefing diary and using a dialog with structured text. Both of them display this instead:
MEDICAL ASSESSMENT & REPORT ?and thats it.
How do I have it properly display the entire text? Is there some other method for joining strings? (maybe I did it wrong)
EDIT**
This issue has been solved :D
It turns out you cannot use '&' inside strings, it stops showing the rest of the string where ever symbols like & or % are placed. So as a useful reminder, if you see a question mark shown in your string, you are using invalid characters.
-
as others have said, there are plenty of fps games around that have what people are requesting here. But so far there is only one sandbox game that gives user creativity.
-
because you cant assign a behaviour to yourself: you only give orders to member units - not to yourself.
-
you can also just give a get in nearest waypoint near the static too, it will make the group get in nearest vehicles (including statics) so if you have a cluster of them it may be easier using one group to get in them.
-
yup, I found it the hard way digging through the config.
However this is a potential problem because the string of Resistance is "GUER", so when you try to get the string of the side using str side unit, it returns the wrong side string. So for my RUIS script, I shall have to add a check to change the side string to guerrila if guerrila units are going to be spawned, which seems pointless to me.
but thanks for the reply ;)
-
Thanks :)Ive had no issues with anything yet in my extensive busy coop mission since last figuring out a few things I had messed up :D .
Well I do notice once and a while a flicker of an object or body coming back like a ghost but doesn't effect gameplay.
Anybody else experience this?
As in seeing what was an alive soldier standing for a split second when they have been dead a while lying on the ground.
yeap I have seen it - happened on a domination server where a black hawk suddenly appeared in the air and floated there for a few seconds, then it disappeared again, few minutes later the real black hawk shows up and it did a quick flicker again (the real one disappeared momentarily)
-
I tested this code inside a trigger, and it does not work:
GRP = [getpos S3, Resistance, (configFile >> "CfgGroups" >> "GUER" >> "GUE" >> "Infantry" >> "GUE_InfTeam_1")] call BIS_fnc_spawnGroup
it works when I change it to east or west, but apparently GUE groups cant be spawned? Is the side name different?
I tried to spawn GUE in RUIS, and it did the exact same thing - creates groups, but no actual units are created.
Is this a bug? or is it an error on my part?
just tried it again like this:
GRP = [getpos S3, side player, (configFile >> "CfgGroups" >> str (side player) >> (faction player) >> "Infantry" >> "USMC_FireTeam")] call BIS_fnc_spawnGroup
it works like this, but when I change the group type to one of the GUE group types, nothing happens, no error in rpt either. What gives?
Edit again:
It seems like there is a missing config entry with gue faction, or that the side is messed up in config. This shows nothing:
hint format ["%1", configName (configFile >> "CfgGroups" >> str (side player) >> (faction player) >> "Infantry")]
where If i switch to usmc or ru it does actually show the config name.
-
thanks for the suggestions sickboy and demonized. I think I shall try the XEH since it looks much more cleaner.
ty ;)
-
this is definitely not correct. Use _this instead... but is it the only problem? I don`t know... it`s too early in the morning for me.. :oyou are right about _this, but is this not used inside scripts? this has always been used in trigger activation lines and init boxes and waypoint activation boxes?
Unless it has changed, I wasn't aware, but this still works inside the editor - maybe too early in the morning? :D
-
I am using a very basic function that I made that allows me to create light sources with basic input on light intensity and color etc. It would be alot easier for me to do this on the init line of an object since I can avoid unnecessary naming of objects and having to use a trigger to call all these lights. I thought that:
call compile preprocessfilelinenumbers "Functions.sqf"
would allow the function (which is named Fnc_CreateLight) to be called anywhere, including the init line of objects or units. But when I use try to use it for ex:
lobj1 = [ [getpos this select 0, getpos this select 1, 2], [0.0, 0.5, 0.5], 0.05] call Fnc_CreateLight
it does not do anything, when I hinted to see if lobj1 exists (the function returns the light object) it returns as <any>, if I use it in a trigger the light is created as expected.
Is there something I am missing here? I thought I would be able to call the function from the init line if I preprocessed the functions script?
-
I love the AEK, there are many different rifles I have seen, but this one is special to me :)
I only wish the sound file was better for the weapon, but other than that its a great looking model indeed :D
-
yeap, cant assign local variables in trigger space since its global. I managed to get this working for my weapon team script. however, it had to be scripted in order to continuosly loop and update the high command selection as well as enable/disable comm menu actions when the appropriate team is selected.
have a look here: http://forums.bistudio.com/showthread.php?t=128524&highlight=weapon+team+script
the script is in the example mission, the main one has some insight how to do it, but beware, the comm menu can get very complicated when trying to pass local variables or parameters for it.
-
looks like I cant play the campaign - usually after 2nd/3rd mission I either get a crash where I have to start over the campaign, or I am no longer squad leader so I cant order my team inside the insertion vehicle or do anything. Strange because this problem never existed on the older version of the campaign.
Ill wait until the squad leader bug gets fixed :)
-
if i'm not wrong the coder behind moved to be lead coder of Red Orchestra mod and then standalone game(s)that makes sense: the feel of RO is very similar to TC:E, some of my friends keep checking to see if the mod is still alive, had great times on it.
but now i found arma :D
-
ill be honest here and say that the only good realism focused fps that was pvp was True Combat: Elite mod for the Wolfenstein engine. And that was primarily a cqb oriented game.
So I see a long road still before pvp taking off successfully in a mil-sim. I dont recall anyone bringing up how great ghost recon 1&2&3 mp was, or rainbow six mp.
Projector and TV and laptop off. how to animate
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted
managed to get it work, you just need to create the projectorscreen, and then setobjectTexture it with the name of your picture in paa format.
here is a screen of my briefing room: