Jump to content
Sign in to follow this  
Viriato

Why a createvehichle pilot causes crash

Recommended Posts

I have created a script that with createvehicle, creates an A-10 at a fixed distance from the target to simulate an airstrike.

At the begining, i try to create on the same script a pilot (soldierWpilot) wich will be assigned to the plane (Pilot moveindriver plane), so i will not need a precreated pilot within the mission.

But... when this crashed the game to desktop.

If i use a pilot already present on the mission there is no problem.

Did anybody knows why this is happening?

Share this post


Link to post
Share on other sites

If you will send your crash files to our support mail (check Troubleshooting FAQ for more info), we may be able to tell you why is it crashing.

Share this post


Link to post
Share on other sites

Thanks Suma, but already find the problem:

If a unit created via CreateVehicle instead of a unit created via CreateUnit, is ordered to be the crew via Unit MoveIndriver the game crashed.

Share this post


Link to post
Share on other sites
Guest jacobaby

Does anybody have any further insight on this?

I only ask because this is the bug we have in the BAS MH47E Cargo version.

However it only manifests itself when the chopper is shot down, and when a unit inside is there via createvehicle.

It is the same if the unit is a Logic unit. This is a repeatable and demonstrable "bug". Anybody?

TJ

Share this post


Link to post
Share on other sites

I think creating soldiers or logic units using createVehicle is really wrong, as units created this way are "empty", do not have any "brain" and will not be inserted into AI hierarchy correctly. While I admit doing this should not crash the game, at the same time I am not surprised at it is. Even if it did not crash, the unit created this way cannot work properly.

Share this post


Link to post
Share on other sites
Guest

Hmmm.. It's pretty much the standard method of dynamically creating gamelogics and triggers. Countless scripts use it.

Is there an alternative?

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">Hmmm.. It's pretty much the standard method of dynamically creating gamelogics and triggers. Countless scripts use it.

Is there an alternative?<span id='postcolor'>

I would say createVehicle is OK for trigger (trigger does not have a brain), but not for gamelogics. createVehicle always creates an "empty" vehicle, and does not insert it into any AI structures. createUnit should be definitelly used to create gamelogic units.

Share this post


Link to post
Share on other sites
Guest jacobaby

I suspected as much after seeing it happen.

The problem with using createunit for me is that I need to have the unit created at the very beginning of the game, and as far as I can tell, createunit always requires a valid group.

Is there a way to name and identify a group, without it actually having units in the array of units? Via a script is the preferable means.

Thanks Suma for the replies. I am sure you already have it in hand, but perhaps for OFP2 we could have a dedicated vehicle proxy spot available for the things capable of transporting other vehicles?

Thanks again,

TJ

Share this post


Link to post
Share on other sites
Guest

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (jacobaby @ 28 April 2003,11:19)</td></tr><tr><td id="QUOTE">Is there a way to name and identify a group, without it actually having units in the array of units? Via a script is the preferable means.<span id='postcolor'>

If you intend to use the script in an addon, use the addon object itself.

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

<span id='postcolor'>

I don't know how it would play out for empty vehicles though..

The "standard" mission approach is that you put a unit, get the group and then delete the unit. The group still exists but is empty.

Share this post


Link to post
Share on other sites
Guest jacobaby

Thanks Denoir.

How the helicopter/jeep combo works is that the first cargo proxy in the model is filled at the start of the game, by a logic unit.

This logic unit Is being createvehicled, causing the problems.

(interestingly the method of destroying the vehicle makes a difference too).

