Jump to content
Sign in to follow this  
quakergamer

Vehicleclass on a script ....

Recommended Posts

Hello,

I want to know if it's possible to do something like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = vehicleClass "Man"

?(_player distance _debris <= 1): [_player,_Debris] exec "\OPGWC_FX\Fire\OPGWC_FireTank.sqs"

Basically I can't find a way to make the script execute on EVERYUNIT that is based on the Man Class...

Thanks

Share this post


Link to post
Share on other sites

Using forEach on a big trigger and using "Man" countType [_x]>0 to check for each object's type should do the trick.

Share this post


Link to post
Share on other sites
Using forEach on a big trigger and using "Man" countType [_x]>0 to check for each object's type should do the trick.

Thanks for the help, I've never used the countType command and maybe that's why I am having problems. So let me explain:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = "Man" countType [_x]>0

?(distance _debris <= 1 forEach  _player): [_player,_Debris] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

OK that should work but I need something in front of "distance" and the other way I've tried:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_player = "Man" countType [_x]>0

?(forEach _player distance _debris <= 1): [_player,_Debris] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

Then again, I have the same problem, I need something in front of "forEach". I don't know if I am doing this right but anyway Im having problems :S.

Thanks

Share this post


Link to post
Share on other sites

Well I'll try to help you.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_PosPlayer= getpos _player

_detected = NearestObject [_PosPlayer, _Debris]

_Pos = getpos _detected

? (_Pos select 0 != 0) and (_Pos select 1 != 0) and (_soldier distance _detected < 2): [_player,_Debris] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

you have to work a litle with that gimmi a feed back ;)

maybe you have to put the all code here to help you better, maybe you just have to make

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

[_player] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

PicVert

Share this post


Link to post
Share on other sites
Well I'll try to help you.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_PosPlayer= getpos _player

_detected = NearestObject [_PosPlayer, _Debris]

_Pos = getpos _detected

? (_Pos select 0 != 0) and (_Pos select 1 != 0) and (_soldier distance _detected < 2): [_player,_Debris] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

you have to work a litle with that gimmi a feed back ;)

maybe you have to put the all code here to help you better, maybe you just have to make

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

[_player] exec "\OPGWC_FX\Fire\OPGWC_FireSoldier.sqs"

PicVert

No luck, I have tried your method and heres the error:

_detected = NearestObject [_PosPlayer, _Debris]: Error 0 elements provided, 3 expected

And the 2 variables ...

_debris = _this select 1

_PosPlayer= getpos _player

_player = "Man" countType [_x]>0

Well hope you know what it means because im not very familliar with the neatestObject command!

Share this post


Link to post
Share on other sites

ok try an other solution make your debris in a p3d, then make a cpp for your debris.

next  make this code in :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_soldier = _this select 0

_PosSoldier = getpos _soldier

_debris = NearestObject [_PosSoldier, "CLASSOFDEBRIS"]

_Pos = getpos _debris

? (_Pos select 0 != 0) and (_Pos select 1 != 0) and (_soldier distance _debris < 15) : goto "FIREOREXEC"

normally it should work let me know ;)

Share this post


Link to post
Share on other sites
ok try an other solution make your debris in a p3d, then make a cpp for your debris.

next  make this code in :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_soldier = _this select 0

_PosSoldier = getpos _soldier

_debris = NearestObject [_PosSoldier, "CLASSOFDEBRIS"]

_Pos = getpos _debris

? (_Pos select 0 != 0) and (_Pos select 1 != 0) and (_soldier distance _debris < 15) : goto "FIREOREXEC"

normally it should work let me know ;)

Well you see, the script isnt ewxecuted by a soldier but by a tank. So i cant use hte position of the tank as a variable :S

Share this post


Link to post
Share on other sites

Ok so the problem is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_player = "Man" countType [_x]>0

As you see this is an Boolean and we need an Object for the GetPos and the nearestObject command. Any suggestions on how I can make this script execute on EACH soldier ??

Share this post


Link to post
Share on other sites

yes you can just replace _soldier by _tank if you want, the class vehicle is replaced by the tank if soldier is in the select is the tank for 0 vehicle but if it's debris affect only solider and not the tank yes Foreach is better. but if it's affect only the tank : _tank = _this select 0 and eventhandler init or engine (what you need) of the tank [_this select 0] exec "\you_raddon\you_addon.sqs"

thx tounge_o.gif

Share this post


Link to post
Share on other sites
yes you can just replace _soldier by _tank if you want, the class vehicle is replaced by the tank if soldier is in the select is the tank for 0 vehicle but if it's debris affect only solider and not the tank yes  Foreach is better. but if it's affect only the tank : _tank = _this select 0 and eventhandler init or engine (what you need) of the tank [_this select 0] exec "\you_raddon\you_addon.sqs"

thx  tounge_o.gif

Well that's what I'm trying to tell you :S. Here is how the script works. A tank executes ANOTEHR script. That script executes this script right here, and I want this script to execute another script on every soldier. But the vehicle that execute this script is a tank and not a soldier :S.

Do you know how

"Man" countType [_x]>0

this command works ?

Share this post


Link to post
Share on other sites

Well I would found that you mean but now Im too bizzi but maybe if you make that :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_tank = _this select 0

_tanker = crew _tank - [gunner _tank,driver _tank,commander _tank]

or for counttype the syntaxe is :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"type" CountType array

exemple

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_numbpassager = "Tank" CountType _list

if I have time I will post a good exemple but maybe that's help you.

Share this post


Link to post
Share on other sites
Well I would found that you mean but now Im too bizzi but maybe if you make that :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_tank = _this select 0

_tanker =  crew _tank - [gunner _tank,driver _tank,commander _tank]

or for counttype  the syntaxe is :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

"type" CountType array

exemple

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_numbpassager = "Tank" CountType _list

if I have time I will post a good exemple but maybe that's help you.

:S I still have problems. I msutr count every player in the "world" of OFP, not in a specified vehicle!! Any way I can do this ?

Share this post


Link to post
Share on other sites

two methods:

1. a biiig trigger

2. a complex script. a loop which makes all ca 60 meters a "nearestObject" test. this for the whole map. there is a nearestObject it has to open a new script/function which checks if there are more vehicles/units.

i made a script like this months ago, on my machine (550mhz, 256mb sd ram) the script checked desert island in about 40 seconds... but i cant find it anymore.

ermm a question: do u want every "MAN" or only every player (in mp)?

Share this post


Link to post
Share on other sites
two methods:

1. a biiig trigger

2. a complex script. a loop which makes all ca 60 meters a "nearestObject" test. this for the whole map. there is a nearestObject it has to open a new script/function which checks if there are more vehicles/units.

i made a script like this months ago, on my machine (550mhz, 256mb sd ram) the script checked desert island in about 40 seconds... but i cant find it anymore.

ermm a question: do u want every "MAN" or only every player (in mp)?

every man unit, even the AIs!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×