Bart.Jan
-
Content Count
739 -
Joined
-
Last visited
-
Medals
Posts posted by Bart.Jan
-
-
i made all you said, including the description.ext modifactionsbut i stil get scalar bol....aray string  error
There are only two mistakes:
- you have no condition in radio Bravo trigger (it must be this)
- the important one in placesides.sqs inside message section:
you have
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _location == ...
and it must be
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? StartingLocation == ...
and then it works.
You have two choices now:
1) delete
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setIdentity "..."
from gamelogic init lines and delete CfgIdentities class from description.ext.
Then you can even change message section of placesides.sqs into:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#message
? StartingLocation == SaintPierre : ortmsg = Â "SaintPierre"
...
? StartingLocation == SaintPhillippe : ortmsg = Â "SaintPhillippe"
PublicVariable "ortmsg"
or
2) let description.ext and gamelogic init lines be as they are now and change message section of placesides.sqs to:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#message
ortmsg=name StartingLocation
publicVariable "ortmsg"
And than you can unname gamelogics in editor.
---
Quote[/b] ]hint format ["start in %1",ortmsg]what does %1 exactly mean?
It's substitution for content of ortmsg
exaple:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a="you"
_b="I"
hint format["%2 see %1.",_a,_b]and the result is "I see you."
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hint format["%1 see %2.",_b,_a]returns the same result.
-
There is one way. You can give identity to each gamelogic unit.
Then you do not need to name these but you must set their identities.
Init line of GL:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setIdentity "morton"; [this] exec "initstartinglocation.sqs"
the other one:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setIdentity "pierre"; [this] exec "initstartinglocation.sqs"
and declaration in description.ext:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgIdentities
{
class morton
{name = "Morton";
face = "";glasses = "";
speaker = ""; pitch = 0;};
class pierre
{name = "Saint Pierre";
face = "";glasses = "";
speaker = ""; pitch = 0;};
};tested
And you can use your original script.
---
? _location == SaintPierre : ortmsg = Â SaintPierre; PublicVariable "ortmsg";hint format ["start in",ortmsg]
It should be
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? _location == SaintPierre : ortmsg = Â "Saint Pierre"; PublicVariable "ortmsg";
hint format ["start in %1",ortmsg]
-
I have seen the problem with the error on the Getin event, but I can't find what it is.Event handler save-game bug is repaired in OFP v.1.94beta. So there can be problem with resumed (loaded) games in lesser versions.
-
I can get a script to execute happily, but it's bent on telling me who the killer was, and not who just died. Â I'm not planning on creating a different script for each and every player.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit adeventhandler ["killed",{_this exec "test.sqs"}]
test.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_deadman=_this select 0
_killer=_this select 1
Well, it depends if you are using different classes and sides.sides can be catched, classes not (as far as I know)
You can check unit class via typeOf command.
-
It's done by script detect.sqs and function detect.sqf. You need at least OFP v.1.85 because of function. But it can be changed to script easily if you want.
(0.7s is average human react time)
detect.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;array of opfor (resistance?) units: (no limit)
_opfor=(units opfor1)+[opfor13,opfor14]
;array of west units: (max 12 units)
_west=[w1,w2,w3,w4]
#start
~0.35
?count _opfor == 0 :goto "end1"
;west are detected by opfor
_out=[_opfor,_west,true] call loadFile "detect.sqf"
_west=_west-_out
~0.35
?count _west==0:goto "end2"
;opfor are detected by west
_out=[_west,_opfor,false] call loadFile "detect.sqf"
_opfor=_opfor-_out
goto "start"
#end1
hintC "west wins"
exit
#end2
hintC "opfor wins"
exit
detect.sqf:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_g1","_g2","_out","_x","_i","_who"];
_g1=_this select 0;
_g2=_this select 1;
_out=[];
{_i=count _g2;
while "_i>0" do {
_i=_i-1;_who=_g2 select _i;
if (_x knowsAbout _who > 3) then {
if (!(_who in _out)) then {_out=_out+[_who]}}
}} forEach _g1;
if (_this select 2) then {{_i="smokeshellred" camCreate (getPos _x);
_x disableAI "target";_x sidechat "i'm hit";
[_x] join bustdgrp} forEach _out}
else {{_i="smokeshellgreen" camCreate (getPos _x);
_x disableAI "target";_x disableAI "move";
} forEach _out};
_out
tested
-
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 tested that script (with ..=+_this ...) and it works on my comuter. I'm playing v.1.96beta and it was working with 1.91 for sure in similar scripts I made before. (edit:It's working with v.1.91)
Try it too.
Or try this line in any radio trigger on activation field:
<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","4"]];hint format["%1 %2\n%3 %4",+a select 0,+a select 1,a select 0,a select 1]
Quote[/b] ]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.Advantage of that triiger is that there is no need for manual listing - you simply change (remove, add) vehicle and script does the rest. You can use various probabilities of vehicle presence easily with that.
-
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"
It's not necessary.
Gnat @ Feb. 04 2004,16:42)]I did notice that if you have a script looping and looking at named vehicle ..... if the vehicle dies, you have to terminate the script and recall it for the new spawned vehicle again, because even though it is the same name ..... the first script call "looses" the link to that name after the vehicle dies.You can try to change end of VR.sqs to:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...
_vcl setdir _azimut
[_vcl, _Location, _azimut, _class, _vname ] exec "VR.sqs"
exit
And then you don't need another script.
-
Name all vehicles by another way:
-do NOT give them names in editor
-make trigger that covers area with all vehicles you want to name (or place them inside trigger area)
-trigger: activated by anybody once present; name namer
-on activation field: [thislist] exec "namethem.sqs"
-namethem.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1
_array=+_this select 0
deletevehicle namer
_n=0
_i=count _array
#next
_i=_i-1
_x=_array select _i
?"man" counttype [_x] == 1 :goto "notvehicle"
_n=_n+1
call format["West%1=_x",_n]
#notvehicle
?_i>0:goto "next"
hintc format["%1 vehicles named",_n]
(tested in SP)
Then if you have 10 vehicles they will have names from West1 to West10. But keep in mind that vehicles will be named after 1 second - not at the beginnig of the mission. You do not know which name belongs to specific vehicle but you can use that names in arrays etc.
The simpliest way: name vehicles in their init line
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">West1=this
---
You can use typeOf command in your VR.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this, r_1, 0,"West1"] exec "VR.sqs"
VR.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vcl = _this select 0
_Location = _this select 1
_azimut = _this select 2
_class = typeOf _vcl
...
-
or
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{alive _x} count [su1, su1_1, su1_2 etc...] == 0
-
Gnat @ Feb. 03 2004,13:47)]ARH Bugger !<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">.........
deleteVehicle _vcl
call format ["%1 = _class createVehicle getpos _Location", _vname]
Error: Reserved variable in expression Â
_vname was the NAME assigned to the original vehicle (like "West1")
Deleting the vehicle doesnt seem to "release" the variable .... hence ..... looks like I can't re-create (respawn) a vehicle with the same name.
Any ideas ? ........ how to release the "Reserved Variable" ?
Do not name vehicles on the map. The simplest way how to do it can be to create them in the start of misson.
If you name vehicle on map (in the editor) then vehicle name will be reserved variable. But if you name vehicle via format command then it will be standard variable that can change its content.
-
more reliable way:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{alive _x} count (units groupname) == 3
-
Why shouldn't we still try to keep this stuff in a single line"if (_x != ws3 AND _x != ws10 AND _x !=ws20) then {_x setDammage 0}" forEach (units wg1 + units wg2 + units wg3)
OK, now ws1,ws2,ws3 will be excluded from the cycle through
the groups wg1 and wg2.
~S~ CD
Another way how to exclude some units from the cycle:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x setDammage 0} forEach (units wg1 + units wg2 + units wg3)-[ws1,ws2,ws3]
trigger (activated repeatly) condition
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{damage _x > 0.5} count (units wg1 + units wg2 + units wg3)-[ws1,ws2,ws3] > 0
works but sometimes someone dies.
There is other problem because sometimes dead units respawned via setDamage 0 are ignored by AI.
-
Use these commands
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">saveIdentity
saveStatus
saveVar
addMagazinePool
addWeaponPool
pickWeaponPool
and their 'load' versions.
-
I didn't find anything but this topic and I tried to search before I made this. Well, if you come up with something post here. Âhttp://www.flashpoint1985.com/cgi-bin....nholder
http://www.flashpoint1985.com/cgi-bin....nholder
http://www.flashpoint1985.com/cgi-bin....nholder
http://www.flashpoint1985.com/cgi-bin....nholder
http://www.flashpoint1985.com/cgi-bin....nholder
-
Init line of the Boss (p1):
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">bossgroup=group this
then
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[p7,p8] join bossgroup
-
Sgt_WilsonQuote[/b] ]group1 move ( getPos  (Leader ((units group1) Select 0)) )I'm afraid this wouldn't do the trick, I've tried it and the group promptly ignores it and wonder of towards thier "previous" destination.
Try this:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"OfficerW" createUnit [[x,y,z] , group,"temp=this",0.5, "sergant"]
~0.1
temp move position temp
... respawn other squad members
-
?Ok I think I'll just reduce the number of vehicles in the mission and use the first method.But I'm not too good in scripting, will it work if i just write all the vehicles names in the quotes, where in your example was "car" so it would be: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(count thislist) - ("car,truck,car2,car3" counttype thislist) <= 0 Â
Thanks for your help!
It's not necessary to reduce the number of vehicles because
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(count thislist) - ("car" countType thislist) <= 0
is the entire condition you need. "car" is not substitute for anything. Simply put that line into the condition field of the trigger and it will be ignoring any cars in its area.
But if there can be even other types of vehicles in the area (helis, armor) use rather this condition:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"man" countType thislist == 0
It's shorter but it has the same efect. It counts only human civilians in the area. And again it's the whole condition. The trigger must be activated by civilans.
-
Hmm... i gues not, this is a multiplayer mission there is quite a lot of vehicles, and any one just can drive in there get out of car/heli, kill em all and the objecive still gona be undone.Why not? Try it. It works in SP. I can't see why it shoud not work in MP. All the cars are simply excluded from the list of civilan units presented inside the trigger area (the trigger must be activated by civilians).
Another way is to "name" all civilan units automatically on the start of mission via trigger and then check their status:
trigger activated by civilians present repeatly and named trig1, on activation field: [thislist] exec "check.sqs"
check.sqs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1
_array=+_this select 0
deletevehicle trig1
_i=count _array
_a=[]
#loop1
~0.1
_i=_i-1
_x=_array select _i
?"man" counttype [_x]==0:_a=_a+[_x]
?_i>0:goto "loop1"
_array=_array-_a
_a=nil
#check
~5
?{alive _x} count _array >0:goto "check"
hint "cleared"
Change this script to MP (local things etc.)
Or there is problem that civilians can be in their cars and can drive in and out of the area?
-
or
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_a = _this select 0
_b = _this select 1
#Loop1
~10
?{alive _x} count units _a + units _b == 0:goto "loop1"
gd=true
I experienced that sometimes (count units _a)==0 is not 0 even all group units are dead.
-
Try to change condition of that trigger to:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(count thislist) - ("car" counttype thislist) <= 0
-
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop
"markerName" setMarkerPos position player
~1
goto "loop"
-
Make the triiger activated by west present with condition
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">count (thislist-[player,guy]) == 0
trigger will be activated when there are no w units in its area and player and guy are excluded from the list. So there can be no one or only one of them or both of them.
(well maybe it will work even with trigger activated by w pesent)
Your condition (trigger activated west not present):
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this && (!player present) && (!guy present) || this && player present && guy present
trigger will be activated only when there are no west units in the area and both player and guy are present/not present in the area.
Maybe you can change condition to:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this || this && (player present || guy present)
written to OFP:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this || this && (player in thislist or guy in thislist)
edit: If there is possibility that player and/or guy can be in some car (tank, heli ...) change
'player' to 'vehicle player' and 'guy' to 'vehicle guy'.
-
How would I make a trigger that is triggered only by a few specific units? Like , I dont want the W choppers to trigger it, I want only the W troops to trigger it. ?thanks, hopefully
triiger activated repeatly by west present and condition:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{(position _x) select 2 >1} count thislist > 0
or when the choppers can land inside the trigger area:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"Helicopter" countType thislist < count thislist
-
Questions:
1) Has nil some positive effect on memory usage? Is it usefull command? (deleting of unusefull variables)
2) Is it useful to delete triggers (via deleteVehicle triggerName) that are no longer needed during mission?
3) Is script example A better then example B?
example A:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;init part here:
;e.g. createUnits and createVehicles
;placement of units,
;their behaviour and
;combatMode ...
...
;repeating part of script here
;e.g. loop checking position or status of units ...
example B:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call loadfile "init part elsewhere.sqf"
...
;repeating part of script here
4)What is better? To A)run several (10+) small scripts simultaneously or B)only one that uses array?
exaple of small script:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit=_this select 0
#loop
~5
?alive _unit:goto "loop"
hint format ["%1 destroyed",_unit]
exaple of sript with array:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_units=_this select 0
#loop1
_i=count _units
?_i<=0:exit
#loop2
~1
_i=_i-1
_unit=_units select _i
?!(alive _unit):goto "dead"
?_i>=1:goto "loop2"
goto "loop1"
#dead
hint format ["%1 destroyed",_unit]
_units=_units-[_unit]
goto "loop1"
I think it's 1)yes; 2)yes; 3)B; 4)B
but I'm not sure.
Getname??
in OFP : MISSION EDITING & SCRIPTING
Posted
publicVariable command can transfer only these variable types: Number, Boolean, Object, Group.
This topic can help you too: Server and client, Understanding their relationship
So
1) You must use my way with identities
2) change placesides.sqs:
at the begining change
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? !(Local LocalServerObject):exit
~1to<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1
ortmsg=objNull
? !(Local LocalServerObject):goto "wait"
and message section to:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#message
ortmsg=StartingLocation
publicVariable "ortmsg"
#wait
@!isNull ortmsg
cutText [format["Starting location: %1",name ortmsg],"plain down"]tested
Edit: Well there is another way without identities:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">~1
ortmsg=-1
? !(Local LocalServerObject):goto "wait"
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#message
? StartingLocation == SaintPierre : ortmsg = 0
? StartingLocation == B... Â Â Â Â Â : ortmsg = 1
? ... Â Â Â Â Â Â Â Â Â Â Â Â Â C... Â Â Â Â Â : ortmsg = 2
...
? StartingLocation == SaintPhillippe : ortmsg = X
PublicVariable "ortmsg"
#wait
@ortmsg>-1
ortmsg=["Saint Pierre","B...","C...", ... ,"Saint Phillippe"] select ortmsg
cutText [format["Starting location: %1",ortmsg],"plain down"]tested