Sgt_Wilson
Member-
Content Count
107 -
Joined
-
Last visited
-
Medals
Everything posted by Sgt_Wilson
-
Hi, Use IsNull, that will do it.
-
Addons at ease, self-executable or typical archive
Sgt_Wilson replied to hardrock's topic in ADDONS & MODS: DISCUSSION
Will AAE allow you to install example missions into the user folder, so they can be loaded up in the mission editor? This is the worst part for me, trying to explain about the directories in users, that has the same name as the player. -
Try using deletevehicle on them once they have spawned a second time. If its AI, OFP will delete them, if there players nothing will happen. Well at least thats the theory.
-
Detecting vehicle class, is there a way?
Sgt_Wilson replied to Master_Chief's topic in OFP : MISSION EDITING & SCRIPTING
Hi, Do you want an action that is only available to certain vehicle classes, or will the same action be displayed for all vehicles? Do you want an action that just returns the actual class of any vehicle, like "M1A1" or "UAZ"? Do you want an action that tells you if its Land, Air , Tank, APC e.t.c This is what I assume you mean when you say Base Class? But I dont think you need to use nearest object, Actions should pass the Vehicle there attached to, to the script you call? Hard to say without knowing exactly what the action is for? -
Its been a few weeks since I checked, but make sure the guy do watching ObjNull is not really just watching position [0,0,0]. I dont think thats what OFP's guys do normally, try doing: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Hint Format ["%1",GetPos ObjNull] You will see what I mean.
-
I dont have a clue if this actually works or not, but I figure it should if the assumptions I've made are correct? And as nobody else has replied I'm sure there are more ways to do it, but apparently all AI in MP are classed as local to the server. So if you named all playable units in your mission PLAYER1....PLAYER14 e.t.c. in the editor, and add a game logic called server to your mission. Then call the following from the init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> SPlayerCount=0 SPlayers=[] If !(Local Server):goto "SkipServer" ;Make sure you add all players, I cant be bothered typing all fourteen out here _StartArray=[PLAYER1,PLAYER2,....,PLAYER14] {If (!(Local _x) Or (_x==Player)) Then {SPlayers=SPlayers+[_x]}} ForEach _StartArray ;So SPlayers should now be a server array of all the players. SPlayerCount=Count SPlayers _Index=1 {Call {Format["MYPLAYER%1",_Index]=_x}; Public Variable Format["MYPLAYER%1",_Index]; _Index=_Index+1}} ForEach SPlayers Public Variable "SPlayerCount" Exit ;This bit will get the players for each client #SkipServer ;Wait until the server has finished @(SPlayerCount!=0) _Index=1 #Loop SPlayers=SPlayers+[Call {Format["MYPLAYER%1",_Index]}] _Index=_Index+1 If (_Index<=SPlayerCount) Then {goto "Loop"} This should give you a global array SPlayers on all the clients and the server? Curious to see if it would, perhaps someone in the know could confirm this?
-
Addon listing agent.is there such a thing?
Sgt_Wilson replied to guttersnipe's topic in OFP : MISSION EDITING & SCRIPTING
The easiest way to browse the content of an Addon is with OFP Manager: OFP Manager -
This might be helpfull http://www.ofpec.com/editors/comref.php?letter=K#knowsAbout
-
Try <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">man playmove "FXDismay"
-
I tried it both ways, the way I originaly tested it. With this in the trigger: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Temp1=+(ThisList) Temp1 being a global variable, but it works the same passed to a script. This worked as expected with the dead units staying in the array indefinetly. I then tried using parameters passed to a script as you suggested. So in the trigger I had: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[ThisList] Exec "Script.sqs" And in Script.sqs I have this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Temp1=+_This Select 0 #Loop Hint Format["List %1",_Temp1] ~1 goto "Loop" After about 60 deconds the dead units start to disapear from the list, perhaps this delay is why your test appears to work? I tested this with AI men and vehicles, I can send you the test mission if you want to try it for yourself. Edit: Another thing about triggers is, even though you set it to activate once the condition is checked every ~0.5 seconds. Try adding this in the Condition field, to a trigger thats set to activate once: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Call {Hint Format ["%1",Time]; This} The probability of presence works the same for a units init field as it does with a trigger. If it does not showup in the game it will not be added to the array.
-
Hmmm <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array=+_this select 0 Just creates a copy of the array _this which is not the cause of Gnat loosing the link to dead vehicles. Remeber _this is just a local array of parameters passed to the script. Any arrays contained within the _this (the actual info Gnat is interested in) do not get copied. In other words it still points to ThisList in the trigger. So it gets updated every time the trigger does, hence loosing the dead vehicles, because triggers will filter out dead units. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array=+(_this select 0) Makes a copy of the content of ThisList so, when a vehicle gets destroyed he can just respawn the vehicle back into its original position in the array. I would say, dont use a trigger just to get a list of vehicles at the start of a mission, its overkill no matter how you look at it.
-
I think you need to change the script slightly, from: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array=+_this select 0 To: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_array=+(_this select 0) Or change the trigger to: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[+thislist] exec "namethem.sqs" But if you just want to add vehicles from the start you could add this to your init.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">VehiclesArray=[] And in the init field of each vehicle put this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">VehiclesArray=VehiclesArray+[This]
-
Dont know, unless for some reason OFP cant play two anims at the same time. If not sounds like something else is screwed.
-
You can use a semicolon to seperate the commands for your statement, and And for your condition: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class Opengates { displayName="Open Gates"; position="pos_gate"; radius=2.000000; condition="(this animationPhase ""ani_gate1"" < 0.5) And (this animationPhase ""ani_gate2"" < 0.5)"; statement="this animate [""ani_gate1"", 1] Â ; this animate [""ani_gate2"", 1]"; };
-
Delay between useraction?
Sgt_Wilson replied to KTM_Calle's topic in OFP : MISSION EDITING & SCRIPTING
Yes it is a bit long winded, but once its done it can use for just about anything. I forgot to update this bit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(Format["%1",AddonArray]=="scalar bool array string 0xfcffffef") Then Using Format on an array can be a bit dodgy, if it gets to big and you try and format it, it can cause a CTD. I did mean to change it so it checks a boolean instead. If you did not notice, you can get rid of this bit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _REGISTER_ADDON={(Format["%1",_AddonArray]=="scalar bool array string 0xfcffffef")};But glad it does the job -
Delay between useraction?
Sgt_Wilson replied to KTM_Calle's topic in OFP : MISSION EDITING & SCRIPTING
I would do it something like this: Create a function called RegisterAddon.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_MyAddon=_This Select 0; _REGISTER_ADDON={(Format["%1",_AddonArray]=="scalar bool array string 0xfcffffef")}; If !(Format["%1",AddonArray]=="scalar bool array string 0xfcffffef") Then { _Found=False; "If !(_Found) Then {If ((_x Select 0)==_MyAddon) Then {_Found=True}}" ForEach AddonArray; If !(_Found) Then {AddonArray=AddonArray+[[_MyAddon,True]]}; } Else { AddonArray=[[_MyAddon,True]]; GetAddonIndex=loadfile ("\MyAddon\GetAddonIndex.sqf"); }; And add this to your cpp: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init="RegisterAddon=loadfile ""\MyAddon\RegisterAddon.sqf""; [(_This Select 0)] Call RegisterAddon"; Create another function called GetAddonIndex.sqf: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_x","_MyAddon","_index","_result"]; _MyAddon=_This select 0; _Index=0; _Result=-1; {If ((_x Select 0)==_MyAddon) Then {_Result=_Index} Else {_Index=_Index+1}} ForEach AddonArray; _Result For your actions condition, include something like this in your cpp: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">condition="((AddonArray Select ([This] Call GetAddonIndex)) Select 1)"; Create a script called SetAddonStatus.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_MyAddon=_This Select 0 _Index=[_MyAddon] Call GetAddonIndex (AddonArray Select _Index) Set [1,False] ~10 (AddonArray Select _Index) Set [1,True] And in the Actions statement include this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">statement="[This] Exec ""\MyAddon\SetAddonStatus.sqs"""; This is cobbled together from my own Addon so dont be suprised if it contains syntax errors. There are a few things you have to bear in mind, but this is the bear bones of what your after. -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
I'm interested in taking a look at it, I would like to learn more about the MP side. Plus an extra pair of eyes never hurt? -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
Hmm perhaps I am going around in circles. I seems quite straight forward to me, at least I can get the following to work. 1)You calculate a waypoint and give it to the group. 2)They go off on there merry way. 3)The leader cops it. 4)He respawns and tells himself and the rest of the group to DoStop. 5)At this point everybody is standing around doing nothing. 6)The original waypoint is retrieved or a new waypoint is calculated. 7)The group is given the waypoint as a Group Move order, so everybody sets off for the new waypoint (They will not try to return to formation but just head to the WP). 8)The leader is immedeatly told to DoStop so he waits around while the rest of the group continues. Like I said I might be missing something about MP respawn? -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
. If you create your own waypoint for the original Move command, then you can use it when the commander respawns. You just have to get the script to remember it, or re-calculate it? -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
You should be able to stop any AI with the DoStop command. You could use something like this once your commander has respawned: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">MyGroup Move (GetPos Flag1) DoStop (Leader MyGroup) This will send the group on its way without the officer. -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
I was thinking about this problem for a MP mission I plan to do "one day". What do you do with your surviving squad if you die? In CTI they just stand around waiting for you, until you tell them to do something different. It should be easy enough to work out, although I dont know anything about the mechanics of spawning units in MP. Did you want to give your newly spawned guy a completly new squad so he could get on with other stuff, or just make him wait for the others to die? Is it for AI,Players or Players/AI? -
Sorry, but your as near to BIS as I can get to ask questions. With the exception of the odd post from Suma There might well be method to my madness, until I understand how OFP tackles some of the basic tasks. I wont know for sure But thanks, I do feel as though I have a better grasp now. Hopefully the more people that read this, the less chance of more vauge\stupid questions. Cheers
-
@The_Taurus Thanks, I've used a few @!(Alive)'s myself. I'll try changing them. @bn880 It probably seems like a strange question, nobody in there right mind should use @ to wait 5 seconds. My point was that OFP still has to do some maths using the ~ command. But how about if you had something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Loop ~1 GT=True @(True)....Not sure about the timing of this so possible @(GT) GT=False goto "Loop" Then perhaps 50 scripts running something like: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Loop @(GT) ....Do stuff here..... goto "Loop" Would this even work. If it did would it put less strain on the CPU than having fifty scripts all with there own 1 second delays, posted on the stack? Cheers
-
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
I tired this from a radio trigger and it worked a treat: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">DeleteVehicle MyLeader; "SoldierWB" CreateUnit [GetPos Flag1,MyGroup,"MyLeader=This"]; MyGroup Move (GetPos Flag1) I dont know, it would make sense to cleanup unused groups. But I would be a bit annoyed if it deleted a Group variable just because I choose not to use it straight away. -
Groups, and knowledge about them
Sgt_Wilson replied to Taurus's topic in OFP : MISSION EDITING & SCRIPTING
Good point about the leader, but would giving units individual move orders stop them acting as a group? Edit: Hmm...When you spawn your group again ,cant you give them the following order: group1 move ( getPos  (Leader ((units group1) Select 0)) ) This way they will not go anywhere until you tell them. BTW there are probably better ways of getting the spawn position Edited again, just to try and answer some of your other questions: Yes I think they would, every time you move units from one group to a new group using NullGroup you leave the old group in memory. OFP has a limit of 64 groups pers side (This may just be a limitation enforced by the mission editor), perhaps if you set the old group to null once your finished with it? But I dont think you need to use nullgroup just to stop them moving. I would be suprised if BIS let this slip through. Does someone know what happens when you reach the max number of groups from within a script? Yes tell it to move to its current spawn position.