Jump to content
Sign in to follow this  
thaFunkster

How to change AI stance? (and other questions)...

Recommended Posts

Wow!

Thanks, that's a great help.

Sure is in depth to get this working accurately.

I think I will go with the option 2 you suggested, using doFire to aim at him, then "fire" for a cannon shot.

The thing is, it actually wont matter if it kills him, as long as it aims at him, and fires (I want to leave a bit to the imagination...)

So you know what I am doing, I am actually making a video. This is the first part, the second part I will be doing a mass combined arms attack, and all of this will come in very helpful. The video is for a games company as a demo of what I can do with video editing, and if they like it they will have some commission work for me....

So no doubt I will have more questions, as I go on, but in any case Ill post a link here to the video once it's finished so you can check out what you have contributed to.

Share this post


Link to post
Share on other sites

OK,

Something really fishy is going on and I cant pick it up.

The trigger is defintely activating, I added the global chat in and it works.

arma22010010209035879.jpg

(I have since removed the Chat from the trigger above).

Now here is the script that it is calling:

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

sleep 1.0;

vehicle BMP1 fire "27A2"

Yes the script is in the right directory etc....As other scripts in same directory are working.

So why does the globalChat never activate in this script?

Share this post


Link to post
Share on other sites

Try

nul = [] execVM "shoot.sqf";

instead.

I'm not sure what, if anything, "this" refers to in a trigger activation, but I'm guessing it refers to nothing at all and makes the statement invalid.

---------- Post added at 07:08 AM ---------- Previous post was at 07:05 AM ----------

According to the Biki, "Within the On Activation block, this refers to (UNKNOWN BOOLEAN, ALWAYS FALSE?), and thisList refers to the same array as it does in the Condition block above."

Which isn't much more informative than the diagnostic logged to the Arma2.rpt file:

Error in expression <hint str(this>

Error position: <>

Error Missing )

But I would say that when the interpreter encounters "this" in one of those script fields, it gets awfully unhappy.

Share this post


Link to post
Share on other sites

Hmm, so isnt "this" the default input into that field for a trigger?

Should I remove this?

Share this post


Link to post
Share on other sites

The condition should be "this". I think it's effectively a boolean that is true if the trigger's conditions are fulfilled, and false otherwise.

The on activation shouldn't try to make use of "this". It makes no sense there and the game will see it as an error.

Share this post


Link to post
Share on other sites

I think you should remove 'vehicle'. At least, I haven't used it doing similar things. Some kind of guy, you'll notice, doesn't include it (or the 'this' in calling the script) in his examples he's made for you. An entire example mission there for you...

Apart from that, the greatest tip I can give any scripter is this:

-showscripterrors

Add it to you start-up command line. Where the mod line goes. It shows what comes up in the .rpt in real time.

Share this post


Link to post
Share on other sites

Ok, interesting.

I changed it as you suggested, now it tells me "Shoot.sqf not found"....At least we are getting somewhere....

Now looking at the folder, although the file is called "Shoot.sqf", it is a text file, whereas

"SitDown" is listed as an SQF file.

So why cant I save it as a non-text file...?

In notepad, I change the drop down list from "Text Files" to "All Files" when I save, but it still does not make much difference....

Share this post


Link to post
Share on other sites

Yep, the "vehicle" is my fault though as I suggested using them, when I was doing my test mission I tried with and without and couldn't see any difference at all, so I don't think it really matters. I left them out since they seemed to be unnecessary.

And yes, -showScriptErrors is everyone's friend. Or at least keep on eye on arma2.rpt.

---------- Post added at 08:26 AM ---------- Previous post was at 08:25 AM ----------

Now looking at the folder, although the file is called "Shoot.sqf", it is a text file, whereas

"SitDown" is listed as an SQF file.

So why cant I save it as a non-text file...?

In notepad, I change the drop down list from "Text Files" to "All Files" when I save, but it still does not make much difference....

In Explorer, go to Tools -> Folder Options, click on the View tab, and find the option to "hide extensions for known file types" or similar. Turn that off and you can rename things properly.

Share this post


Link to post
Share on other sites

The vehicle works.

I renamed the file to "fire.sqf" and it saved correctly.

So now it is working, I get the chat message, the crew turn in, buuut....They never fire. They target the man and keep tracking him, but never fire..

Here is the script again:

Fire.sqf

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

sleep 1.0;

vehicle BMP1 fire "27A2"

---------- Post added at 12:40 AM ---------- Previous post was at 12:38 AM ----------

The vehicle works.

I renamed the file to "fire.sqf" and it saved correctly.

So now it is working, I get the chat message, the crew turn in, buuut....They never fire. They target the man and keep tracking him, but never fire..

