Jump to content

VictorFarbau

Member
  • Content Count

    557
  • Joined

  • Last visited

  • Medals

Posts posted by VictorFarbau


  1. smile_o.gifsmile_o.gifsmile_o.gif

    "call" and "compile" indeed do the trick - even though the syntax has slightly changed from OFP. Somehow these commands were not on my radar screen anymore. But it does exactly what I need - convert variable names transferred as strings back into useable code lines throughout multiple script calls.

    Still no pointers but a working solution tounge2.gif

    Excellent, thanks a lot guys for all your input!

    Regards,

    Victor


  2. Sickboy, ah well, I just found it nitpicking to elaborate on the function of skipTime and its usage to skip time instead of setting it. I know darn well since I programmed and tested that stuff myself. But that's all right with me, it's the sum of all aspects and concerns that usually creates the solution so keep on nitpicking smile_o.gif

    Anyway, for most MP script parts I started to use map objects as well now; I am just slowly getting tired of trying all the proper ways that often won't work for any apparent reason.

    So the HeliHEmpty object has become the single most useful component in my ArmA programming these days smile_o.gif By setting the position you can basically transfer 3 variables at the same time in a way that works almost 100% in MP. SP missions are much more simple and usually quickly done - only to fail miserably when it comes to playing them on a server.

    Regards,

    Victor


  3. Ok, if you need to be such a nitpick...

    If you want it real easy:

    1. create an HeliHempty object and call it "timerobject" somewhere on the map and let the server set its position to [0..24,0..60,0] according to the desired time 0..24:0..60

    2. The position of map objects will be synchronized during connect and later on as well so each client can simply read the position of "timerobject" and set the local clock accordingly using skipTime

    3. Repeat steps 1 and 2 as desired on servers and clients.

    Bang boom global time is set; it's just not elegant to always use these workarounds instead of proper programming.

    Cheers,

    Victor


  4. @Donnervogel:

    I have to say that I am always writing missions and scripts 100% Multiplayer compatible. I know a lot of problems stem from this and would never occur in SP setup in the first place.

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a = [1,2,3];

    _b = _a;

    This is a good thought and straight to the point - but it doesn't work across scripts since the local reference is lost. And global references is what I am looking for.

    Regards,

    Victor


  5. Before I answer to the good comments above let me clarify what my problem is using a simplified scenario:

    I have a global variable called "sector1alert". This basically watches for intrusion of a given sector. If "sector1alert" is "1" then 10 sub-scripts will be spawned that place a mine each in that sector and wait for proximity of an enemy. Inside, each of the 10 subscripts must know whether "sector1alert" is still "1" - if it is back to "0" each script must exit. Easy to realize if I am hardcoding the "sector1alert" part into the subscripts.

    Here's the catch:

    What if I need to monitor a variable amount of sectors each time? How can I make sure that each spawned script looks at the right sectorXalert variable?

    Ok, I'll create an array and can pass on each element to the subscripts a la:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    alerts = [sector1alert,sector2alert,sector3alert...sector99alert]

    [alerts select _index] exec "placemines.sqs"

    [alerts select _index+1] exec "placemines.sqs"

    ...

    Problem will be that the subscripts will receive the actual value of the "_alerts select _index" reference (so "1" or "0") but not the variable name so they can't check the ongoing state of this variable, they have no way of referencing it.

    Man, this is a lot of explaining for a real simple issue smile_o.gif Hope it is at least a bit more clear now. I need global references / pointers to global variables since passing on the variable names simply doesn't work - only the values get passed on that way.

    Regards,

    Victor


  6. Sickboy,

    but the clients are synchronized with the server. But through a global variable managed by the server and not actually the servers local time. Main point is that all clients have the same local time.

    Answering:

    1. The universal source in the quoted script is the "globaltime" variable managed by the server and distributed to all clients via the "globalVariable" function.

    2. This shouldn't be a problem. Each time the script starts it checks whether "globaltime" has a valid value already and if so skips the amount of hours to reach the same time. When joining a game a client should typically get updated on all global variables and objects first thing.

    Cheers,

    Victor


  7. That is correct sickboy, I didn't bother to change my script specifically to the needs. I thought the necessary changes might be obvious and easy to do. huh.gif

    Don't get me wrong - I am just assuming a certain level of script understanding so I honestly thought this is obvious enough. I believe that's the best way to learn as well - study how other people solved problems and learn from modification.

    I wasn't aware whether this was a request a la "here's what I need - gimme a script!". I am sure SNKMAN's knowledge will grow further if he manages to pull this off now  biggrin_o.gif

    And to the script question of yours: yes the server does not execute the skiptime command. This would be pointless for a dedicated server and "skiptime" only has a local effect on each client. If you run a non-dedicated server then both scripts will run on your machine and the time will still be skipped. The odds and ends of local versus global effects in OFP/Arma are a fountain of joy, I can tell you  smile_o.gif

    Greetz,

    Victor


  8. I am indeed surprised that there is still a need for these. So let me simply share my two scripts (client and server) here if it helps anybody.

    Note 1: de-sync issues observed at a 1% rate, happens more when clients have sub-par connectivity. In that case a global variable updated by the server might not reach the client or -worse- be set to 0. As said, can happen but rarely.

    Note 2: The map needs a EMPTY-GAME LOGIC called "server" on it (as for most other MP compatible missions as well).

    Code for "Timeserver.sqs"

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    # Timeserver build 007

    # Victor Farbau 2004

    ?!(local Server): exit

    #update interval in minutes

    _updateinterval = 6

    #could be totally random, but these daytimes create the best atmosphere

    _hours = [5,6,7,12,17,18,19,20]

    _hourcount = (count _hours) - 1

    globaltime = _hours select (random _hourcount)

    #weatherloop

    globalfog = random 0.5

    globaloc = random 1

    globaltwready = 1

    sbcflag = sbcflag + 1

    sbcmsg = 1

    publicVariable "sbcflag"

    publicVariable "sbcmsg"

    publicVariable "globaltime"

    publicVariable "globalfog"

    publicVariable "globaloc"

    publicVariable "globaltwready"

    ~(_updateinterval * 60)

    goto "weatherloop"

    Code for "Timeclient.sqs"

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    # Time and weather client build 009

    # Victor Farbau 2005

    #client

    ~5

    ?(globaltwready != 1): goto "client"

    #waitfortime

    ~2

    ?((globaltime < 0) OR (globaltime > 24)): goto "waitfortime"

    skiptime globaltime

    #waitforfog

    ~2

    ?((globalfog < 0) OR (globalfog > 1)): goto "waitforfog"

    15 setfog globalfog

    #waitforovercast

    ~2

    ?((globaloc < 0) OR (globaloc > 1)): goto "waitforovercast"

    15 setOvercast globaloc

    _checksum = (globalfog + globaloc)

    #waitforupdate

    ~15

    ?((globalfog + globaloc) == _checksum): goto "waitforupdate"

    goto "waitforfog"

    Regards,

    Victor


  9. I think by now there are numerous time scripts out there which run in MP. At least I am using mine for years now. The principle is very simple.

    1. On the server (and only there!wink_o.gif you run a time keeper script that updates a global variable every 5 min.

    2. On each client you run a watch script that checks whether the global variable has changed and if so runs a skiptime command on the client.

    Commands used:

    publicVariable (global effect)

    skiptime (local effect)

    Cheers,

    Victor


  10. Hello,

    I was wondering if anybody knows this. Are there any pointers available in the scripting language of ArmA?

    In my current project I have a master script that spawns a couple of child processes and they all depend on one or more global variables which are supposed to control actions of the child processes. I don't want to hard code the global variable names into each single script. This would be pointless looking at future extension of this mission and the names might change anyway.

    But I haven't found a way to pass on a pointer reference to scripts. All I can pass on using the [x] exec "y.sqs" syntax is absolute values or strings but no references.

    Anybody ever had a genius idea how to overcome this?

    Thanks,

    Victor


  11. Quote[/b] ]entire waypoint management script that uses deleteWaypoint and addWaypoint.

    If you ask me: yes it is the way you need to do it to keep best control and flexibility. I am not a friend of complex map trigger matrices - often you loose overview with these and it's almost impossible to troubleshoot syntax errors in these little text boxes.

    The script should be a rather simple iteration of if..then..else constructs that change waypoints according to situations.

    Regards,

    Victor


  12. I ran this on a dedicated server with a map on which I just placed a nice thunderstorm. Works fine on each client; so it is MP-ready the way it is for all I can say.

    But this indeed requires all players to have that addon installed; which is also not really a problem in my view since this is the very concept of addons (complex code and resources preinstalled on clients instead of huge network transfers).

    To split this up and embed the scripts and resources in separate missions is certainly possible but a bit of a redundant effort in my mind.

    Cheers,

    Victor


  13. @Whoever owns this addon project now - I can share my little time&weather MP scripts with you if you like.

    These are very small and just synchronize time and weather conditions across MP players, nothing fancy and easy to use for your addon too I guess. I would really like to see this great addon work in MP thumbs-up.gif

    Just let me know if you'd like the scripts or a hand with the implementation.

    Regards,

    Victor


  14. I am busy creating a mission that spawns (and un-spawns) up to 80 - 120 enemy units (mainly soldiers, a few jeeps and BMPs) in a given sector; but never more than this at a time.

    Not only can I crash the game just by playing this mission for about 10 min; I also noticed that the ARMA.RPT file is sometimes about 5MB, sometimes even up to 20MB and it's full with one message only:

    Quote[/b] ]w:\c\Poseidon\lib\AI\aiArcade.cpp(1357) : Target acqusition slow and inaccurate (may even select friendly)

    I don't know what this exactly refers to; but indeed my enemy units act kind of stupid. Often I run into them while they are already engaged in a wild firefight amongst themselves confused_o.gif

    They seem to particularly hate any (friendly) UAZMG since they attack these very often and get shot back by the other group then.

    Is there anything I could improve to avoid this error?

    Regards,

    Victor

    * System Specs: Core2Duo 6400@2133Mhz, 2GB DDR-667, GF7800GTX@256MB,320GB SATA2

    * Addons used: STR_DEBUG Console


  15. SNKMAN,

    ok, so the code I showed is meant to be used in a script indeed. But this script is supposed to be used instead of a map trigger and not together with it.

    You can place an object (e.g. an "invisible H") called "watchme" somewhere on the map and then the script example below checks the vicinity 100m for any present / alive western soldiers (= class "Man"). If there are, then the global variable "alertmode" is set to 1. This can then be used by any other script or map trigger.

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    #watchit

    _intruders = nearestObjects [watchme, ["Man"], 100]

    IF (west countSide _intruders > 0) THEN {alertmode = 1; publicVariable "alertmode";}

    ~1

    goto "watchit"

    Hope this is more clear now.

    Victor


  16. Hello again,

    cascaded AND statements like this might confuse the parser and thus lead to unpredictable results (happens to me). You could try to enclose each statement with brackets () AND () AND ().

    You might as well create a trigger with a custom script (much nicer and more flexible). I am busy writing my own CTI mega-mission which makes extensive use of these.

    All you need is a spot and the radius you want to watch. Then you could use this piece of code in a loop and make it fit to your needs:

    <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

    _intruders = nearestObjects [_startpoint, ["Car","Tank", "Man","Air"], _triggerradius]

    IF (west countSide _intruders > 0) THEN {_alertmode = 1}

    Do you understand the above? Not sure how script-savvy you are. This fills an _intruders array with all objects in the _triggerradius vicinity which are of type Car, Tank, Man or Air and then counts the number of West objects in there.

    So Car Tank Man and Air are the classes you can identify, remove or add them as needed. West and East and Guer are the sides present in the game usually (if at least 1 object of the side exists at mission start).

    All clear?

    Cheers,

    Victor


  17. In regards to writing data to the game I had an idea I will pursue a bit during the weekend.

    UNN managed to create a systematic error reports such as:

    Quote[/b] ]Cannot create non-ai vehicle Time:4.005 Pos:[2538.71,2519.41,0.00143909] Dir:2.35279

    I am thinking of writing a small daemon program (in Windows) to pick up this type of data and transform this into an "example.sqs" script in the desired mission folder such as:

    Quote[/b] ]

    lastpos = [2538.71,2519.41,0.00143909]

    publicVariable "lastpos"

    This way the mission could start example.sqs at a defined point in time and all important global variables would get updated within the current game.

    Here's the problem: how do you get the mission to start such an example.sqs outside of the mission.pbo? Would the engine accept a singled-out file anywhere else?

    Cheers,

    Victor


  18. Very true - I have dreamt about this for a long time. Saving and loading complete scenarios (all objects & variables) in SP and MP games would enhance gameplay considerably in my mind.

    You cannot expect people to play more complex war scenarios in one session only. Then again it's boring to start all over again each time since this does not value any accomplishments made so far. Exchanging data through files would open a new perspective on mission design altogether. I'd say we need it  thumbs-up.gif


  19. Hello,

    I thought I'd just share this for people in need of quick and flexible radio voice message creation. This quick tutorial includes web links, a method and some sample files that demonstrate how to create your own radio message wave files by using a free TTS engine. It can be done in all major languages such as english (US, UK), french, german and more.

    Maybe you find this useful. Have fun! (I did) wink_o.gif

    Quick Tutorial

    Regards,

    Victor


  20. Not a problem, you can edit this all yourself since the voice is computer-generated and you know how to handle a sound editor as it seems.

    Now, to have more people benefit from this I started a new thread which includes a download of a howto plus some samples. I agree that everybody would like different voices and amplification levels - this is all possible and easy for you to do yourself. So look for a thread called "Best practice sharing - Voice creation" and have fun creating all your messages.

    Regards,

    Victor

×