Jump to content

gnurf

Member
  • Content Count

    20
  • Joined

  • Last visited

  • Medals

Community Reputation

0 Neutral

About gnurf

  • Rank
    Private First Class
  1. Nice function and except for the funDefined fuction call the principle is the same as the one i wrote. So i might acctually be on the right track. Cool! Hey, I admited that it wasn´t pretty... now i feel realy hurt *sniff*
  2. you mean somthing like this? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> call  "MyDude" + format["%1",random 999] + "= driver(bus1)" I figured on using call for this since that enables you to construct the name anyway you want, but maybe you know a better way? The problem i had when i tested this a few weeks back was that i couldn´t get around the span of the call function which made everything created in it a local variabel and void when called from outside (as you said, one is actually calling a function). Never got around to try and create a global though. I just figured it to be impossible and worked around the problem. But if you know a better way please tell  me About testing wether or not a varibel is set. Wouldn´t this simple thing work? Since "scalar bool array string 0fxcffffef" is returned by any undefined variabel. Sure dont look pretty though
  3. Nah i think i´ll keep it as it is. If i stored it in a global array i would have to clean that out once in a while not to mention keeping track of what index number corresponds to what in the array damnit you edited again ... ok sure if you dont let the script clean up after it self and just keep adding to that array that would work. But thats not a good solution in the long run Thanks for the help and suggestions though
  4. and thats exactly what i want duh! ...I was trying to illustrate the problem i had in adding the object directly into the string. I guess i failed both in illustrating the problem and adding the object. Its not that strange really and i´ll try to explain what im doing (every one not really intrested should stop reading NOW!) _CPgroup or _Current_People_Group is a group out of an array called _people consisting of groups which get processed one by one in huge loop _CPgroup = _people select _i _i is then also used on these arrays to get information about the current group that the script stored previousluy _PActionBriefInfo    select _i  ==>_CPActionBriefInfo _PActionEvent      select _i  ==>_CPActionEvent _PActionCondition _PActionFinishedCondition _PActionOnFinishedCondition _PActionObject _PActionFinishedConditionTimer _PActionConditionTimer _CPActionEvent for example is an array contining strings of commands to be executed. the last index in _CPActionEvent corresponds to the last index of every other _CP array (except _CPgroup which as i just said is a group and not an array) to execute the string in (_CPActionEvent select 3) i need to use the call function: call (_CPActionEvent select 3) But also for call (_CPActionEvent select 3) to be executed call _CPActionCondition needs to return true ? call (_CPActionCondition select 3) : call (_CPActionEvent select 3) Lets say unit1 is waiting to borde a bus. then (_CPActionEvent select 3) should be a string that looks somthing like this "unit1 assignAsCargo bus1" but that should only be executed if ? call "(_bus1_status == waiting) and (_bus1_station == _unit1_station)" returns true ? call (_CPActionCondition select ((count _CPActionCondition)-1)): call (_CPActionEvent select ((count _CPActionCondition)-1)) Basiclly im building a waypoint system with things to do in certain sequences that is to be used with a random event generator the problem i had was that if a unit was found in the driver seat of a bus i without previously having been there, for example maybe he was moved there by the moveInDriver command in a trigger, then all the other units in his group should be assigned as cargo. The problem was that when the command to move the other units into the cargo spots i had to know who was the driver to prevent him from changing seats. Also he might for some reason (a trigger again) no longer be the driver of the bus there for i needed to know who is supposed to be the driver and not who pressently is. The sollution i found (even if i don´t like it) was to add the supposed driver to the bus allready stored in _CPActionObject and also change _CPActionObject´s format from [object] to [[object,driver]]. (everyone not asleep by now should please be quiet and not wake the others)
  5. Nope. the resulting _tmp string is stored in an array and the contents of that array gets executed by a call function later on. So everything in the array must first be converted into strings and thats the problem. I cant save the temporary argument, in these examples converted to (units _CPgroup) select 0, becouse this is actually the result of a function and which might not return the same result when executed next time. There for i must store the result from (units _CPgroup) select 0 and later convert it back to an object. ...does that explain it better? Thats just.....great... Ah, well guess i will have to save the temporary argument for the unit somewhere.
  6. I´ll try to illustrate my problem with two examples example 1: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _tmp = "doStop ((units _CPgroup) select 0)" player sideChat _tmp call _tmp Here sideChat generates a message string that looks like this "doStop ((units _CPgroup) select 0)" and call _tmp works like a charm. Example 2: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _tmp = (units _CPgroup) select 0 _tmp = format["doStop (%1)",_tmp] player sideChat _tmp call _tmp Here sideChat generates a message string that looks like this "doStop (CIVL Foxtrot Black:1)" but call _tmp generates this error Why can´t i just use doStop ((units _CPgroup) select 0)? Becouse in the real code ((units _CPgroup) select 0) is acctually a temporary variable and the finished string is to be saved in an array to be used much later when the temporary no longer exists. obviously the problem is that CIVL Foxtrot Black:1 is not considerd an object after (units _CPgroup) select 0 has passed through the format function. so how does one convert CIVL Foxtrot Black:1 back into an object? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"doStop ( 'unknown command' (Civi Foxtrot Black:1) )" Can it be done?
  7. gnurf

    Campaign failure

    Still not working? I´m no expert at campaigns but i´ve looked at the structure of the new code to try and find things that has a different pattern to the rest. As i said im no expert but all start braces must have an end brace right? the number of braces seem to match 40 { to 40 }; but there seems to be some irregularities. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class BroccoliAirport: MissionDefault end1 = ThelastStand; lost = BroccoliAirport; template = BroccoliAirport.drno_isl; }; compared to all other classes <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class ForwardObserver: MissionDefault { end1 = BroccoliAirport; lost = ForwardObserver; template = ForwardObserver.drno_isl; }; there seems to be a { missing, and the code should probably look like this <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class BroccoliAirport: MissionDefault {                    <== added end1 = ThelastStand; lost = BroccoliAirport; template = BroccoliAirport.drno_isl; }; If im correct in my assumption that the span of the Campaign class reaches all the way down to the brace above class CfgRadio <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class Campaign {                    <== class Campaign starts here  name = "Invasion Dr. No";  firstBattle = thecampaign; ... ... ... class Thelaststand: MissionDefault { end1 = Home; lost = Thelaststand; template = Thelaststand.drno_isl;    };   };               <== class Campaign ends here? class CfgRadio then there is no end brace for the thecampaign class <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class thecampaign  {                    <==Is never ended    name = "Whole Campaign";    cutscene =;    firstMission = Invasion;    end1 =;    end2 =;    end3 =;    end4 =;    end5 =;    end6 =;    lost =; I have no clue about the span of this class but i suspect it´s supposed to look either like this<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class thecampaign  {    name = "Whole Campaign";    cutscene =;    firstMission = Invasion;    end1 =;    end2 =;    end3 =;    end4 =;    end5 =;    end6 =;    lost =;  }; or end right before class Campaign ends <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ... ... class Thelaststand: MissionDefault { end1 = Home; lost = Thelaststand; template = Thelaststand.drno_isl;    };   };   <== end class thecampaign };     <== end class Campaign class CfgRadio either way since it´s nested inside the campaign Class it must end before the class Campaign ends. Thats what i could find plus the missing ; mentioned byCrash Dome. Good luck [debugging is a state of mind]
  8. Ok did some testing with that and that don´t work for civilians either. For a civilian to start fleeing i had to execute all his fellow squad members and also push him out of his starting position. Once he started fleeing, he ran straight back to his original starting position where he again imidietly returned false when fleeing was tested. Its ok that the civis runs to their starting point, they can allways be redirected but i don't want to have to kill allmost all of them for them to realise that they are in harms way. This (civilians == cattle) should allways return true...
  9. gnurf

    Campaign failure

    Is the last }; really supposed to be there, in CfgMusic? If im not misstaken there is one too many. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class CfgMusic { Â tracks[]={};}; }; counted the <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> }; and the <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> { . If i didnt misscount the ratio is 42 against 40.
  10. Done some testing by using the ammo string that is returned by the "fire" event handler to see if what ever is fired can be tested as an object with the nearestobject command. Of all handguns i tested that fired bullets, none fired ammunition that was considerd an object. All tank shells and missile types however are considerd objects, basiclly anything that has a model. Conclusion: trying to detect bullets to see if there is a fire fight don´t work at all. the end
  11. Final problem, where can i find a list of the names for projectiles that is fired from smallarms like m16's and ak74´s in resistance and the original release? There must be one out there but i can´t find it...  Is it even possible to use nearestObject with smallarm projectiles?!? (beginning to have doubts) Should anyone be intressted this is the function mentioned previously. It takes any position as argument and returns a Boolean. True if any known type of object/projectile is detected and false if not. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_objects","_position","_i","_loops","_return","_tmp"]; _objects = ["zuni","heat105","shell105","gun120","heat120","shell120","gun120","heat125","shell125","gun125","heat73","shell73","gun73","grenadeHand","grenade"]; _position = _this select 0; _i = 0; _loops = count _objects; _return = false; while "(( _loops > _i ) and !(_return))" do {   _tmp = nearestobject [_position, (_objects select _i)];   IF ( _tmp == _tmp ) then   {      _return = true;   };   _i = _i + 1; }; _return I still say this is a bad way to detect if a civilian unit is under fire, if you got any suggestions, PLEASE!...
  12. Yeah i know functions pause the game untill they finish (learnt that the hard way ). Thats why i don´t consider it a good idea to call a function here. That would force the function to run god knows how many times per second in an intense firefight. And if it needs to check every civi for distance to nearest bullet that would really slow the game down...i think. The script im working on currently works with one civi at a time. Thats why i'm considering making a function that uses the nearestobject command (as suggested). Ofcouse that would mean only having to check for the pressence of a bullet against the current civi and not all of them for every fired event. Ofcourse the downside of this is that while being busy working with another civilian you can shoot a PK right in front of the civilians face and the function would never detect it. I have considerd the idea of testing if a unit has gone prone to determin if he is being attacked, but a unit shot in the legs is allways prone (or am i misstaken?) and the poor guy would allways keep runing... crawling for his life.
  13. Nope combatMode for civilians is allways "YELLOW" (never fire). I guess this can be set by a script/trigger but it does not automaticaly change becouse the unit is under fire. (Atleast not when i tested it) The same goes for behaviour which is allways "AWARE". About creating a function well... The script is setup to run very slowly and handles a rather big amount of civilian groups. So the chances of a unit being close to a bullet when the function is called is extremly low. Unless ofcourse there is a prolonged firefight with continious fire (i have yet to see that in flashpoint  ) Unless someone has another idea or knows what im doing wrong when testing behaviour/combatMode, i guess i´ll have to write a function for this.
  14. Im trying to find a way to detect if a civilian unit considers it self to be underfire. (Is there a value that can be tested???) If there is no value that can be tested then how does the AI determine that a civilian unit should go prone due to gunfire? Does it detect the weapon being fired or the bullet being to close or what?
  15. gnurf

    If true type {}

    They can return values!?! the possibilites! Thanks for all the help and information Cant thank you enough
×