Jump to content

Recommended Posts

Hello!

 

I am trying to make a mission for the new map from the new DLC. 

 

Here I do have the Tower with a searchlight. I have used Hide Terrain on the Tower that was there and replaced with new on. 

Now I have placed a searchlight on top of it with help of attachTo ( best position:

searchlight1 attachTo [tower, [0, 0.6, 7.6] ]; 

Now I have placed an AI in-to it. and I wounder how to make the searchlight turn on and how to make that AI "scan horizion".

I have tried this command but it didnt work:

null=[this] spawn { while {alive (_this select 0)} do {sleep random (2)+3;(_this select 0) setformdir random 360};};

hope some1 could figure this out.

sorry for bad english.

Share this post


Link to post
Share on other sites

I'd use doWatch in combination with the alternative syntax of getPos.  I've had some success with that in the past but can't find the script right now. 

Share this post


Link to post
Share on other sites
57 minutes ago, stanhope said:

I'd use doWatch in combination with the alternative syntax of getPos.  I've had some success with that in the past but can't find the script right now. 

 

Well this topic wont go away. So just use your time 🙂

I cant figure out anything with the "doWatch" or "getPos" .

 

Share this post


Link to post
Share on other sites
7 minutes ago, TheoneandonlyNOR said:

this is a DEMO version

 

By saying a "DEMO" version , ALIAS means about the mission example.

It's not just a script , but the script with a working example mission.

This is actually what i do as well in all my scripts.

Furthermore , if you check the videos and read the files with the comments , i 'm pretty sure that you will understand how to use this.

Share this post


Link to post
Share on other sites

Well. My point in this thread was to hope for a simple command that could fixt it.

Something that I could use in the unit's or Searchlight's init field. 

 

I really just look for the simple way to add it without needed to make an extra file in the Mission folder.

 

BTW. this script that Alias made. Is it working at all for the GM DLC? I belive he's script adds an searchlight to the object.

In my case I allrdy have the searchlight I just need the AI to turn it on with some Action command. And the hardest part:

Make the AI "scan horizon" or just rotate around.

 

Ofc if detect enemy he aim at them. But that's another topic.

Share this post


Link to post
Share on other sites
16 minutes ago, Alert23 said:

This?

 

Now we are talking. I will check this out right away!

Share this post


Link to post
Share on other sites

Ok @Alert23 I tried this:

 

_searchlight = _this select 0;
_dir = getdir _searchlight;
while {alive _searchlight} do {

_scanningright = true;
_scanningleft = false;
while {_scanningright AND ((getdir _searchlight) < _dir + 25)} do {
_searchlight setdir ((getdir _searchlight) + 0.1);
sleep 0.02;

if ((getdir _searchlight) > _dir + 25) then {_scanningright = false;_scanningleft = true;};
};



sleep 4;

while {_scanningleft AND ((getdir _searchlight) > _dir - 20)} do {
_searchlight setdir ((getdir _searchlight) - 0.1);
sleep 0.02;

if ((getdir _searchlight) < _dir - 25) then {_scanningleft = false;_scanningright = true};

};

sleep 4;
};

But seems not working. I copied this and tried the Unit init with no luck. Tried with the searchlight init but no luck there neither. 

Do I have to do something more than only copy paste this somewere?

 

Regards!

Share this post


Link to post
Share on other sites

you have to create a sqf file in your mission folder

ScanZone.sqf

_searchlight = _this select 0;
_dir = getdir _searchlight;
while {alive _searchlight} do {

_scanningright = true;
_scanningleft = false;
while {_scanningright AND ((getdir _searchlight) < _dir + 25)} do {
_searchlight setdir ((getdir _searchlight) + 0.1);
sleep 0.02;

if ((getdir _searchlight) > _dir + 25) then {_scanningright = false;_scanningleft = true;};
};



sleep 4;

while {_scanningleft AND ((getdir _searchlight) > _dir - 20)} do {
_searchlight setdir ((getdir _searchlight) - 0.1);
sleep 0.02;

if ((getdir _searchlight) < _dir - 25) then {_scanningleft = false;_scanningright = true};

};

sleep 4;
};

and in the init field of the object:

null = [searchlight1] execVM "ScanZone.sqf"

  • Like 2

Share this post


Link to post
Share on other sites

Thank you @Alert23 I will test this and reply if it works 😄

 

I should maybe make another toppic but I try anyway maybe some of you know. 

 

me and my Unit has some missions, Where we got an Zeus that operate's it. I wounder how or is there a way for the Zeus to know when a player dies? 

Give him an hint or a sound anything... Zeus are blufor unit and the rest of player's are blufor too.

Share this post


Link to post
Share on other sites
16 hours ago, sarogahtyp said:

https://community.bistudio.com/wiki/Arma_3_Curator

 

at the bottom below the heading "Icons"

 

Think I found it thanks.

 

So it means I can place this in the unit init file? 


player call BIS_fnc_drawCuratorDeaths;

and "player" will auto be name of the player that plays as this unit?

or do I have to change it to "this" ?

Share this post


Link to post
Share on other sites
On 5/5/2019 at 4:57 PM, Alert23 said:

and in the init field of the object:

null = [searchlight1] execVM "ScanZone.sqf"

 

"searchlight1" is the name of the unit right?

 

EDITED: 

 

Nvm. I got it to work "searchlight1" is the searchlight object's name. Thank you. 

Only problem now. the unit/AI does not turn the light on. 😞 

And he's like rotating instant back and forth. is there a way to make it kinda smother? 

I belive that must be changed in the sqf file, but were? if you could show me were to make this smother or fix it for me. I be really happy. 😄 

Share this post


Link to post
Share on other sites
5 hours ago, TheoneandonlyNOR said:

 

"searchlight1" is the name of the unit right?

 

EDITED: 

 

Nvm. I got it to work "searchlight1" is the searchlight object's name. Thank you. 

Only problem now. the unit/AI does not turn the light on. 😞 

And he's like rotating instant back and forth. is there a way to make it kinda smother? 

I belive that must be changed in the sqf file, but were? if you could show me were to make this smother or fix it for me. I be really happy. 😄 

you can force lightOn put this in the init field of the searchlight:

null=[] spawn { while {true} do { player action ["lightOn", Searchlight1]; sleep 0.01};};

 

do some changes at the red lines:

Spoiler

_searchlight = _this select 0;
_dir = getdir _searchlight;
while {alive _searchlight} do {

_scanningright = true;
_scanningleft = false;
while {_scanningright AND ((getdir _searchlight) < _dir + 25)} do {
_searchlight setdir ((getdir _searchlight) + 0.1);
sleep 0.02;

if ((getdir _searchlight) > _dir + 25) then {_scanningright = false;_scanningleft = true;};
};

sleep 4;

while {_scanningleft AND ((getdir _searchlight) > _dir - 20)} do {
_searchlight setdir ((getdir _searchlight) - 0.1);
sleep 0.02;

if ((getdir _searchlight) < _dir - 25) then {_scanningleft = false;_scanningright = true};

};

sleep 4;
};

 

Share this post


Link to post
Share on other sites
7 hours ago, Alert23 said:

you can force lightOn put this in the init field of the searchlight:


null=[] spawn { while {true} do { player action ["lightOn", Searchlight1]; sleep 0.01};};

 

This did not work. 😞 The light does not turn on. 

 

7 hours ago, Alert23 said:

sleep 0.02;

if ((getdir _searchlight) > _dir + 25) then {_scanningright = false;_scanningleft = true;};
};

sleep 4;

while {_scanningleft AND ((getdir _searchlight) > _dir - 20)} do {
_searchlight setdir ((getdir _searchlight) - 0.1);
sleep 0.02;

 

this "sleep" will make it a bit smother? 🙂 

Can I do "_dir - 180" instead? since I kinda want the light to go in cercle as long as it does not detect enemy. ?

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

×