OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lazy Lays on 20 Feb 2005, 20:45:15
-
Hey..
I need some help from you OFP experts
I am working on a mission where a US air field is under a attack for an enemy force,
I want the attack to be endless but with the maximum amount of 63 groups ? .... Nahhh we want more enemies to kill !!
so I made some of the groups respawn
But now I have a field with a lot of corpses and they are slowing down my computer.
so I found this script called eraser.sqs
The scripts readme ---->
eraser.sqs by shark attack
in the init field of unit you want to delete type the following codes
this addeventhandler ["killed", {_this exec "erase.sqs"}]
Now how do I add an init in a script ?
the soldier i want to delete is called eastgroup1m1
so how would the init line look like in a script ?
Sorry for my bad English
Please help...
-
You are using createUnit, yes? Check the example in the online comref in the Ed Depot.
-
yes I'm using createUnit :)
so my guess would be ---------->
"unittype" createunit [getpos position, groupname, "unitname = this", "init", skill, "rank"]
example:
"SoldierW" createunit [getpos Respawnpoint1, westgroup1, "macguba ( :) ) = this", "this addeventhandler ["killed", {_this exec "erase.sqs"}]", 0.5, "Private"]
offcause with out the smilie ;)
Correct me if I'm wrong
-
;D
Nearly. All the init stuff goes inside one string, with different bits separated by a semicolon ; as usual. createUnit has no seperate field for name: it just goes in the init line. So you would have:-
"SoldierW" createunit [getpos Respawnpoint1, westgroup1, "macguba = this; this addeventhandler ["killed", {_this exec "erase.sqs"}]", 0.5, "Private"]
-
Hmmmm error
This addeventhandler ["killed", {_this exec "erase.sqs"}]|#|", o.5, "Private": Error unknown operator
What to do ?
-
Might be the nested quotes in the init string; try:
"SoldierW" createunit [getpos Respawnpoint1, westgroup1, {macguba = this; this addeventhandler ["killed", {_this exec "erase.sqs"}]}, 0.5, "Private"]
Although "something" and {something} are supposed to be interchangeable, it's always better to put code strings in curly brackets because quotes around and in a string often conflict.
I say 'try' because I'm not able to!
-
OMG it is working ! ;D
thanks alot for the help guys ! 8)
Now I can complete my first mission ! :)