Jump to content
Sign in to follow this  
jaenak

reveal script

Recommended Posts

I have several resistance soldiers on a hill on the edge of a city and a russian convoy coming in that direction. I blow up the convoy, the soldiers disembark the toasted Urals and run at the resistance while shooting. The two sides are just a little too far away from each other to know that they're there so I used a script to "reveal" the east to the resistance forming the ambush.

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

_friends = _this select 0

_enemies = _this select 1

_i = count _enemies

#loop

"_x reveal (_enemies select _i)" foreach _friends

_i = _i - 1

?(_i == 0) : exit

~0.1

goto "loop"

I have one trigger over each collection of troops stating something like;

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

ResArray = thislist

or

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

EastArray = thislist

Then I have another trigger stating;

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

[ResArray,EastArray] exec "Reveal.sqs"

By all I can figure it should work but when I use it I get;

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

'_x reveal (_enemies select _i)|#|': Error Zero divisor

What's wrong?

Share this post


Link to post
Share on other sites
Guest [B.B.S.] T_D

_friends = _this select 0

_enemies = _this select 1

_i = count _enemies<span style='color:red'>-1</span>

#loop

"_x reveal (_enemies select _i)" foreach _friends

_i = _i - 1

?(_i == 0) : exit

~0.1

goto "loop"

Share this post


Link to post
Share on other sites

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

_friends = _this select 0

_enemies = _this select 1

_i = (count _friends) - 1

#loop

"(_friends select _i) reveal _x" foreach _enemies

_i = _i - 1

?(_i == -1) : exit

goto "loop"

Also are you sure you are correctly passing the lists to the script? Check with a few hint comands.

RED

Share this post


Link to post
Share on other sites

Okay, the error message stopped but I still can't see the enemy. I wouldn't suppose there'd be something as simple as

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

resistance reveal east

would there? That's basically all I'm trying to do.

BTW, according to hints, all the triggers are working and the script is starting and running. I just can't get anything revealed to anyone else. sad_o.gif

Share this post


Link to post
Share on other sites

I learned from some tests done by bn880 that reveal can be VERY short lived... like under 1 sec. The best way is to call reveal several times in a short loop... perhaps every 1 sec.

Test that out in cadet mode in an infinite loop, and see if the little red soldier icons appear on your map. If they do.. it is working, but the AI is 'forgetting' about the revealed units very quickly.

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  

×