I know about the delete the guy method, but would prefer to have it all done with minimum user intervention (we like to make it easy on the guys!wink.gif

A thought I had, which I may try today is this.

Have a script get the group of the player, since he will always have one, and get an array o units in his group.

Next, set players group to GRPNULL. This will have the effect of moving the player UP a group, so that ALPHA BLACK becomes BRAVO BLACK etc, in theory leaving the original group empty and available, after re-joining him with his original group members.

Any thoughts/ideas on this?

Thanks

TJ

Share this post


Link to post
Share on other sites
Guest jacobaby

After checking a few things I think I am going to add the requirement for a named Game Logic to be put on the map.

This will give me an extra group which I can then use for createunit.

An interesting thing I found is this. If you assign a player into the group of a LOGIC unit, he cant get in vehicles etc..

TJ

Share this post


Link to post
Share on other sites

Quick recap: Gamelogic units or soliders should not be created by createVehicle, but by createUnit instead. Function createVehicle should be used only to create an empty vehicles / objects, not units that are able to be given waypoints or orders - and doing this leads to undefined behaviour. It is very likely we will change createVehicle so that it does nothing when asked to create a unit in the future version of the game engine.

Share this post


Link to post
Share on other sites
Guest jacobaby

Thanks Suma, I guess more than a few scripts will need rewriting.

It would be handy to be able to createunits without a group too, or if the group could be grpnull.

TJ

Share this post


Link to post
Share on other sites

It would be quite helpful if we could createUnit into a new Group by passing in grpNull. smile.gif Saves a step for scripters.

Share this post


Link to post
Share on other sites

We intentionaly force mission designer to pass a group when creating unit, as groups are "scarce resource" in OFP and you could easily exhaust it when creating new groups automatically. We would also need to handle failure (no more groups possible). The way command is used now guarantees no unpredictable failure is possible.

I agree the group number limitation is something to be improved in OFP2. smile.gif

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 (Suma @ ,)</td></tr><tr><td id="QUOTE">We intentionaly force mission designer to pass a group when creating unit, as groups are "scarce resource" in OFP and you could easily exhaust it when creating new groups automatically. We would also need to handle failure (no more groups possible). The way command is used now guarantees no unpredictable failure is possible.

I agree the group number limitation is something to be improved in OFP2. smile.gif<span id='postcolor'>

Yep, you said it all.

Thanks. smile.gif

Share this post


Link to post
Share on other sites

There is another serious problem when using createUnit to create a gamelogic. If you create the GL with a group that isn't local to the server the whole game hangs (no ALT_TAB or anything else, only power off worked).

It works fine when the group passed to createUnit is local to the server.

The problem is that the only way to make sure you have a group that is local to the server the mission designer has to place a gamelogic.

If you are using createVehicle in the scripts of an addon then you really want to avoid to force the mission designer to place additional things to make your addon work.

Every extra effort an addon requires to be used makes it more unlikely that ppl will use it.

Share this post


Link to post
Share on other sites
Guest jacobaby

Rom,

What group did you use for the logic? I cant see how you can have a group only local to a client, because how do you make that group in the first place? Surely it was by units placed in the editor, which makes the group a publicvariable.

Maybe I am missing something there?

When you place a LOGIC unit on the map, it has the group in the first instance;

LOGIC Alpha Black

If you then pass grpnull to the Logic the group advances to;

LOGIC Bravo Black and so on.

These type of groups seem intrinsically diiferent to the human players groups, as if you JOIN a player to a LOGIC group, he can no longer mount vehicles etc. I would assume though that the limit of Logic units per group is still 12.

So for the purposes of having a group available to the units we want to create, it is going to be imperative to do one of two things.

1) Place a Logic Unit on the map.

2) Have a INIT line for the player unit to set him to grpnull, thereby leaving an empty group

NOTE; I have just reproduced the error you have. It is caused by trying to JOIN a LOGIC unit to a PLAYERs group.

Whereas this works in reverse, It would seem a LOGIC cant JOIN a non-logic group.

Given that I see the only way to make a group available for created Logics is to place one on the map at mission design stage.

If this group is full you can always force the units in it to JOIN GRPNULL to empty it, and they will be assigned new groups.

Question for Suma, is it practicle to have LOGIC units, properly created, to be used in MOVEINCARGO situations?

Or will this cause further conflicts?

Note to others; No matter what tag or name you assign to your groups, eg "ATeam", the basic group structure remains the same, i.e. The real group name will still be WEST Alpha Black etc.

TJ

Share this post


Link to post
Share on other sites

This is my setup I used for createUnit a gamelogic:

I have a vehicle that runs a script with its init eventhandler (the script is allways run on the server no matter if the vehicle is local to a player or not).

The script createUnit a normal SoldierWB into the group of the vehicle, then joins this soldier to grpNull and createUnit a gamelogic into the new group of the SoldierWB.

If the vehicle is local to a player the game hangs completely, if the vehicle is not local to the player it's fine.

So the only way to createUnit a gamelogic is to place a gamelogic on the map at design time and then use its group wich is bad for use in a standalone addon.

Share this post


Link to post
Share on other sites

I'm having problems with creating a sound object dynamically, i.e. with a script. I get a CTD each time, doesn't matter if I use createvehicle or createobject I get the same result.

Share this post


Link to post
Share on other sites

I'm sorry I don't understand at all.  In my vehicle respawn script I create 30 or more "Logic" with createVehicle and then use them as markers to remember spots.  How on earth would I dynamically create "Logic"s with createUnit if I have to assign a group to them...??

"Logic" createUnit [[0, 0, 0], group Server, "logicUnit = this"]

[logicUnit] join grpNull

"Logic" createUnit [[0, 0, 0], group Server, "logicUnit = this"]

[logicUnit] join grpNull

"Logic" createUnit [[0, 0, 0], group Server, "logicUnit = this"]

[logicUnit] join grpNull

...

NOOOO I don't want to do it this way.  This is a pain!  If I am creating Game Logics and not giving/assigning them to waypoints...what's the problem then?  Confusion!  Hurts!  Argh!

Doolittle

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  

×