Jump to content
Sign in to follow this  
desantnik

Quickie Script help!

Recommended Posts

Hello, I think this is a fairly easy script to make but I cant understand the basics so...

I want the ai groups to attack a player, then if he moves to follow him... essentially I created a invisible helo object that I getpos under the player and made the ai domove to that object... problem being that I need that thing to loop continually and work in mp...

thanks in advance. smile_o.gif

Share this post


Link to post
Share on other sites

To have it work in MP you have to make sure you run the code on the server/host only. Place an GameLogic on the map and name it to "Server" then in the code check with this.

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

; If not host/server, exit script

? !(local Server) : exit

as for you loopthing. A simple loop that prints "Hello" on the screen every 10 sec looks like this...

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

#loop

hint "Hello"

~10

goto "loop"

Hope this helps?

/Christer (a.k.a KeyCat)

Share this post


Link to post
Share on other sites

this script i just wrote is working offline (as i just tested it), but as usual no idea if it would work in MP

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

; to have a group to follow a unit, use the following synthax

; [nameofunit,nameofgroup] exec "hunthim.sqs"

; of course, if you name this script hunthim.sqs

; the hunt script will end as soon as the hunted is dead

_hunted = _this select 0

_hunter = _this select 1

#looping

~2

"_x move getpos _hunted" foreach units _hunter

? getdammage _hunted >= 1 : goto "endhunt"

goto "looping"

#endhunt

~1

exit

If you don't really want the hunter group to stay in formation, you can use "domove" (without the quotes of course) instead of "move" in the script (but they will be less efficient if not in formation)

To lower the loop charge on the cpu, you can put an higher value than "2" for the loop (it is the time between each hunted position "check")

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  

×