Jump to content
Sign in to follow this  
thaFunkster

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

Recommended Posts

Thanks. That certainly helps a lot :)...

This wiki is a great link..I will try to refer here first.

---------- Post added at 02:02 AM ---------- Previous post was at 01:56 AM ----------

So I now have this, but am I missing something:

_cam = "camera" CamCreate (getPos Bman)

_cam camsettarget _Bman;

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

_cam camsetrelpos [-0.25, 0.5, 0];

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

Share this post


Link to post
Share on other sites

Cant anyone help me? Or can anyone point me to a really good guide to camera scripting? I have searched the wiki, but it only seems to have info on Camera.sqs - I want help on the whole process and a list of camera related commands.....

---------- Post added at 08:55 AM ---------- Previous post was at 08:54 AM ----------

It used to be alot easier back in the OFP days if my memory serves me correctly.

Share this post


Link to post
Share on other sites

Have you added -showScriptErrors yet???

From that snippet, you're mixing a global variable (Bman) with a local variable (_Bman) - unless you're defining _Bman somewhere that's not going to work, and even if you are it's a bit confusing using two different names for (presumably) the same object. And if they're different objects, then that's even more confusing. :)

Also, your attachTo is missing a ].

Finally, you need to commit the camera for some of the things to take effect.

_cam camCommit 0;

