OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 17 Mar 2005, 20:38:36

Title: create unit (name)
Post by: 456820 on 17 Mar 2005, 20:38:36
right i was wondering how i can give a name to a created unit
i know how to create a new unit
i also looked in the com ref under create unit but no look just tells me how to set the skill and rank etc
Title: Re:create unit (name)
Post by: RujiK on 17 Mar 2005, 20:41:22
Code: [Select]
"Civilian" createunit [getpos player,group player,"MyNameIsCalvin = this"]
Title: Re:create unit (name)
Post by: 456820 on 19 Mar 2005, 12:51:01
thanks i need to test it first but also is there a way of creating units but not assighning them to a group
Title: Re:create unit (name)
Post by: Silencer on 19 Mar 2005, 13:06:21
Car = "SkodaGreen" createVehicle getpos CarStore

This will create a "Green Skoda" on a marker named "CarStore" and it will name the Green Skoda "Car"

You can also use the CamCreate command, so it will be:

NAMEYOUWANTTOGIVE = "NAMEOFUNIT" CamCreate getpos NAMEOFMARKER

Title: Re:create unit (name)
Post by: h- on 19 Mar 2005, 14:42:37
thanks i need to test it first but also is there a way of creating units but not assighning them to a group
No there is not..
With createUnit you need to assign the unit to a group ir it will not get created...

Quote
Car = "SkodaGreen" createVehicle getpos CarStore

This will create a "Green Skoda" on a marker named "CarStore" and it will name the Green Skoda "Car"
This will not create anything on the position of a marker named 'CarStore'...
You can't getPos a marker, you need to use getMarkerPos...
(nit picking...)

Furthermore, createVehicle will create an empty vehicle, can not be used on men...
It will create a man but it will be an semi-empty shell, which reacts only when it gets shot and the reaction is to bleed...

camCreate will create an empty vehicle which can not be used in any way...
And if you camCreate a soldier it will be just an empty 'shell'...
Title: Re:create unit (name)
Post by: Silencer on 19 Mar 2005, 15:10:45
Car = "SkodaGreen" createVehicle getpos CarStore
This works perfect for me!

To create an empty car.
I didn't test it for units/ car with crew in it
Title: Re:create unit (name)
Post by: Planck on 19 Mar 2005, 15:39:49
AFAIK you can't create a crewed vehicle,you can only create an empty vehicle and then create the crew separately.

Using creatUnit to create the crew you should be able to set the skill and rank of each unit created.

"SoldierType" createUnit [position, group, "init", skill, "rank"]

Example:

"SoldierEB" createUnit [getMarkerPos "marker1", groupA, "loon1 = this", 0.8, "private"]



Planck
Title: Re:create unit (name)
Post by: Artak on 19 Mar 2005, 15:50:37
Silencer, are you sure you have a marker named CarStore and not a GameLogic object? This would explain why you and nobody else can use getpos instead of getmarkerpos on markers.  ;)


Quote
thanks i need to test it first but also is there a way of creating units but not assighning them to a group
As HateR_Kint already pointed out, no, there is no way.

However, you can assing empty groups by inserting a unit on map and having grp1 = group this; deletevehicle this in it's init field. Doing so will maintain a valid groupname (placeholder, array, whatever), without having anyone in it.

A nifty way is to have the group leader ready on map at some remote place and when creating units to that group, just setpos the leader to the spot where you want the group to be.

Title: Re:create unit (name)
Post by: Silencer on 19 Mar 2005, 18:56:08
Ah lol,

I used a FlagPole :) My fault! :P
Title: Re:create unit (name)
Post by: 456820 on 20 Mar 2005, 13:04:15
since you cant create a soldier without including a group can you create that soldier in to its own group like the line you create it for make a lin for the soldier's init line and have grp4 = group this
Title: Re:create unit (name)
Post by: Artak on 20 Mar 2005, 14:20:59
I think, if you do that then the whole group (the group he born into) will be referred as grp4. Maybe. Dunno.  ???

What you can do though is to have name the unit in the createunit command's init part and also put in '[this] join grpnull', then have grp4 = group unitname/this.