Jump to content
Sign in to follow this  
OneStiffRod

Re-goddamn-dickulous

Recommended Posts

I am using createUnit to try and spawn a civilian dude - I don't want him to be part of a group but since he has to be I set him as groupAlpha I've even set him as grpNull...

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Man="Civilian" createUnit [getMarkerPos "BUS_SPAWN_5",groupAlpha];

<span id='postcolor'>

Now when I use createUnit he won't friggin spawn at my spawn point??? I can solve this by using createVehicle but then he just sits there and does Sh** I have it scripted so he is a bus driver but once behind the wheel he ignores all commands...this is why I guess i'm forced to use createUnit.

But this createUnit don't goddamn work... how the hell can i make this fool spawn where the hell i want him to with createUnit??? This crap is giving me a headache...

I have version 1.91

Share this post


Link to post
Share on other sites

Make sure the group exists first. And check out the command reference...

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">type createUnit unitInfo

Operand types:

type: String

unitInfo: Array

Compatibility:

Version 1.34 required.

Type of returned value:

Nothing

Description:

Create unit of given type . Format of unitInfo is: [pos (Position),group (Group), init (String), skill (Number), rank (String)] Note: init, skill, and rank are optional, default values are "", 0.5, "PRIVATE".

Example:

"SoldierWB" createUnit [getMarkerPos "barracks", groupAlpha]

<span id='postcolor'>

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Make sure the group exists first<span id='postcolor'>

THANKS A LOT bn880

At last i understand why i never succeeded in making this createunit command to work

I was sure , by reading the com ref that the group was created by this command (the com ref is really sometime very strange to decode wink.gif ) , i had no idea at all that you had to create this group before the createunit command

I just tried in the editor and it work perfectly

a guy with ALPHA=group this

a gamelogic named GO

a trigger (repeated) that i activate by radio alpha and with

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">n1= "SOLDIERWB" createunit [getpos GO, ALPHA]<span id='postcolor'>

And i have my created unit named n1 that appear and join his ALPHA leader

I shoot them all, and call again the radio alpha and blam , again a n1 soldier continue in the ALPHA group waypoint, even if the previous ALPHA group has no survivor

bn880 you have my vote for the "President of the CreateUnit election" wink.gif

Share this post


Link to post
Share on other sites

Heh ok, but also the reason I posted a snipped from the command reference: there is no return value from createUnit, therefore there is no point doing newMan = xx createUnit xx ... it won't return the newly created unit. smile.gif

Share this post


Link to post
Share on other sites

"SoldierWB" createUnit [getMarkerPos "barracks", groupAlpha, "Man = this"]

(Notice the init...you assign the Man variable to the object...it MUST be global/public, not temporary variable)

Share this post


Link to post
Share on other sites

Thanks Doolittle , you now have my vote too for the "President of the CreateUnit Election" (i have the mysterious ability to vote multiple time wink.gif .

I tried ingame with the correct string for the case up there

</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 GO, ALPHA, "N1=this"]<span id='postcolor'>

And now with a 2nd trigger activated by radio alpha and with

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">N1 setdammage 1<span id='postcolor'> i can kill this specific soldier.

So i am happy that you can do a lot of thing with a created unit  , it will change a lot of things in my future missions (goodbye to the stupid camcreated brainless AI that frustrated me before) .

Thanks to you 2

Share this post


Link to post
Share on other sites

Ok the dude spawns and gets in the bus as driver but still he won't obey any commands... Even the BUS won't comply even tho it has a driver now.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Bus="Bus" createVehicle getMarkerPos "BUS_SPAWN";

_Bus setDir 85;

_Bus setIdentity "BUS2";

_grp=group this;

"Civilian" createUnit [getMarkerPos "BUS_SPAWN_5",_grp,"Man=this"];

Man moveInDriver _Bus;

Man doMove getMarkerPos "BUSSTOP_BUS_DEPOT";

<span id='postcolor'>

What is missing in this code???

Share this post


Link to post
Share on other sites

I am not really sure, but i think what can be missing is the group you called "_grp=group this;" in your script.

From my test , the group must be created before the script start.

So try to create a civilian that have nothing to do with your script , (you can kill him as soon as the mission begin and remove him from the field) and in its init line put grp=group this

With that, "grp" will exist for the game , now you can try to use your script and see if it works.

If it works, adapt your script with your mission

Share this post


Link to post
Share on other sites

Also make sure the group you are adding the driver to actually has WAYPOINTS on the map, or the driver won't have anything to actually do!

Doolittle

Share this post


Link to post
Share on other sites

So how do I create a group?

The group command couldn't be any vaguer or useless as it is described in the com ref... I know there is a groupId command is that the one I'm supposed to use???

This guy needs to be a civilian - he's not part of any group per se as he will operate on his own... is there any way to spawn a vehicle with dudes in them arleady??

Maybe if someone could show me an example code from the many RTS flashpoints like islands or RTS 3.0 or something - I know they spawn - maybe if someone could show me how to spawn a dude using the camCreate...

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  

×