Home   Help Search Login Register  

Author Topic: Assignning vehicle with object id, netstats, scripting error  (Read 4685 times)

0 Members and 1 Guest are viewing this topic.

Offline Cougarxr7

  • Members
  • *
Hi,
Does anyone know the correct syntax for assigning object ids,
ect ; (name player in objectid 400) then
or
(name player in id400) then
I have no ideal how to do this!
 also,
Has anyone got this to work?
"NetStats (MP SCORE), allowing disabling of scoreboard functionality"
I have it set to 0 in the .armaprofile for my server.
I've tried both settings 1 and 0 but the scoreboard is still there!
anyone?
« Last Edit: 13 Jun 2009, 14:05:35 by Cougarxr7 »
If this thread is in volation of forum rules , please delete.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #1 on: 13 Jun 2009, 15:44:24 »
ObjectID's, AFAIK is a number assigned to a map placed object by Visitor when a .pew file is exported to .wrp.

Maybe you meant something different, perhaps you can clarify?


Planck
I know a little about a lot, and a lot about a little.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #2 on: 13 Jun 2009, 22:42:42 »
1. :blink: ...why do you want to assign object IDs? Why don't you use variables?

2. There are two NetStats settings in the server.armaprofile: one for Cadet mode, one for Veteran mode. Are you sure you've changed both of them?
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #3 on: 14 Jun 2009, 05:42:24 »
Worldeater, thanks for your help!
Here is what I am trying to do.
I am trying to lock players out of a Cobra and researve it for my brother.
class Item318
{
position[]={9881.958984,125.147797,10346.986328};
id=400;
side="EMPTY";
vehicle="AH1W";
lock="UNLOCKED";
skill=0.600000;
text="firebird";
};
This is his bird as far as using vars, I can, just not sure how to script that.
I was trying this code,
players=[xxxxx,ooooo,zzzzz];
if ((name player) in _players) then
if ((name player) != players and  ObjectID 400 == firebird  then
{_handle = [_dunit,_vec] execVM "scripts\notallow.sqf";
I get errors, I know it's because the scipt syntax is wrong.
I would like for when player jumps into that Cobra and he's not my brother, he gets kicked.
Now you are more than welcomed to show me the correct way of doing this, please!
And yes I have set both netstats to 0 in the server.armaprofile, and the scoreborad still shows up.
Thanks! I'm learning!
If this thread is in volation of forum rules , please delete.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #4 on: 14 Jun 2009, 10:50:52 »
>:( ... my box just crashed and took the long answer with it. So here's the brief version:

Code: ("init field of the chopper") [Select]
dummy = this execVM "addGetInEH.sqf";
Code: ("addGetInEH.sqf") [Select]
private ["_broCheck"];

_broCheck = {

private ["_vehicle","_unit","_allowedPilots"];

_vehicle = _this select 0;
_unit    = _this select 2;

_allowedPilots = ["yourBro", "myBro", "someoneElsesBro"];

if not (name _unit in _allowedPilots) then {
_unit action ["GetOut", _vehicle];
hint "Authorized personal only!";
};

};

_this addEventHandler ["GetIn", _broCheck];

I haven't tested this in MP, so it might be totally wrong...
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #5 on: 14 Jun 2009, 17:22:15 »
Worldeater, I tried your code, it did not work however I can see how it should work,
one question,
how does that code see that it's for that one Cobra "firebird", ID 400?
I put my bros' name in the allowed pilots brackets.
Also in the,
          private ["_vehicle","_unit","_allowedPilots"];
Is this where you can assign that Cobra?
my guess,
          private ["_AH1W","_id400 or "_firebird","_allowedPilots"];
Again, I'm asking and guessing/learning!
I am at this time of replying working with this code.
Will let you know my results!
Thank you!
If this thread is in volation of forum rules , please delete.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #6 on: 14 Jun 2009, 17:47:35 »
Again, the IDs from the mission.sqm are totally irrelevant. Trust me: they cannot be used anywhere from script. Forget about these IDs.

The code knows the cobra because the cobra is the only vehicle that has the...
Code: (init field of the chopper) [Select]
dummy = this execVM "addGetInEH.sqf";
... in it's init field.

The private statement does not do what you think it does. Leave it as it is. You can read more about it here (look at ColonelSandersLite's examples).

Well, and the code works quite fine in single player... :D
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #7 on: 14 Jun 2009, 19:58:03 »
Worldeater, I am blind as a bat! I totally missed the chopper init!
It works like everything else you have helped me with, and the explaining of scripting code.
Thank you so very much!

« Last Edit: 15 Jun 2009, 05:30:54 by Cougarxr7 »
If this thread is in volation of forum rules , please delete.

Offline Cougarxr7

  • Members
  • *
Allowing friendly ai in Helo
« Reply #8 on: 15 Jun 2009, 05:38:24 »
Thanks for all your help Worldeater.
I was going to add this to my previous thread, forum said no double posting!
Now for 2 steps forward, 1 step back!
Everything works!
Now my Bros' recruited ai cannot get in the Cobra.
Need to figure out how to allow ai in his Cobra.
I tried serveral things, did not work, here's one,
Code: [Select]
private ["_AICheck"];

_AIcheck = {

private ["_vehicle","_unit","_allowedAI"];
_vehicle  = _this select 0;
_unit = _this select 1;

_allowedAI = ["SoldierWSniper","SoldierWMedic","SoldierWMiner","SoldierWSaboteurAssault","SoldierWSaboteurMarksman"];
if not (name _unit in _allowedAI) then (
_unit action ["getout", vehicle];
_veh vehicleRadio "RadioMsg2";
);
);
_this addEventHandler ["GetIn", _AICheck];
Gave me an error.
Thanks!
   
« Last Edit: 15 Jun 2009, 07:10:10 by Cougarxr7 »
If this thread is in volation of forum rules , please delete.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #9 on: 15 Jun 2009, 07:33:35 »
Merged for your pleasure :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #10 on: 15 Jun 2009, 15:41:24 »
Try this. It will also grant the rest of the group access to the vehicle:

Code: (addGetInEH.sqf) [Select]
private ["_broCheck"];

_broCheck = {

private ["_vehicle","_unit","_allowedPilots"];

_vehicle = _this select 0;
_unit    = _this select 2;

_allowedPilots = ["yourBro", "myBro", "someoneElsesBro"];

if ((name _unit in _allowedPilots) or
    (name leader _unit in _allowedPilots)) then {
// do nothing...
} else {
_unit action ["GetOut", _vehicle];
hint "Authorized personnel only!";
};

};

_this addEventHandler ["GetIn", _broCheck];
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #11 on: 15 Jun 2009, 20:03:37 »
Thanks! it works! But how does this,
        (name leader _unit in _allowedPilots))  allow the ai to get in the Cobra?
Again thank you!
If this thread is in volation of forum rules , please delete.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #12 on: 15 Jun 2009, 23:34:30 »
Maybe it's clearer this way:

Code: [Select]
if ((name _unit in _allowedPilots) or (name leader _unit in _allowedPilots)) then {
    ...
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #13 on: 16 Jun 2009, 20:27:51 »
h- thanks for the merge!
Worldeater, I understand the code. Maybe this will help.
if ((name _unit <player in game.
in _allowedPilots) player name in list.
or (name leader _unit <Player being a group leader?? The word leader is what allows his AI to get in the Cobra,
yes/no??
in _allowedPilots)) <player name in list.
then {
I allowed others to access that Cobra, think I found a bug.
Players allowed in my bros' Cobra and they get shot down, Cobra respawns the number of times it got shot down then some players not in the list could get in the Cobra.
Like the init in the Cobras' field dies. Anyway no big deal!!
Question, I understand,  disableUserInput true <that kills the keyboard, used for cutscenes, ect..
Can you disable a single key input such as the i key, 0x17 (scoreboard)
You've been the most helpful person I've came across, Thanks!
Do you still play arma any?
I want to personally invite you to my server "Ultimate Combat",
we use teamspeak, 67.222.138.8:8834 password is join
Hope to see you sometime!
Thanks!
If this thread is in volation of forum rules , please delete.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #14 on: 17 Jun 2009, 20:46:55 »
_unit is the guy trying to get into the chopper (either a human or AI).
name _unit is the name of the unit.
leader _unit is the group leader of the unit (note: this returns the unit itself in case it is leading a group).
name leader _unit is the leaders name.

So if either the name of the unit is on the list or the name of its leader then it is granted access to the chopper. This check works for all four kinds of units that will try to enter the chopper (privileged players, AIs of privileged player, unworthy players, AIs of unworthy player).

About the "bug":
That's because the chopper does not respawn but is replaced by a new one. The new chopper doesn't know anything about the access restrictions. To solve this problem you have to find the code where the new chopper is created and add run the script for the new chopper. The quickest way to find this piece of code is to ask KilJoy (I assume we're talking about Evo here).

And thanks for the invitation, much appreciated! I haven't played A1 since A2 was released but maybe I come back to Sahrani for a battle or two. :)
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #15 on: 20 Jun 2009, 15:31:58 »
Worldeater,
 I found where I can access the vehicle respawn. I blocked out /* */the default area of respawn so no vehicles could respawn and added this,
Code: [Select]
_ag = ["Vulcan","M1Abrams","Stryker_TOW","Stryker_ICV_M2","Stryker_ICV_MK19","AH1W","UH60MG","HMMWV50","HMMWVMK","HMMWVTOW","firebird","Cobra1"];

if(_vcl isKindOf "Air") and (_died and (damage _vcl) == 1) then{
deleteVehicle _vcl;
if(_ag == "AH1W") then {
_ag = [x,firebird,60,"AH-1Z"]spawn {[_this select 0,_this select 1,_this select 2,_this select 3] execVM "scripts\addGetInEH.sqf"};
hint"THIS IS WORKING, HELO SHOULD RESPAWN!";
_vcl = _class createVehicle _respawnpoint;
_vcl setpos _respawnpoint;
_vcl setdir _azimut;
_vcl = typeof _x;
I set myself as not allowed,get rejected like I should, then blow up the Cobra and it would not respawn!
I'm not even getting the hint.  I am not getting any script errors! But that block of code did not work!<dang!
 Being that I am not a scripter, I have given it a shot. Can you see why this did not work?
Thanks!
« Last Edit: 20 Jun 2009, 17:20:49 by Cougarxr7 »
If this thread is in volation of forum rules , please delete.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #16 on: 30 Jun 2009, 09:32:08 »
Uhm, yes... :)

  • There are two curly brackets missing. Remember: There is no such thing as a single bracket in coding. They always come in pairs!
    Quote
    if (...) then {
        ...
    }; // <--- Missing!
  • _ag will never be equal to "AH1W" because it's set to something else in line #1.
  • In line #6 you're using a variable named x. I'm pretty sure it should be _x instead.
  • Are you sure that's where the respawn is handled? Did you verify it (by adding a hint for example)? Do not underestimate the amount of  so called "dead code" in some projects (that is: code that's never used but wasn't removed).
try { return true; } finally { return false; }

Offline Cougarxr7

  • Members
  • *
Re: Assignning vehicle with object id, netstats, scripting error
« Reply #17 on: 01 Jul 2009, 07:44:15 »
Worldeater, I missed those braces when I copied the code they are there. ::)
_ag being set to all those units. I thought by the statement "if(_ag == "AH1W") ", it's asking if ag is set to that, which it is and it would return 'true'. Totally missed the _ on x.
The vehicle code was calling for code to set the vehicle up for needing repairs is call EVO_VecR'.
By changing it to call EVO_VecRm', it would respawn.
I have moved on to other projects in Arma2 however, I will still be looking into this.
I have come acrossed some code concerning vehicles respawning and I hope to have this figured out soon.
Thanks for all your help! I am sure there will be more from you in Arma2!
If this thread is in volation of forum rules , please delete.