![](https://forums.bohemia.net/uploads/set_resources_8/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
![](https://secure.gravatar.com/avatar/000b2d2207ea3905d04334f52d87d317?d=https://forums.bohemia.net/uploads/set_resources_8/84c1e40ea0e759e3f1505eb1788ddf3c_default_photo.png)
Spinor
-
Content Count
208 -
Joined
-
Last visited
-
Medals
Posts posted by Spinor
-
-
The Units group command returns an array of all units in group. To count the elements of such an array, use the Count command, thus
Count (Units group)
returns the total number.
Spinor
-
 _type will probably not work, its also a string Â
-
I think I just found the problem. As stated in the official command reference, you can use PublicVariable only for variables with types Number, Boolean, Object or Group.
So I think
TitleText ["Vehicle respawned", "PLAIN"];
NewRespawnMessage = false; PublicVariable "NewRespawnMessage"
should work.
To make the message appear with the appropriate type you could submit the vehicle like
SpawnedVehicle = _vcl; PublicVariable "SpawnedVehicle"
in your respawn script and rewrite the Action of the trigger as
TitleText [Format["Vehicle %1 has been repaired and returned to Base.", SpawnedVehicle], "PLAIN"];
NewRespawnMessage = false; PublicVariable "NewRespawnMessage"
although with a messy vehicle name.
Hope this works,
Spinor
-
Slayer,
your condition seems right to me, but what text do you use for the RadioAlpha.
For you task try the following:
Create the initialization script "init.sqs" (will be automatically called at mission start up) and write the following in it:
?(Side player) == west: 1 SetRadioMsg "Text for west action"
?(Side player) == east: 1 SetRadioMsg "Text for east action"
This will define the text appearing for Radio Alpha depending on the side
Make two triggers (activated by Radio Alpha) with your conditions:
this AND (Side player == west)
this AND (Side player == east)
and make them activate whatever you want. Don't put anything in the Text field as this would overwrite the text we defined in the init.sqs.
Hope this helps (and works),
Spinor
-
Hi,
thats really a tricky one.
One possibility would be to make _vcl a global variable, i.e. vcl and then make it public. But this wouldn't work if you want to use the script multiple times because they would all use vcl as variable and get messed up.
I think the best way would something like DV Chris Death suggested: Keep the whole script local on the server (i.e. use the server condition at the head of the script) and somehow transmit only the spawn message to all computers. To do this I would suggest the following:
Rewrite your respawn loop as follows:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#start
~1
?(Canmove _vcl):Goto "start"
~_respawndelay
deleteVehicle _vcl
_vcl = _type createVehicle _position
_vcl setdir _dir
NewRespawnMessage = true
RespawnMessage = format["A %1 has been repaired and returned to Base.",_type]
PublicVariable "NewRespawnMessage"
PublicVariable "RespawnMessage"
~2
Goto "start"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
This should create two public variables NewRespawnMessage and RespawnMessage if the vehicle is respawned on the server.
To show the message on all computers create a trigger (repeating) with the condition:
NewRespawnMessage
and the On Activation field:
TitleText [RespawnMessage, "PLAIN"]; NewRespawnMessage = false; PublicVariable "NewRespawnMessage"
This trigger should thus be activated on all machines once a vehicle is respawned, it displays the message and deactivates itself, thus being ready for a new message.
This should work if you use the respawn multiple times (i.e. you need only one such trigger).
...and now I hope this stuff will work :-)
Spinor
-
KaRRiLLioN,
try to put the Server condition just before the CreateVehicle command, like this
?(Local Server): _vcl = _class createVehicle getpos _respawnpoint
The script should run on all machines (printing the text) but the vehicle is only spawned on the server.
Of course you can optimize this by using the server condition also for the SetDir and the DeleteVehicle command.
Regarding your vehicle type question, I also have this problem, but as far as I know there is no command that returns the class of an object but such a command like
classstring = Class object
would be very useful (hint to BIS
)
Spinor
-
Hi,
yes you can delete an action entry but you must know its ID number.
When adding the action write something like this:
actionID = unit AddAction["text", "script.sqs"]
To remove this action do this:
unit RemoveAction actionID
Hope this helps,
Spinor
-
Hi,
it seems you simply got the activation condition wrong. To test if two things are equal, you have to use "==" instead of "=" (which is only used of assignment).
So, put this in the condition field of the trigger,
testvar == 2
and it should work.
Spinor
-
Yesterday I noticed that whenever I run OFP (and it seems only then), there is a strange job called ~f51e43 running in the background.
Can someone tell me what this is?
Spinor
-
I´m also sure that you can only create a unit in an existing group. As a workaround spawn the unit in a dummy group, then use [unitname] Join grpNull and the unit will be alone.
To name the created unit try this as the Init-line parameter of createUnit: "unitname = this"
Sadly, when used in a script, this crashes the game for me. Using it in a trigger works fine.
Once named, it should be deletable with deleteVehicle
Hope this helps,
Spinor
-
Another suggestion: Put this in the Condition field of the radio trigger:
this AND (player == guy1)
where guy1 is a playable unit. This condition should only be true on the machine of the guy1-player (also, again, I don't know if the trigger is then synchronized on all machines).
Analogously, one has to create such triggers for all playable units.
Spinor
-
I think the reason why a radio trigger does not return a unit with thislist is simply that no unit can ever activate a radio trigger. A radio trigger can only be activated by a human player. This may seem pedantic but a human player and the unit he/she controls are not the same.
hlq2action, you are right BIS could (or should) have made it possible, but I think it is not a bug of thislist.
Spinor
-
What are the names of user-placed markers in MP?
In SP the markernames are given by "_USER_DEFINED #0/X", where X is a running number X=1,2,... according to the sequence they were placed.
In MP this doesn´t seem to work. Has it something to do with changing the first number #Y/X ?
It would be nice if one could process the positions of playerplaced-markers in scripts also in MP.
Spinor
-
Yeah, I read it and yeah, I think I understand your problem, but not please correct me if I'm wrong.
The radio can only be activated by human players (so your problem is only relevant for MP, in SP there is trivially only one unit that can activate the radio, i.e. the player
).
I suggested the command player because it is a local command, i.e. it returns the unit that is controlled by the player on a specific machine.
As my understanding goes it should work the following way:
1) playerA clicks radio button
2) the radiotrigger is only activated on the machine of playerA (not sure about that)
3) any script called from the radiotrigger should run only on playerA-machine
4) using the player command in such a script should return the unit controlled by playerA, and I think this is the information you want, e.g. GetPos player gives you the position of the calling unit
Once again,
hope this works,
Spinor
-
Instead of using the thislist command, try to use the command player, e.g. in your script that you call by the radio trigger use
GetPos player
to determine the position of the calling unit.
Hope this works,
Spinor
-
Have you tried
DisableAI "" or DisableAI "null" ?
-
Regarding markers in MP, I have a rather special question:
What are the markernames?
In SP the markernames are given by "_USER_DEFINED #0/X", where X is a running number X=1,2,... according to the sequence they were placed.
In MP this doesn´t seem to work. Has it something to do with changing the first number #Y/X ?
It would be nice if one could process the poitions of playerplaced-markers in scripts also in MP.
Spinor
-
Hi,
for me createUnit crashes the game only when used within a script and with a non-empty Init-line parameter. When used from a trigger it works fine.
Spinor
-
Hi,
as far as I know the List command returns an array of units that are in the SCOPE of the trigger, i.e. that are within the trigger area and fulfill the trigger condition, e.g. all west units.
If you group the trigger with a specific unit only this unit activates the trigger and List should only return this unit (if within area).
You are right about the deactivation.
To check if a unit is in the trigger scope (both area and condition) use the In command:
unitname In (List triggername)
This checks if unitname is contained in the array (List triggername) and returns true or false.
Hope this helps,
Spinor
-
I´ve experienced the same. The strange thing is this only happens when using CreateUnit within a script.
If used in a trigger the command works normally even with a nonempty Init-line
-
You can change the callsign with:
<groupname> SetGroupID ["<callsign>","GroupcolorX"]
where <groupname> is the name of the group, <callsign> can be:
Alpha, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, Kilo, November, Yankee, Zulu, Buffalo, Convoy, Guardian, Two, Three
and the X after Groupcolor can be 1, ..., 7:
0: no color
1: black
2: red
3: green
4: blue
5: yellow
6: orange
7: pink
Example:
(Group player) SetGroupID ["Foxtrot", "Groupcolor0"]
Spinor
-
Look at your thread at the OFP Editing center, I replied you there.
-
thislist exec "script.sqs"
should do the trick. thislist returns a list of all units that triggered the respective trigger.
You can also use
List triggername.
Hope this helps,
Spinor
-
Try this instead:
this AND (player == (Leader <groupname>))
That should make sure that always the current leader can access the radio.
Spinor
Issue with user defined markers
in TROUBLESHOOTING
Posted
Another workaround would be at mission start to constantly (in a loop) check the position of say the first 50 markers;
As soon as one of these is nonzero, you know the player has placed a marker and you have its index.
Now you can normally track the placement of usermarkers.