Jump to content
Sign in to follow this  
Muscular Beaver

Createunit/vehicle and add waypoints and behaviour

Recommended Posts

Cause of lag problems I wanted to let some objects, vehicles and units only appear when a trigger is activated. I think I learned how to do this, but I also want them to complete a few waypoints. how can I do that?

Share this post


Link to post
Share on other sites

It could be done(in SP for sure, can't be done in MP) in the init field

e.g.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SoldierWB" CreateUnit [(GetPos GameLogic1), UnitGroup1,"This SetDir 90", 1.0, "PRIVATE"]<span id='postcolor'>

Where: "This SetDir 90"

is the init-field of the unit created

Cold War Crisis 1.46:

My recent observations about spawning(creating) units in MP is that, it does not care about if you use CreateUnits, with all it's parameters it creates the unit using CreateVehicle which place an empty soldier in the game, which you can't do nothing about, can not make any references what so ever.

Only "true" vehicles such as Cars, armored, planes and others can be referenced.

e.g.

_dude="SoldierWCrew" createVehicle (GetPos GameLogic1)

_dude returns : no group

_tank="M60" createVehicle (GetPos GameLogic1)

_tank returns: hex-value  NOID m60

Share this post


Link to post
Share on other sites

This is probably old news (and too late to help Beaver and Taurus), but I've figured out a semi-simple way to create units with waypoints:

Do the usual to create a unit  - there's a great tutorial at OFPEC, but:

drop a single unit somewhere out of the way (call him, say JOE), like one of the micro islands on Tonal that are the size of a house; give him a group name, place a GameLogic where you want the created units to appear, use a trigger to create the units by putting this in Activation:"soldeirEB" createunit [getpos GAMELOGIC, TRIG NAME, "newunitname=this"]; repeat for as many soldiers as needed;deletevehicle JOE.

When trigger, trigger will createunit(s), assign them to JOE, then delete JOE.

Here's the waypoint trick: just give JOE waypoints. Like MOVE and GUARD. He can never reach his waypoints because he's stuck on a micro island (or for maps without, you could break his legs by setdammaging him to .9 - poor Joe!). New units created and assigned to him, he's deleted, and they continue on to the waypoints.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×