riouken
-
Content Count
570 -
Joined
-
Last visited
-
Medals
Posts posted by riouken
-
-
Please post the code that is throwing the object null error.
-
Use isNil for variable's
while {true} do { if (isNil ("somepublicvariable")) then { somepublicvariable= 0; publicvariable "somepublicvariable"; }; };
-
Maybe an example from one of my missions will help you.
This is a set of scripts that allow the user to select a locations via mapclick and color of the flare and will rain down flares on the selected location.(The dialog and a few other parts were not shown to not cloud the example) All of the options are made locally, then the script is ran on the server so that everyone in MP can see the flares as well.
In the init.sqf
// This is the eventhandler that we are adding to the server and the clients. "flare_start" addPublicVariableEventHandler {[] execVM "opcom\scripts\flares\flaremain.sqf";};
This is from my dialog(which is local, it is just like you starting it from an addaction).
class flrstrtbtn: RscShortcutButton { idc = 1701; text = "Start"; x = 0.285417 * safezoneW + safezoneX; y = 0.176667 * safezoneH + safezoneY; w = 0.113888 * safezoneW; h = 0.0938889 * safezoneH; onButtonClick = "execVM 'opcom\scripts\flares\flarego.sqf'"; };
this is the flarego.sqf.
// Opcom Interface , By Oliver 15thMEU(SOC). flare_start = true; publicVariable "flare_start";
and this is the flaremain.sqf:
// Opcom Interface , By Oliver 15thMEU(SOC). if (!isServer) exitWith {}; // _flrinpcolor = lbCurSel 2100; // _flrinptime = lbCurSel 2101; _flrcolor = ""; _flrtime = ""; switch (true) do { case (flrinpcolor == 0) : { _flrcolor = "F_40mm_Red";}; case (flrinpcolor == 1) : { _flrcolor = "F_40mm_Green";}; case (flrinpcolor == 2) : { _flrcolor = "F_40mm_White";}; }; switch (true) do { case (flrinptime == 0) : { _flrtime = 30;}; case (flrinptime == 1) : { _flrtime = 60;}; case (flrinptime == 2) : { _flrtime = 120;}; case (flrinptime == 3) : { _flrtime = 180;}; case (flrinptime == 4) : { _flrtime = 300;}; case (flrinptime == 5) : { _flrtime = 600;}; case (flrinptime == 6) : { _flrtime = 1800;}; }; _starttime = time + 0; //_xflrpos = newflrpos select 0; //_yflrpos = newflrpos select 1 while {time <(_starttime + _flrtime)} do { flare = _flrcolor createVehicle [newflrpos select 0, newflrpos select 1,150]; sleep 21; flars_are_running = true; }; if (time >(_starttime + _flrtime)) then { flars_are_running = false; [nil,opcom,"loc",rHINT,"Flares have ended."] call RE; };
---------- Post added at 12:37 PM ---------- Previous post was at 12:30 PM ----------
The only problem with publicVariableEventhandler's are that the EH will not fire on the client that is sending the publicVariable, so if your testing it on local host or in the editor it will not work, but a work around for this is this:
flarego.sqf.
// Opcom Interface , By Oliver 15thMEU(SOC). if (isServer) then { flare_start = true; _nop = [] execVM 'opcom\scripts\flares\flarego.sqf; } else { flare_start = true; publicVariable "flare_start"; };
-
@Robalo
Thanks! Ill see about putting it in.
-
You need to exicute the script on the server, addactions are local, when you call the script from an addaction it is only called on the client that used the addaction. What you need to do is tell the server to start the script for that you will use:
http://community.bistudio.com/wiki/addPublicVariableEventHandler
Or you could use the CBA Event system.
-
I dont work with UPSMON very much but check MON_SPAWN.sqf and see if it is limiting the script to only run on the server.
For your script you should put this at the top, it will ensure that it only runs on the server, you dont want an AI spawning script running on all clients(You would have a set for each client +server.)
This will tell everything except the server to exit.(Works for Dedi as well as local hosted.).
if (!isServer) exitWith {};
I have a feeling this is due to how your calling the script, can you post more detail about how your calling it so we can debug it some more.
---------- Post added at 07:13 AM ---------- Previous post was at 07:10 AM ----------
Ok just saw your updated post, just as I thought, your calling the script from a client and the script your calling (MON_SPAWN.SQF) has a check to only run on the server. So your problem is that your calling it from a client, I need some more details though to help with how your calling it.
-
-
RSLO Updated to version 2.0!
Updates for ver 2.0:
*Added GUI
*Upped total loadouts to 5
*User can name each loadout in thier config and it will show up in the box ingame.
*Can now set view distance and terrain detail with RSLO.
*Improved scripts for better performance.
Download ver 2.0 - http://www.multiupload.com/SID1U468TM
*Updated first post.
Sorry for the long wait on the update everyone, I had to take some time off due to real life, but I am glad I could get this done and out to everone. I hope you enjoy using it.
Thanks.:bounce3:
-
Not without an addon, But there are quite a few re-skin addons to change the looks or add units to the game.
You can look for one here:
-
It may be from starting the script from the init.sqf. I have had some problems with dedicated hosting and getting scripts to run correctly especially with jip. Try this:
Start the script from two triggers:
On each trigger in the on-activation field execVM your script.
One with a condition of:
isServer
The other with a condition of :
local player
That should ensure that your script is running on every client and the server even for JIP.
-
Sorry I didn't realize you were writing in sqs, I don't know sqs very well so I cant really debug it for you.
-
Yes it is possible, but it is not the easiest project to undertake. I dont know of another project that fits all your needs, but here is an example from myself to hopefully give you some ideas.
I made this to give a single commander more flexibility when commanding a large force of AI in opposition to a large player coop team.
Zxk9m1qCh5E
-
Thank you just a question:Why do you need to put the magic variable _x into another variable first?
Because the first forEach will try to replace the unit with 1,2,3etc. This way the inner forEach runs but replaces the _sol with _x which turns to theunitname.
-
This works just tested it.
{ _sol = _x; {_sol addMagazine "ACE_75Rnd_545x39_T_RPK"} forEach [1,2,3]; } foreach units _grpone;
-
edit..
See my post below for the answer.
-
Give the bad guy the dog tags.
badguy addWeapon "EvDogTags";
Search body:
// You can add animations here etc. if (badguy hasWeapon "EvDogTags") then { hint "Dog tags were found, mission complete"; // What ever code you need to complete the mission. };
-
-;2048452']Anyone know the command to check if the player has a specific type of magazine ? I know for weapon is hasWeapon but i can't find it for magazine' date=' anyone have a idea how I'll do that.[/quote']_mags = magazines player; _magtocheck = "30Rnd_556x45_Stanag"; if (_magtocheck in _mags) then { hint "You have a magazine for the M16!"; };
That is just one way to do it. If you post some of your code and a bit more detail on what your trying to do we may be able to help you more.
-
You can adjust the AI with setSkill_array
// This is for east side op4. // Change the numbers in red to suit your needs, 1 = max : 0 = min {if (side _x == east) then {_x setskill ["spotDistance",[color="Red"]0.7[/color]]};} foreach allunits; {if (side _x == east) then {_x setskill ["spotTime",[color="red"]0.7[/color]]};} foreach allunits;
-
edit: never mind I didn't read your code right the first time.
re-edit:
Your trying to use setVehicleInit on a group, it just needs to run on the leader.
_enemyCount=12 _name=dubrovkaspawn _grpbuild1 = [getPos _name, east, _enemyCount] call BIS_fnc_spawnGroup; [color="Red"]leader _grpbuild1[/color] setVehicleInit "_grpbuild1 execVM "PlaceInBuilding.sqf"; processInitCommands;
---------- Post added at 06:46 AM ---------- Previous post was at 06:22 AM ----------
Also I dont think you really need to use setVehicleInit in this case, if this script is running on the server where the AI is local then you can just exicute the command strait out.
_grpbuild1 execVM "PlaceInBuilding.sqf";
If the script is not running on the server, then you could use the CBA event system or public variable eventhandler to execute the PlaceInBuilding.sqf.
-
quality, forgot to ask though. Is there anyway to age is on a start so that its in mayble 3 seconds of pop before the game starts?There is no way to hold the game for the player but you can force a blackout so that they can not see for the desired about of time.
cutText ["", "BLACK IN", 1]; sleep 3; cutText ["", "BLACK OUT", 1];
-
With that being an intro the function module may not be initilized when your script starts, do you have a wait in the top of your intro?
waitUntil {bis_fnc_init};
Also if your having problems getting it to start in time for your intro you should just create and start it yourself like this:
http://forums.bistudio.com/showpost.php?p=1661400&postcount=4
-
is there a way to put this on trigger for only active player (me) and not my other unit?i created a mission i don't want to put this script to every units cause i don't want them can use unlimited ammo when i'm not playing them so a trigger like radio call could be useful
// This is used in the init of the unit in the mission. this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}]; // This is used to add the eventhandler at a later time. _unitname addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}];
-
I just tested it, the Fire command does not appear to be working correctly, I could get the other commands to work but fire would not return 1 even when pressed.
I would add a small sleep command to your script though:
while{true}do{ if(inputAction "fire" != 0)then{hint "fire button pressed!"}; [color="Red"]sleep .01;[/color] };
But if your looking at doing something when the pilot fires you would always use an Fired eventhandler.
http://community.bistudio.com/wiki/ArmA:_Event_Handlers#Fired
-
yeah when I first got ARMA I did not use modfolders so this is my problem.I would just spend the time to fix your install, makes life so much easier.
Tools I do not want to play arma without:
Broadcasting addaction and removeaction effects on dedicted
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted
You should do that with CBA
Add the eventhandlers to everyone(in the init.sqf for exp.):
http://dev-heaven.net/docs/cba/files/events/fnc_addEventHandler-sqf.html
Then raise an event to trigger it:
http://dev-heaven.net/docs/cba/files/events/fnc_globalEvent-sqf.html