Home   Help Search Login Register  

Author Topic: How do i creat a unit  (Read 841 times)

0 Members and 1 Guest are viewing this topic.

WW2ECAssassin

  • Guest
How do i creat a unit
« on: 12 Sep 2003, 23:12:04 »
He he well here i am swallowing my pride and asking for help.
Can anyone tell me how to create like 4 to 5 units at once when i walk into a trigger.
what i need is when the player walks into a trigger the trigger will exec a script that produces 4 to 5 enemy i would hope where i place a gamelogic flag im not sure exactly how it works but if someone could help that would be great thanks.

m21man

  • Guest
Re:How do i creat a unit
« Reply #1 on: 13 Sep 2003, 05:01:07 »
;Script segment

_ambpos = getmarkerpos "ambush_mkr"
_ax = _ambpos select 0
_ay = _ambpos select 1
_az = _ambpos select 2

"soldierx" createunit [ [_ax + (random 10),_ay + (random 10),_az],groupbravo,"",0.5,"sergeant"]

"soldierx" createunit [ [_ax + (random 10),_ay - (random 10),_az],groupbravo,"",0.5,"corporal"]

"soldierx" createunit [ [_ax - (random 10),_ay + (random 10),_az],groupbravo,"",0.5,"private"]

"soldierx" createunit [ [_ax - (random 10),_ay - (random 10),_az],groupbravo,"",0.5,"private"]

;
Hope this works ;D.
« Last Edit: 13 Sep 2003, 05:08:35 by m21man »

m21man

  • Guest
Re:How do i creat a unit
« Reply #2 on: 13 Sep 2003, 05:02:43 »
By the way, "soldierx" is the type of unit you want created. 8)
« Last Edit: 13 Sep 2003, 05:03:06 by m21man »

WW2ECAssassin

  • Guest
Re:How do i creat a unit
« Reply #3 on: 13 Sep 2003, 15:31:24 »
so do i place a marker named ambush or game logic flag this is where i get confused? by the way thanks for the reply

_ambpos = getmarkerpos "ambush_mkr"  this line is the line i need explained what exactly do i put in the editor ?

Actually what i need to know is what do i name the marker or gamelogic and how exactly do i call the script
« Last Edit: 13 Sep 2003, 20:06:45 by WW2ECAssassin »

m21man

  • Guest
Re:How do i creat a unit
« Reply #4 on: 13 Sep 2003, 20:28:43 »
"ambush_marker" is a marker. It should be invisible, and you could use a mini-script to make it "stick" to the player. Then you could have a large trigger activated by your character that runs the unit creation script.

WW2ECAssassin

  • Guest
Re:How do i creat a unit
« Reply #5 on: 13 Sep 2003, 20:48:43 »
Well i dont want it to be that technical and how do i call the script also what is ambpos is that a gamelogic flag im lost lol

m21man

  • Guest
Re:How do i creat a unit
« Reply #6 on: 13 Sep 2003, 22:22:54 »
In the trigger which you'd have something like this in the On Activation field: [] exec "ambush.sqs"

This assumes that the primary ambush script is named "ambush.sqs".

_ambpos is just an inscript variable, it doesn't take anything from the game. All you need is a marker named "ambush_mkr". Or you could change the script so that it uses the player as the target for the random spawning.
« Last Edit: 13 Sep 2003, 22:23:09 by m21man »

m21man

  • Guest
Re:How do i creat a unit
« Reply #7 on: 14 Sep 2003, 01:15:50 »
Another thing you could do is use a script to warp in the units. And where do want the units to pop up? In buildings or just in a random circle 'round the player.

WW2ECAssassin

  • Guest
Re:How do i creat a unit
« Reply #8 on: 14 Sep 2003, 18:30:46 »
yeah thats what i use now . by the way the script you put up doesnt work i dont get an error but the units dont appear not sure why i put the marker in called ambush_mkr and i used the trigger []exec "create.sqs" but still nothing

m21man

  • Guest
Re:How do i creat a unit
« Reply #9 on: 14 Sep 2003, 18:50:14 »
Rename "soldierx" to whatever type of unit you want created. Some examples:

"soldierEMG" = Eastern machinegunner.
"officerE" = Eastern officer.

m21man

  • Guest
Re:How do i creat a unit
« Reply #10 on: 14 Sep 2003, 18:52:07 »
If you're doing this with custom units ???, find their editor names and use them. "SoldierX' is just filler, it isn't a unit.

If worse comes to worse, you could always have a script that teleports in the units from a safe place on the map.

WW2ECAssassin

  • Guest
Re:How do i creat a unit
« Reply #11 on: 15 Sep 2003, 02:50:24 »
yeah i had done that already i have changed the units names to units i wanted still didnt work ?

m21man

  • Guest
Re:How do i creat a unit
« Reply #12 on: 15 Sep 2003, 03:15:36 »
Then you'll just have to make a teleporation script. Just setpos the units from a secure area.

Unnamed

  • Guest
Re:How do i creat a unit
« Reply #13 on: 15 Sep 2003, 08:13:48 »
Assassin,

If you want to add men to your own group it should be:
Code: [Select]
_ambpos = getpos player
_ax = _ambpos select 0
_ay = _ambpos select 1
_az = _ambpos select 2

"soldierWB" createunit [ [_ax + (random 10),_ay + (random 10),_az],group player,"",0.5,"sergeant"]

"soldierWB" createunit [ [_ax + (random 10),_ay - (random 10),_az],group player,"",0.5,"corporal"]

"soldierWB" createunit [ [_ax - (random 10),_ay + (random 10),_az],group player,"",0.5,"private"]

"soldierWB" createunit [ [_ax - (random 10),_ay - (random 10),_az],group player,"",0.5,"private"]

If you added an AI unit in the editor and named him Man1, you could assign the new guys to him with:

Code: [Select]
_ambpos = getpos Man1
_ax = _ambpos select 0
_ay = _ambpos select 1
_az = _ambpos select 2

"soldierWB" createunit [ [_ax + (random 10),_ay + (random 10),_az],group Man1,"",0.5,"sergeant"]

"soldierWB" createunit [ [_ax + (random 10),_ay - (random 10),_az],group Man1,"",0.5,"corporal"]

"soldierWB" createunit [ [_ax - (random 10),_ay + (random 10),_az],group Man1,"",0.5,"private"]

"soldierWB" createunit [ [_ax - (random 10),_ay - (random 10),_az],group Man1,"",0.5,"private"]

If you want to add a completle new group you have to be a bit tricky, off the top of my head it's something like:

Create an ai soldier and add this to his init field:
Code: [Select]
MyGroup1=Group This ; DeleteVehicle This

This creates a copy of his group, so when he gets deleted at the start of the game. He leaves a copy of his group in the variable MyGroup1.

Just assign your guys to this group:

Code: [Select]
_ambpos = getmarkerpos "ambush_mkr"

_ax = _ambpos select 0
_ay = _ambpos select 1
_az = _ambpos select 2

"soldierWB" createunit [ [_ax + (random 10),_ay + (random 10),_az],MyGroup1,"",0.5,"sergeant"]

"soldierWB" createunit [ [_ax + (random 10),_ay - (random 10),_az],MyGroup1,"",0.5,"corporal"]

"soldierWB" createunit [ [_ax - (random 10),_ay + (random 10),_az],MyGroup1,"",0.5,"private"]

"soldierWB" createunit [ [_ax - (random 10),_ay - (random 10),_az],MyGroup1,"",0.5,"private"]

You can create upto 64 groups this way, including civilian and Res.