Home   Help Search Login Register  

Author Topic: createunit  (Read 1734 times)

0 Members and 1 Guest are viewing this topic.

Ryu

  • Guest
createunit
« on: 28 Dec 2003, 11:43:01 »
Can anyone tell me what's wrong with this?

"KEGSSoldierEB" createunit [getpos pos1, officer1, "sol1 = this; this setbehaviour safe", 0.8, "PRIVATE"]

It creates the unit but not in safe mode. Officer1 is already in safe mode.

cheers

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:createunit
« Reply #1 on: 28 Dec 2003, 23:02:36 »
The syntax for setbehaviour is unitname setbehaviour "safe".

To get it working you'd put the 'safe' in {}'s

"KEGSSoldierEB" createunit [getpos pos1, officer1, "sol1 = this; this setbehaviour {safe}", 0.8, "PRIVATE"]

like so.
Not all is lost.

Ryu

  • Guest
Re:createunit
« Reply #2 on: 29 Dec 2003, 09:31:56 »
No, that doesn't work. No error message but not safe mode

deaddog

  • Guest
Re:createunit
« Reply #3 on: 29 Dec 2003, 15:03:42 »
If Officer1 is a UNIT, then you're using createunit wrong.  Try this:

"KEGSSoldierEB" createunit [getpos pos1, group officer1, "sol1 = this; this setbehaviour {safe}", 0.8, "PRIVATE"]

You have to create units into an existing group (which can be empty of units).

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:createunit
« Reply #4 on: 29 Dec 2003, 18:30:43 »
If the group was not defined right the unit would not have been created at all I think.

What a puzzle.

Ok, consider this. Maybe the unit is not created to safe mode because the group leader of the group the unit is created in is not in safe mode.(?)
Not all is lost.

Ryu

  • Guest
Re:createunit
« Reply #5 on: 30 Dec 2003, 05:39:48 »
 :( NO, still no luck. The officer is on patrol and set to safe.

deaddog

  • Guest
Re:createunit
« Reply #6 on: 30 Dec 2003, 06:24:15 »
The answer is to set the behaviour separate from the createunit command:

"SoldierEB" createunit [getpos officer1, group officer1, "sol1 = this", 0.8, "PRIVATE"]; group officer1 setbehaviour {safe}

You can put the setbehaviour command after all units have been created.  This also means you won't have to name each unit as you create it.

Ryu

  • Guest
Re:createunit
« Reply #7 on: 30 Dec 2003, 10:41:03 »
 :)Great, that did it.
BTW I like to name the units I create to deleate them when they are no longer needed.

Thanks guys