Ajira
-
Content Count
27 -
Joined
-
Last visited
-
Medals
Posts posted by Ajira
-
-
Nevermind that last question.. i've made a very nice/workable solution :)
In the server "loop":
while {NewTargetName == _OldTargetName} do { _random = round(random(7) +1); NewTargetName = "CombatZone" + (format ["%1", _random]); }; _message = format ["Enemy forces have been sighted in %1.", (_villages select _random)]; ServerMessage = [_message, "taskNew"]; publicVariable "ServerMessage";and then in the player init:
waitUntil {alive player}; // Update the current target. "NewTargetName" addPublicVariableEventHandler { "CombatZoneMarker" setMarkerPos (getPos CombatzoneTrigger); }; "ServerMessage" addPublicVariableEventHandler { taskHint [(ServerMessage select 0), [1, 1, 1, 1], (ServerMessage select 1)]; }; //-Works like a charm, thanks for the tip guys :D
-
but won't that spam the sideChat bigtime if there's 32 players ? or is it shown only for the current player ?
-
Why not just do a simple
{_x setdamage 1;} foreach nearestObjects [_object, [], 500];where _object is just a random unit you spawned in the middle of town... this destroys everything in sight in a 500m radius. Houses, vehicles, trees, everything is leveled.
-
can you be more specific ? you mean making the marker do the sideChat ?
-
ah you mean make the trigger say it and then spawn the vehicle ? hmm...
-
using the " " with the publicVariable solved the problem!
Thanks dengibtscchon :D
---------- Post added at 11:34 ---------- Previous post was at 10:43 ----------
hmm.. now just need to figure out how to broadcast the
[West,"HQ"] sideChat "New area selected.";
to all players.
any ideas guys ? :confused:
-
hmm.. i prefer to use an SQF for the init, because we want to put in access control as well later on (e.g. only pilots can enter a plane, etc )
-
Yes, but i forgot to post it on the forum.
by the way, if i use this in MP on a dedicated server:
_unit = format ["%1", _this]; [West,"HQ"] sideChat _unit + " is now available on base.";
it gives a load of crap like like "#<number> <number> AV8B.P3D is now available on base."
:confused:
-
I think i found it.. but not sure.. will have to test in the morning..
CombatZoneTrigger setPos (getMarkerPos NewTargetName);
-vs-
CombatZoneTrigger setPos (getMarkerPos "NewTargetName");
-
Yeah, that gives the name of the vehicle, but not the description/vehicleVarName.. it's different :(
-
Ok here's the problem...
on init.sqf i check if it's the server or a player that's running it.
If it's a server, it starts the following loop:
while {true} do { if (AreaCleared) then { while {NewTargetName == _OldTargetName} do { NewTargetName = "CombatZone" + str(ceil(random 32)); }; _OldTargetName = NewTargetName; "CombatZoneMarker" setMarkerPos (getMarkerPos NewTargetName); CombatZoneTrigger setPos (getMarkerPos NewTargetName); [West,"HQ"] sideChat "New area selected."; // Do stuff, spawn russians, etc.. } publicVariable NewTargetName; sleep 10; };This works.. a russian spawns at the marker.. if i kill it, 10 seconds later a russian spawns on another random marker. So... the trigger is moved, and the marker is also moved.
if it's a player that's running the init.sqf it runs the following code:
waitUntil {alive player}; "NewTargetName" addPublicVariableEventHandler { "CombatZone" setMarkerPos (getPos CombatzoneTrigger); }; while {true} do { player setVehicleInit "_return = this execVM ""scripts\player_init.sqf"""; processInitCommands; waitUntil {!alive player}; hint "you died... sucks to be you, man... "; };This works fine in the editor, but it doesn't do jack shizzle in multiplayer. The russian guy spawns, but the marker on the map stays rock solid on the old location. For some reason it doesn't see that the variable NewTargetName changed, and so it doesn't move the marker for the user.
first of all, i thought markers were for all users, not per user ? So how come it works for player1 ( unit is "player" ), but not for player 2,3,4,5,6, etc (unit is "playable" ) ? And how come it works for player1, untill he disconnects and then reconnects ? it doesn't work anymore after that.
Any ideas guys ? :confused:
-
Super, thanks guys :D
-
funny how "vehicleVarName" always returns empty in MP... anybody got an idea how to get that to show ?
-
*facepalm* :banghead:
nevermind, fixed.. thanks :blush:
Been staring at the init script for so long, not thinking about the actual spawn script, hehe :p
-
I want to spawn the same number of enemies as the active (meaning human) players.
Unfortunately playersNumber west also counts the inactive (meaning AI) players, which results in me getting 32 opponents, while I would expect to see only 1 opponent.
Is there a way to filter that ? :confused:
on that note.. is there a way to see if a unit is a player or AI at all ? :confused:
-
:confused:Ok.. here's the situation..
i spawn a vehicle using the following code:
HMMWV = "HMMWV_Armored" createVehicle (position HMMWVSpawner); HMMWV setdir 45; HMMWV setVehicleInit "[""HMMWV""] execVM ""scripts\vehicle-bluefor_init.sqf""";
the init script is as following:
scriptName = "vehicle-bluefor_init.sqf"; _unit = (_this select 0); [West,"HQ"] sideChat _unit + " is now available on base."; waitUntil {!alive _this}; // Vehicle died, clean it up. [West,"HQ"] sideChat _unit + " died."; deleteVehicle _unit; //-all works as planned, and CROSSROAD tells me "HMMWV is now available on base." as it spawns.
The problem however is... once the thing blows up, nothing happens. I should be getting a message, and it should be cleaning up after itself; but nothing happens. It's as if the waitUntil {!alive _this}; doesn't trigger.
I've tried it with:
waitUntil {!alive _this};
waitUntil {!alive this};
waitUntil {!alive _unit};
but it never triggers. Any ideas ? :confused:
-
sweet, that totally fixed it. Thanks man :D
-
Hey guys, thanks for the replies.
The problem is more or less that the scripts don't exchange the values somehow. toggle.sqf is called (added a "hint" before the check), but it doesn't see or change the value of the variable.
tried it with both "this" and "_this" on the init code, but it makes no difference.
-
ok aside of the typo, it doesn't do anything.. no hint message either. if it was just the typo it would still give the hint message.
-
I'm trying to make an on/off toggle for a function, but i can't get it to work somehow.. maybe you guys can help me out ?
In the player's init i put:
Enabled = true; _this addAction ["Disable", "toggle.sqf", "", 0, false, true, "", "(Enabled)"]; _this addAction ["Enable", "toggle.sqf", "", 0, false, true, "", "(!Enabled)"];
toggle.sqf I put:
if (Enabled) { hint "off"; Enabled = false; else { hint "on"; Enabled = false; }While it does show me the option on the mousewheel menu, clicking the option doesn't seem to do jack shizzle.
Any ideas? :confused:
-
Yep it works just fine. Stuff stays on the ground for about a minute and then poofs. :D
-
Would it work if I set a loop on the ammobox like this ?
while {alive _this} do { _return = _this execVM "scripts\misc_loadammo.sqf"; //refill the ammobox. _weaponholders = nearestObjects[_this, ["WeaponHolder"], 5]; { deleteVehicle _x; } foreach ( _weaponholders select 0); sleep 60; } -
Well if you guys know another way to clean up the junk that is left behind when using an ammobox, then i'm all ears :)
-
I'm trying to clean up the junk that is left on the floor when you change weapons at an ammo box. But somehow it's not working..
In the player's "init':
this AddEventHandler ["LoadOutChanged",{{deleteVehicle _x} forEach ((getPos player) nearObjects ["WeaponHolder",20])}];anybody got an idea ? :confused:
waitUntil {!alive _this}; not working on vehicles ?
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted · Edited by Ajira
sweet, thanks man :D