to commit immediately. I think the setRelPos is redundant (either use attachTo or setRelPos, not both - depending on the effect you're after).

I think this one does what you want:

_cam = "camera" CamCreate (getPos Bman)
_cam cameraeffect ["internal", "front"];
_cam attachTo [bman, [-0.25, 0.5, 0]];
_cam camsettarget Bman;
_cam camCommit 0;

though you probably want to move it a bit further away.

Share this post


Link to post
Share on other sites

Excellent, thanks. Yes I have added the showscript errors, and I couldnt see any that referred to this...

That is very helpful...I assumed that those units referred to meters, but I guess not. I will try it out.

---------- Post added at 10:41 PM ---------- Previous post was at 09:53 PM ----------

Ok, so I now have quite a few cameras working well.

I am just having trouble with this one bit:

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

_cam attachTo [bman, [0.00, -1.2, 0.8]];

_cam camsettarget Bman;

_cam camCommit 3;

sleep 3.0;

camDestroy _cam;

_cam = "camera" CamCreate (getPos Bman);

_cam camsettarget [-80612.34,43988.49,-35329.41];

_cam camsetFOV 0.700;

_cam camCommit 0;

_cam camsettarget [-51793.31,91929.12,4541.49];

_cam camsetpos [7049.73,11206.68,30.33];

_cam camsetFOV 0.217;

_cam camCommit 5;

The reason I destroy the cam, is because it is attached to something, and for the next camera I need one that is not attached to anything. The thing is, it doesnt seem to work again once I create it.

Is there a command to unattach the camera instead?

Edited by thaFunkster

Share this post


Link to post
Share on other sites

Try using this lines before targeting your next target

titlecut [" ","BLACK IN",5]
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal", "back"]

_cam camsettarget [-51793.31,91929.12,4541.49];

_cam camsetpos [7049.73,11206.68,30.33];

_cam camsetFOV 0.217;

_cam camCommit 5;

Once the camera has been destroyed you need to create a new one. Just try the few code lines without using the cam destroy command it should disattach the camera on the relative unit

It should set back the camera into previous status, by that I mean it shouldn't be attached anymore to a vehicle or unit in your case.

Hope it helps.

cheers

nettrucker

Edited by nettrucker

Share this post


Link to post
Share on other sites

Yep you don't need to destroy or specifically detach the camera, just moving its position somewhere else with camSetPos or camSetRelPos is sufficient.

If you do for some reason create a new camera, you need to use cameraEffect for it to become "active".

Share this post


Link to post
Share on other sites

I have been trying this: Creating a new cam, but it does not seem to work:

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

_cam attachTo [bman, [0.00, -1.2, 0.8]];

_cam camsettarget Bman;

_cam camCommit 3;

sleep 3.0;

camDestroy _cam;

_cam2 = "camera" CamCreate (getPos Bman);

_cam2 camsettarget [-80612.34,43988.49,-35329.41];

_cam2 camsetFOV 0.700;

_cam2 camCommit 0;

_cam2 camsettarget [-51793.31,91929.12,4541.49];

_cam2 camsetpos [7049.73,11206.68,30.33];

_cam2 camsetFOV 0.217;

_cam2 camCommit 5;

---------- Post added at 01:24 AM ---------- Previous post was at 01:20 AM ----------

Oh, thanks for that...

Actually, I was creating this cam in a new position with a new target, and it was still "Attached" to the man, it was bobbing up and down with his running as it panned..THats why I am creating a new one...

I will look into cameraEffect, thanks for that.

Edited by thaFunkster

Share this post


Link to post
Share on other sites

Try getting rid of your attachTo temporarily - I'm pretty sure you'll see the exact same result. The character animation itself bobs up and down, and if you're having a camera target a person, then its target point will bob up and down as well. Probably better to target it at a static position instead.

Share this post


Link to post
Share on other sites

Thanks, I have this bit working now.

The issue I am having is with the titlecut not working:

sleep 11.5;

_cam2 titlecut ["",BLACK OUT", 3];

sleep 3;

_cam2 camSetTarget Rman1;

_cam2 camSetPos [6944.49,11502.91,0.97];

_cam2 camSetFOV 0.700;

_cam2 camCommit 0;

sleep 1;

_cam2 titlecut ["",BLACK IN", 3];

sleep 4;

_cam2 camSetTarget Rman1;

_cam2 camSetPos [6944.49,11502.91,0.97];

_cam2 camSetFOV 0.400;

_cam2 camCommit 5;

It hits that fade out, and never works, just stays on the same camera.

I tried getting rid of the titlecuts, and all the other script works, so it's just them preventing it working...

---------- Post added at 02:56 AM ---------- Previous post was at 02:54 AM ----------

(O, I tried just using "titlecut" rather than "_cam2 titlecut", but that still does not work.

---------- Post added at 03:00 AM ---------- Previous post was at 02:56 AM ----------

ANother thing, about your "attachTo" comment above, I need the camera attached if it is to follow a person rather than remaining static correct?

Share this post


Link to post
Share on other sites

titleCut doesn't need anything in front of it, but the wiki page also says that it's obsolete and to use cutText instead. So perhaps try with that.

Re: attachTo, I just meant you should check to make sure having the camera previously attached is actually the reason it's bobbing up and down afterwards when you've moved it (detached it). I get that bobbing effect even if I've never attached a camera to anything, if its target is a walking person.

Share this post


Link to post
Share on other sites

EDIT:

Fixed it myself for once!! :)

---------- Post added at 08:50 AM ---------- Previous post was at 07:51 AM ----------

Question:

Does having that black cinematic strip improve framerates? OR does it still render the off screen objects?

And if I want to record with FRAPS, and I slow down time, then will the sounds slow accordingly?

---------- Post added at 09:25 AM ---------- Previous post was at 08:50 AM ----------

I cant seem to find the command to change the play speed, in OFP it used to be setTimeAcc, but that does not seem to exist anymore...

Edited by thaFunkster

Share this post


Link to post
Share on other sites

Close... setAccTime.

I'm not sure if the sounds slow down as well, but I guess now you can try it and see. Don't know about the cinematic strip either, I suppose you could run FRAPS and see if it makes a difference to the framerate... personally, I'd be surprised if it was anything more than black bands being pasted over the top of the scene.

Share this post


Link to post
Share on other sites
EDIT:

Fixed it myself for once!! :)

---------- Post added at 08:50 AM ---------- Previous post was at 07:51 AM ----------

Question:

Does having that black cinematic strip improve framerates? OR does it still render the off screen objects?

And if I want to record with FRAPS, and I slow down time, then will the sounds slow accordingly?

---------- Post added at 09:25 AM ---------- Previous post was at 08:50 AM ----------

I cant seem to find the command to change the play speed, in OFP it used to be setTimeAcc, but that does not seem to exist anymore...

Hi there

1.) no the black cinematic border don't improve framerates. It's just for use in case you would like to achieve a cinematic touch in a cutscene.

2.) Sounds will not be slowed down and the sound sample source is not going to be changed.

regards

nettrucker

Share this post


Link to post
Share on other sites

Thanks guys, guess my memory was slightly off ;)...

Can someone point me to the command to remove the borders please?

---------- Post added at 03:24 AM ---------- Previous post was at 03:22 AM ----------

I see the comref has ShowCinemaBorder showm what do I do if I dont want it? "Dont Show" lol...

Share this post


Link to post
Share on other sites
showCinemaBorder show

Operand types:

show: Boolean