Here is the script again:

Fire.sqf

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

sleep 1.0;

vehicle BMP1 fire "27A2"

Share this post


Link to post
Share on other sites

The vehicle works.

I renamed the file to "fire.sqf" and it saved correctly.

So now it is working, I get the chat message, the crew turn in, buuut....They never fire. They target the man and keep tracking him, but never fire..

Oh, and showscript errors is done by changing the "target" on the shortcut from

"C:\Program Files\Bohemia Interactive\ArmA 2\arma2.exe"

to

"C:\Program Files\Bohemia Interactive\ArmA 2\arma2.exe-showscripterrors",

is that correct?

Here is the script again:

Fire.sqf

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

sleep 1.0;

vehicle BMP1 fire "27A2"

---

EDIT: OOPS sry network problems...

Edited by thaFunkster

Share this post


Link to post
Share on other sites

Also that... at least I was on the right track.

And there should be a semi-colon on the last line as well.

Share this post


Link to post
Share on other sites

"C:\Program Files\Bohemia Interactive\ArmA 2\arma2.exe" -showscripterrors

Share this post


Link to post
Share on other sites

When the mission starts i get the following error message:

nul

nul

Error Missing ;

line 5

Then when the trigger activates I get the same for line 12.....

I dont understand

This is the script I now have:

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

vehicle BMP1 GloablChat "Firing";

sleep 1.0;

vehicle BMP1 fire "27A2";

vehicle BMP1 GloablChat "Boom";

Share this post


Link to post
Share on other sites
What type of vehicle is your "BMP1"?

It's a BMP-3 confusingly enough...

-----

Ok, script now looks like this:

sleep 0.5;

player GlobalChat "Activated";

vehicle BMP1 setBehaviour "AWARE";

vehicle BMP1 setCombatMode "BLUE";

vehicle BMP1 doTarget Bman;

sleep 0.5;

vehicle BMP1 doFire Bman;

player GlobalChat "Firing";

sleep 1.0;

vehicle BMP1 fire "2A72";

player GlobalChat "Boom";

Now all the chat messages display, now that I have moved them to player.

However, the BMP never fires...

Edited by thaFunkster

Share this post


Link to post
Share on other sites

Did you also fix the error you were getting when the mission starts?

Your previous script had "GloablChat" which was probably the source of the error before.

The script you posted most recently works for me, except the delays don't give enough time for the BMP to properly target the enemy man, so the shot misses.

Share this post


Link to post
Share on other sites

No I didnt fix the inital error. It must be coming from that sit down script somewhere, as that is the only one that runs at the start.

What is wrong with GlobalChat? It works in this case doesnt it?

Strange, the firing isnt working for me.

I will try the script in another situation and see if it works then.

Share this post


Link to post
Share on other sites

There's nothing wrong with globalChat, but your script had gloablChat which won't work. ;)

If you can't work out the issue, you can zip up the mission directory and upload it somewhere and I'll have a look.

I added this sitdown script to my test mission and don't get any errors from it. Maybe have a quick check of spelling in any other script you're using?

Share this post


Link to post
Share on other sites

Ok thanks mate, I have it working now.

One last thing: When that BMP turns it's engine on, the man has the sense to get the hell out of there, even though he is set to combatMode "BLUE" and beganiour "CARELESS".

Is there a way I can get him to stay put prone, so that he gets shot like he is supposed to?

Thanks.

Share this post


Link to post
Share on other sites

Thanks.

---------- Post added at 01:22 AM ---------- Previous post was at 12:59 AM ----------

Oh, and how do I make hm go prone?

Share this post


Link to post
Share on other sites

unit setUnitPos "DOWN";

There's also "MIDDLE" (for crouched) and "UP" (for standing).

Share this post


Link to post
Share on other sites

Camera Questions:

Now I have the mission more or less where I want it for starters, I need to start scripting some camera angles.

Now I am just trying to play around with this to start with.

But I created this script "Cam1.sqf"

_cam camsettarget _Bman;

_cam cameraeffect ["internal", "front"];

_cam camsetrelpos [-0.25, 0.5, 0];

_cam attachTo [_Bman, [-0.25, 0.5, 0];

At the start I call this in the activation field of a unit: "nul = this execVM "Cam1.sqf""

But it does not work...what am I doing wrong? Do cameras have to be sqf?

(I was hoping this cam will start infront of him at his feet...)

Share this post


Link to post
Share on other sites

What is _cam? Don't you need to create cameras first using camCreate? Telling a non-existent variable to "camSetTarget" some guy doesn't sound like it would achieve very much.

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  

×