OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: RujiK on 26 Feb 2005, 02:33:15
-
This is my script:
_pos = [(getpos resppos select 0),(getpos resppos select 1),0]
_grp = grpnull
_man = "Civilian" createunit [_pos,_grp]
However, for some reason or another this unit will not be constructed.
When I change the text of _grp = grpnull to _grp = player the unit will be constructed, but for some reason when it is grpnull he will not come into being.
Any help would be greatly appreciated.
-
2 things:
1)give him a group then make him switch through his init
2) AFAIK you can't do _man = "blah" blah blah with createunit
try this:
"civilian" createunit [_pos,(group player),"_man = this;[this] join grpnull "]
-
Im not sure, but i dont think you can create into grpnull. But i may be wrong.
-
hehe, i messed up the post, didn't read. you musta posted while i was editing
-
grpnull is a non existing group, so I guess it's not a group...
-
@ Triggerhappy.
Yes! :D
-
"civilian" createunit [_pos,(group player),"_man = this;[this] join grpnull "]
Your scripting is fine, however I think I have found a bug in the game...
With this exzact same scripting, I can do "civilian" createunit [_pos,(group player),"man = this;man setdammage 1"] and it works, however with grpnull, the unit refuses to leave his group. This seems to be a bug.
-
Ok, I found a Loop around the problem, and yes it is indeed a bug (Possible only with my version?)
Instead I used the good old _x command for removing the dope from his group ;D
-
When you create a unit into grpNull, OpF makes a new group, so that person is the leader of the new group.
It's true that grpNull is not a group, but since every living unit in OpF must belong to a group, Opf takes care of that for you. Isn't that nice ? ;D
The last command you posted can also be scripted like this:
"civilian" createunit [_pos,(group player),""]
man = (units group player) select ((count units group player)-1);
[man] join grpNull;
_newgroup = group man;
man setdammage 1;
Now you have the new group saved into _newgroup, so it can be of further use.