Jump to content
Sign in to follow this  
Asung

Unit Delete Script [Help]

Recommended Posts

Hello All,

Thanks for all the help I recieved with my post question. I was wondering if anyone could review a script a friend has written for me, I can't seem to get it to work. (my scripting knowledge is kind of limited)

For brevity, I have listed the questions I have down at the bottom, any kind of input or help would be greatly appreciated.

The purpose of this script is to delete Zombies in my my mission every few minutes. I require this script because I have many triggers across the map that spawn zombies if players walk into them. Unfortunately, more zombies than our machine's can handle get spawned because multiple players walk into the trigger. The amount of zombies is bareable for only 15 minutes or so before the FPS drops down to 4.

To counteract this, I need a script that deletes Resistance-faction units every 10 minutes (zombies in the mod I am using are of the resistance faction.)

A friend wrote this script up for me, I made a few changes and I think i broke it

if (!isServer) exitWith {}; //servercheck

waitUntil {time > (2*60)}; //start wait time

while {true} do {// loop it

{

if ((!isPlayer _x) and ((side _unit) == resistance)) then {_x setdamage 1; deleteGroup (group _x)}; //kill all zombies. cly dead remove will delete groups

} forEach ALLunits;

//zombies = []; // set zombie array to zero, for good measure

sleep (2 * 60); // wait 10 minutes

1. I changed the numbers in line 2 and line 7. They used to be 10 * 60 on both, but I shortened them for testing purposes so I wouldnt have to watch zombies for 10 minutes to see if they would die. Are there supposed to be spaces between the numbers and the * ?

IE: (2*10); or (2 * 60) does it matter ?

2. How do I call this script in my init.sqf? I tried putting the following but it didn't work :

[] exec "Zombiedelete.sqf";

3. Since the third line of the script is

while {true} do {// loop it
, do I need a True = True; in my init.sqf?

Share this post


Link to post
Share on other sites

2. How do I call this script in my init.sqf? I tried putting the following but it didn't work :

[] exec "Zombiedelete.sqf";

Try to call it with:

[] execVM "zombiedelete.sqf"

Reminder:

sqs scripts are called with: [] exec "script.sqs"

sqf scripts are called with: [] execVM "scripts.sqf"

Share this post


Link to post
Share on other sites

I made the adjustment in the init.sqf, still isnt working for me. Are there any obvious errors that ive made in the changes to the script?

Share this post


Link to post
Share on other sites
Try to call it with:

[] execVM "zombiedelete.sqf"

Reminder:

sqs scripts are called with: [] exec "script.sqs"

sqf scripts are called with: [] execVM "scripts.sqf"

try

 [b]_nul = [/b][] execVM "zombiedelete.sqf" 

Edited by ArmAriffic

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  

×