Home   Help Search Login Register  

Author Topic: Spawn in Building && Change clothes  (Read 1948 times)

0 Members and 1 Guest are viewing this topic.

Offline Eymerich

  • Members
  • *
Spawn in Building && Change clothes
« on: 21 May 2007, 12:51:04 »
1) Without any reference (no game logic, or object near the building ) is possible to  spawn an a unit inside a building?

2) How can I change the clothes of my character (in game)?

Regards

Nicolas

 :)





Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawn in Building && Change clothes
« Reply #1 on: 21 May 2007, 13:07:26 »
add another playable unit in the map (marked as playable) somewhere far from the action, for example a civilian named "player2" alone in an small island. Lets say your main player unit is named "player1"

In your init.sqs or in the init field of the initial player add:
Code: [Select]
enableTeamSwitch false
Then, when you want to switch to the other unit, for example in the activation field of a trigger, add:
Code: [Select]
pos1=getPos player1;pos2=getPos player2;player2 setPos pos1;selectPlayer player2;player1 setPos pos2
EDIT: But you may use an script for better results:
Code: [Select]
;switchUnits.sqs
_unit1 = _this select 0
_unit2 = _this select 1

_pos1=getPos _unit1
_pos2=getPos _unit2

cutText["", "BLACK IN"];
~1
_unit2 setPos _pos1
selectPlayer _unit2;
_unit1 setPos _pos2
cutText["", "BLACK OUT"];
exit
« Last Edit: 21 May 2007, 13:11:51 by Mandoble »

Offline 456820

  • Contributing Member
  • **
Re: Spawn in Building && Change clothes
« Reply #2 on: 21 May 2007, 13:10:07 »
1. Don't really understand what your asking. You want a unit to be spawned into a building but this building has no name or anything to identify it with? Don't think so in that case. You might want to use an invisible H pad and place this into ints init field.

"SOLDIER" createUnit [((position this) nearestObject XXXX)]

change SOLDIER into the class name of the soldier you wish to be created and change XXXX to the ID of the building you wish the soldier to be spawned in. Zoom in and select Show ID to view the IDs of objects.

That should do it. There may be an easier way but im a tad rusty at the moment.  :D


2. AFAIK you can't. Same with OFP, so your stuck with what you are wearing im afraid.


Hope that helps.

Edit - Beaten
Didnt know you could change the player - well like i said im a bit rusty.  :D

Offline Eymerich

  • Members
  • *
Re: Spawn in Building && Change clothes
« Reply #3 on: 21 May 2007, 14:51:27 »
thank you for your answer...


@456820 --> I'm working on a dynamic mission...
And i need to avoid global variable as I can.
In opf the problem had a simple solution : object function.
In arma such function doesn't work.

ABout your second answer --> I've played a mission (official) where you've to bring to another person some clothes. So, it should be possible.  :)

@Mandoble --> Spawn is for enemy team...
In the mission I'm working the player is able to control a lot of teams (20 from infantry, lighv heavy Vehicle and so on) to conquer the ciy locate in the southern part of saharani. The (enemy) soldier's city are spawned inside a city.

Thank again

Nicolas

:)

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawn in Building && Change clothes
« Reply #4 on: 21 May 2007, 14:57:40 »
If the enemy is AI, where is the problem?
Just change the positions of two units, A -> B and B <- A. Isn't that what you are looking for?

Offline Eymerich

  • Members
  • *
Re: Spawn in Building && Change clothes
« Reply #5 on: 21 May 2007, 17:19:47 »
Thanks but... that's not possible. I explain better: if you have to put (at least) 3 spawn position you need as well 3 man or object labelled. Three global variable.
Due to the fact that I've populated at least 8 city, you've 24 Global variable. As I've said, due to the fact that mission is still uncompleted I want to avoid the use of global variable unless i really need them!
It's better create a global array (as I've alerady did) and put some obeject the position is stored in the array itself.
Thanks again

 ;)

#EDIT-removed the unnecessary quote  h-
« Last Edit: 21 May 2007, 19:49:28 by h- »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Spawn in Building && Change clothes
« Reply #6 on: 21 May 2007, 19:00:04 »
2) How can I change the clothes of my character (in game)?

Was wrongly assuming you were talking about your character, but seems the question has no relation with that ...

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Spawn in Building && Change clothes
« Reply #7 on: 22 May 2007, 01:38:09 »
To switch clothes I imagine you just switch to playing a new unit that is wearing the clothes you want, and use a script to handle transfer of weapons, ammo and damage. See this page of Biki for more details on switchable unit commands.
urp!

Offline Eymerich

  • Members
  • *
Re: Spawn in Building && Change clothes
« Reply #8 on: 22 May 2007, 10:36:26 »
I see..
that was my fault!

Thank you very much!