Jump to content

mr.peanut

Member
  • Content Count

    334
  • Joined

  • Last visited

  • Medals

Everything posted by mr.peanut

  1. Well what I had was a script to randomise mission weather and start time. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">x3 = -99 if (local server) then {x1 = random 0.40; x2 = random 1; x3 = random 10;{publicVariable _x} forEach ["x1","x2","x3"]} Â Â @(x3 != -99) 0 setFog x1 0 setOverCast x2 skipTime x3 _x1_0 = x1 _x2_0 = x2 x2 = -99 if (local server) then {x1 = random 0.40; x2 = random 1;{publicVariable _x} forEach ["x1","x2"]} Â Â @(x2 != -99) _x1 = (x1 - _x1_0)/360 _x2 = (x2 - _x2_0)/360 _i = 0 #loop _i = _i + 1 10 setFog (_x1*_i + _x1_0) 10 setOverCast (_x2*_i + _x2_0) ~10.5 if (_i < 360) then {goto "loop"} exit All of the variables being made public were defined in my init.sqs. However, when I called the above script from my init.sqs it never worked. Â The time and weather were always the same. It worked on my own computer as a non-ded server but not on a ded server. Â When I called the code from a trigger that fired as soon as the mission began, it worked most of the time. Â The dedicated server can be a bit network laggy, often causing sync problems for triggers etc. Â This has made me paranoid about executing the publicVariable command from the init.sqs, especially when passing randomised mission parameters.
  2. (Lazy Question) Does the camSetTarget command work on markers, or must the command be passed the marker position?
  3. mr.peanut

    Camera and Markers

    Well this is the thing... I have tried using markers and game logics both as camera targets. With gamelogics my code works, with markers it does not. Â The difference must be that I did not add a height element. Â My script setPos's 12 gamelogics around a player in a circle of one metre diameter. By then cycling through the game logics as camera targets with a small delay you can get an overhead spinning view of the player. Â This had to work in multiplayer with the camera spinning and zooming in on each player in turn, so client side it would wait until the server had setPos'd the logics. Â I was hoping to use markers to simplify the code, as I was getting desync between server and clients. In the end an extra delay for the server solved the problem. Â When I tried the same using markers, just using the getMarkerPos 2D positions as camera targets, I did not get the spinning view. So I am sticking with the gamelogics because I can not be arsed to get the markers to work. Â Since markers are local placing them around each player in turn should be instantaneous and work better to keep all clients in sync, in principle.
  4. Then create two variables stoptheai1 and stoptheai2. Just double the procedure. Make two scripts stoptheai1.sqs and stoptheai2.sqs . addAction ["Stop","stoptheai1.sqs"] to one vehicle, addAction ["Stop","stoptheai2.sqs"] to the other. Make two triggers, one that activates when stoptheai1 is TRUE; the other activates when stoptheai1 is TRUE. The first trigger on activation: doStop vehicle1; stoptheai1 = FALSE; publicvariable "stoptheai1" . The second trigger on activation: doStop vehicle2; stoptheai1 = FALSE; publicvariable "stoptheai2." Although this is not a very elegant solution it is straight forward, and not to sound too critical but it is an obvious extension of the method I first posted.
  5. mr.peanut

    Mapfact Powerswitch

    If you add "standard" streetlights to Tonal island in the game editor (editorupdatev1.02), and then switch them on, they will light up half way up their poles. Â I can not remember what other islands this happens for. Â My comment about ground level comes from examining some of the code from ECP, can not remember where....
  6. mr.peanut

    Stop from seeing the map

    Lol... very similar to the showRadio thread going on... In your description.ext put the following line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">showMap 0; And the map will not be seen by anyone. In a script if you then put: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">showMap TRUE The player will see the map. Note: the above code line must be executed for each client in a multiplayer game if you want all players to see the map.
  7. mr.peanut

    Radio command mp

    <s>Ooops. Put the code in one time trigger instead that activates as soon as the mission starts. You are correct. Putting it in the init.sqs will not work.</s> I give up....
  8. mr.peanut

    Radio command mp

    My first post shows an example.
  9. Ack.. I keep screwing up! Â Have edited my above example to work properly with the addition of an intermediary script.
  10. mr.peanut

    Mapfact Powerswitch

    Lo Bee, Editor placed resistance streetlamps will always have this bug on certain islands, because of how the ground level is defined. One some islands ground level is off by 1m. Certain streetlamp addons have fixed this, addons we do not have on LOL.
  11. Here's the potential problem. For a command to work on a unit it must be executed on the machine on which the unit is local.  For enemy AI this would be the server. For friendly AI not under a player's command this would be the server. For friendly AI under a player's command,  this would be the player's machine.  The results of an addAction are only executed on the player's machine.  That is, when the player uses the added action, the  stop command only runs on the player's machine not on the server. If you make sure the command is executed on all clients, using a trigger, for example, it should work. On machines for which the unit is not local the command will be ignored.  This is true in general for unit commands such as stop, move, target etc. Another issue can be that units do not obey direct commands if they already have waypoints which were placed in the editor. They might obey the command for a split second, but then ignore it. If the unit is in a land vehicle and you want it to stop the most effective way is to setFuel 0.  This is a real kludge, but it works. So here is my advice- In your init.sqs define a variable: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">stoptheai = FALSE In your addaction: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addAction ["Stop dammit!","stoptheai.sqs"] Make the script stoptheai.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">stoptheai = TRUE publicVariable "stoptheai" exit In the editor add a trigger with the condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">stoptheai And in the activation put the code you want to use to stop the ai, for example: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">doStop unitname; stoptheai = FALSE; publicvariable "stoptheai" This is the most simple way.  One boolean (TRUE/FALSE) variable and trigger for each action. You could be more sophisticated and use one trigger for all actions and then have the trigger run a script that checks which action to apply.
  12. Okay, I added benreeper's suggested line to my script and another line that checks if the player is the only one alive in his group. Â I then added a server script that checks every five seconds to see if the leader of a group is dead and if so joins him to GrpNull. Â This seems to work. Now another strange thing happens. Â The radio appears on the map screen, but the radio commands via keystrokes are not available. Â This does not happen each time. Anybody have a copy of Gen Barron's Rank function or know if it would solve this problem?
  13. Okay. I need a reliable way to determine who is leader of a player group, on a dedicated server. Â I want to enable to radio for leaders only, and when a leader dies I want the radio enabled for the new leader. My init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">showRadio FALSE [] exec "radioenable.sqs" My script radioenable.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop ~5 if ((leader player) == player) then {showRadio TRUE; hint localize "STR_RADIOENABLED"; exit} if (((units group player) select 0) == player) then {showRadio TRUE; hint localize "STR_RADIOENABLED"; exit} if not(alive player) then {exit} goto "loop" In paranoia I put in two test, but neither seem to work properly. Â If there is one AI in my group, and the AI is leader, when I kill him I do not get the hint or my radio. If there are many AI in my group, and I am second in rank and kill the AI leader, the script does work. Can anyone enlighten me about htis. On a nondedicated server it works fine, but not on a dedicated.
  14. Odd thing is, I thought my second check, the one that sees if the player is the zero element of an array of his group, would work if the leader command failed, but it does not work either. However, it might work if the leader is assigned grpNull!
  15. Use this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_nearGL1 = [] {if ((_x distance GL1) < 300) then {_nearGL1 = _nearGL1 + [_x]}} forEach arrayofUnits where GL1 is the name of your game logic, and arrayofUnits is an array of all the units you want to check. _nearGL1 then holds an array of all the units within 300m of the game logic. Then you could do something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_westCount = {side _x == west} count _nearGL1 Â
  16. mr.peanut

    Radio command mp

    Yes, all show commands work locally. It opens up possibilities for having a map,compass,watch or GPS shown only for players you want to see them. EDIT showRadio only removes the Alpha, Bravo etc radio channels. Â The radio will also not be shown on map screen.
  17. Thanks... I will test again and patiently wait a bit longer. Â The weird thing is that it works when there are many AI in group but not when there is one AI in group and he is leader.
  18. mr.peanut

    Radio command mp

    Man, I am way off my game this morning! I meant showRadio not enableRadio.... Ack! I have corrected my first post above. Please ignore my second post. Â I am 100% certain that showRadio is local only.
  19. mr.peanut

    Radio command mp

    <s>Okay, I meant enableRadio, not radioEnable. enableRadio is a command according to the comref. I stand by my (corrected) example which will enable the radio only on the machine on which the player is the leader of the group, and is a less kludgy solution.</s>
  20. mr.peanut

    Radio command mp

    Put the command: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">showRadio FALSE in your init.sqs Then you have to decide which player you want to see the radio. Lets say it is the leader of a group named grp1. Put the following line also in your init.sqs after the previous line. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (leader grp1 == player) then {showRadio TRUE}
  21. For hints the backslash is the escape character and \n is a newline. This does not work for strings in the stringtable. I can not remember offhand what the escape character is for the stringtable, but I know there is one, but OFPEC is down so I can not reference the stringtable tutorial. Anybody know this?
  22. Look in grouplink2.sqs for the following line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">KEY_CrewMembers = ["SoldierECrew", "SoldierWCrew", "SoldierGCrew", "SoldierEPilot", "SoldierWPilot", "SoldierGPilot"] Just add the units you do not want to get out to this array.
  23. Make a new mission and put a Resistance Crew unit on the map. Save it and then look at the mission.sqm to get the unit's class. That class must be added to the crew array. If resistance is friendly to east just put an empty resistance BMP and put east crew units in it.
  24. mr.peanut

    Mapfact.net releases DAC

    Silola, Last year I wrote a function that calculates the shortest route for a set of points, given a start point and an end point. It works for systems with five points or more. It could be used to order the waypoints such that the shortest path available is produced. It is archived at OFPEC in the Editors' Depot script resources. OFPEC is down right now, but I will provide a link in this message when it is up. A demo mission is provided. It could be adapted to work with circular routes, which are what DAC produces.
  25. mr.peanut

    Mapfact.net releases DAC

    Silola, Thanks for your reply. I missed the optional array name parameter in the documentation but have now found it. I am really impressed by the sophistication of the DAC, and can almost not believe you managed to implement it in OPF's scripting language(with all its quirks). P-Nut
×