Type of returned value:

Nothing

Description:

Forces drawing of the cinema borders. This is normally used in cutscenes to indicate the player has no control.

It's not the word "show", it's a boolean value (i.e. either true or false). If set to true, the border is shown. If set to false, it's not.

Share this post


Link to post
Share on other sites

Ah, ok, having done some programming at uni, you would think I would know that wouldnt you?...

Many thanks.

---------- Post added at 10:17 AM ---------- Previous post was at 08:57 AM ----------

showCinemaBorder false is not doing anything.

Share this post


Link to post
Share on other sites

Can anyone help on the above pls?

---------- Post added at 01:19 AM ---------- Previous post was at 12:00 AM ----------

I now have two questions:

One, how do I remove the borders, seeing as SetCinemaBorder False does not do anything....

And second, I have two harriers, I want them to start in the air, moving at a decent speed, rather than in the middle of a field. how can I do that?Is there some kind of set location command?

I have been trying this:

Air1 setPosASL [getposASL Air1 select 0, getposASL Air1 select 1, getPosASL Air1 select 2 + 1000];

Air2 setPosASL [getposASL Air2 select 0, getposASL Air2 select 1, getPosASL Air2 select 2 + 1000];

But it has not been working...

Edited by thaFunkster

Share this post


Link to post
Share on other sites

re setCinemaBorder, have a look at this thread (found by searching for... "showCinemaBorder"). The end result seems to be: 1) it works fine in Intros, but not in the mission itself 2) unless you insert a sleep between creating the camera and turning off the border. So, give that a try.

For your planes, are they editor-created or script-created? If they're editor created, that should work except they'll fall out of the sky. Set them to "flying" in the editor dialog and they'll have initial speed. You'll also want to use "flyInHeight" to tell the AI what altitude to fly at, otherwise they'll immediately descend to their usual altitude.

Share this post


Link to post
Share on other sites
Ah, ok, having done some programming at uni, you would think I would know that wouldnt you?...

Many thanks.

---------- Post added at 10:17 AM ---------- Previous post was at 08:57 AM ----------

showCinemaBorder false is not doing anything.

Never failed work for me in camscripts. First line of code I'm using.

regards

nettrucker

Share this post


Link to post
Share on other sites

Thanks guys once again.

Setting it to 'intro' worked, I missed that before.

Some new questions:

I have some harriers with a bomb loadout enroute to target.

1) How do I script them to engage with bombs when I want, so I can have cams of the engagement? This is a bit more difficult than a regular shot, because they have to be in the right location to drop...

2) They have LGB, maybe I can even have some soldiers on the ground with designators to lase the targets? How would I equip someone with this?

3) There are snipers watching targets, how can I show a view from their scope, and the laser designator if I use it?

Many thanks once again....

Share this post


Link to post
Share on other sites

The easiest way to lase something is to create a static laser target at the point you want the AI to hit. The AI place a high priority on laser targets, but you can also order it to doFire on the laser target to ensure that's what it goes after. It'll then fly to the appropriate place and release the bomb.

_laser = "LaserTargetWStatic" createVehicle (position testtgt);
_laser setPos [getPos _laser select 0, getPos _laser select 1, 3];

I've found that setting the target up a bit helps the AI see it; I suspect they get created at ground level or slightly below, which interrupts the AI's line of sight. Alternatively it may be interrupted by the vehicle itself, if it's created inside the vehicle's geometry.

Getting the AI to lase targets seems pretty hit and miss. You can place a soldier with a laser designator (e.g. spotter or FAC) or give them one with addWeapon, and get them to select it with selectWeapon, but getting them to actually use it and "fire" it at the enemy and keep it active for the entire duration of the attack seems difficult.

View from scopes I'm not sure of, I think you need to place a camera somewhere appropriate and then apply a graphical overall to it so it looks like a scope view. You could also perhaps switch to the AI's "optics" view but that might only be for vehicles. For cinematic purposes, I would think faking it with an overlay would be the best strategy.

But... I don't actually know how to do that. :D I think cutRsc is the most promising especially given the examples, but I've never used it before.

Share this post


Link to post
Share on other sites

Very helpful once again, I think I will skip the spottter / laser designator idea and just leave it as it is, they already target the BMPs as things are.

Probably the best way to do what I want is to set up a trigger so that once the harrier gets within a certian radius of the BMPs, I set doTarget and doFire as well as it activating a certain camera...That should work.

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  

×