Jump to content
Sign in to follow this  
InqWiper

Best way of placing fences red hammer way?

Recommended Posts

This might be old but I just thought of it and I have never seen anyone posted about it before.

You know that mission in Red Hammer where you are supposed to build a defence in the town and prepare for the incoming enemy tanks?

It said something like this in the .sqs-file:

There has to be a better way to do this

Well, yes there is and here it is:

_cam="Camera" camcreate [0,0,0]

_cam camsettarget Player

_cam camsetrelpos [0,3,0]

_cam camcommit 0

@camcommitted _cam

Wire="Wire" camcreate [getpos _cam select 0,getpos _cam select 1,0.7] setdir getdir Player

camdestroy _cam

Exit

Even if this is old I think some people didnt know...

I tried placing fences with the action menue like half a year ago or longer and I couldnt think of any easy way to make the fences always 3 meters infront of you and not just 3 meters to the north or something. The only thing I could come up with was the BIS way and it seemed like it would take a while to do that and I didnt wanna take theire script.

I just made my first camera script like a mounth ago and now when I felt like placing fences with the action menu again I thought that there had to be some way of using the camsetrelpos. So I tried with camsetrelpos on the fence and it didnt work of course. Then I thought that the camsetrelpos is most likely to only work on cameras but maybe I could place an object and use getpos on the camera and it worked.

Share this post


Link to post
Share on other sites

Ok, camcreate isnt very good since AI units dont understand that the object is there...

Share this post


Link to post
Share on other sites

Ok, now I placed 5 wires on the map called:

Wire1

Wire2

Wire3

Wire4

Wire5

and I used this script instead:

_cam="Camera" camcreate [0,0,0]

_cam camsettarget Player

_cam camsetrelpos [0,3,0]

_cam camcommit 0

@camcommitted _cam

?(Amount==5):Wire1 setpos [getpos _cam select 0,getpos _cam select 1];Wire1 setdir getdir Player

?(Amount==4):Wire2 setpos [getpos _cam select 0,getpos _cam select 1];Wire2 setdir getdir Player

?(Amount==3):Wire3 setpos [getpos _cam select 0,getpos _cam select 1];Wire3 setdir getdir Player

?(Amount==2):Wire4 setpos [getpos _cam select 0,getpos _cam select 1];Wire4 setdir getdir Player

?(Amount==1):Wire5 setpos [getpos _cam select 0,getpos _cam select 1];Wire5 setdir getdir Player

camdestroy _cam

Amount=Amount-1

Player removeaction action

Action=action+1

Player addaction [format["Build Fence (%1)",amount],"Fence.sqs"]

?(Amount==0):Player removeaction action;exit

Exit

Still easy and the tanks now try to avoid the wires.

Forgot:

Init field of the player unit:

Action=0;amount=5;this addaction ["Build fence (5)","Fence.sqs"]

Share this post


Link to post
Share on other sites

Hmmm...the vehicles still try to drive through the wires even when I just move them with setpos....first time it went around but all the other times it tries to drive through them.

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  

×