Jump to content
_RoosterCat_

[Solved] Making AI from the Spawn AI module editable through Zeus

Recommended Posts

Hi I'm attempting to make it where the ai that spawn from the Spawn AI module editable by the Zeus, I've been looking around and haven't found anything yet.. I thought when I first started my mission testing I was able to edit them as they spawned but it appears now I am unable to. Will update if I find myself a solution

Share this post


Link to post
Share on other sites

The SpawnAI Module has an expression field that can be used to place code. This expression field receives parameters that include the group it spawned, so you can use this with addCuratorEditableObjects to assign them editable by Zeus.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your diligence in aiding me. I tried that, but when using the wiki example "MyCuratorModule addCuratorEditableObjects [[MyCar], true];"
[MyCar] is the object, and inside the spawner under expression I see: Passed arguments are [<group>,<module>,<groupData>].

if I use Zeus1 addCuratorEditableObjects [[<group>], true]; - nothing happens but an error telling me I'm missing a <#>(number) before group.
if I use Zeus1 addCuratorEditableObjects [[1<group>], true]; - error telling me same error as before but after group 
if I use Zeus1 addCuratorEditableObjects [[1<group>1], true]; - it tells me invalid numbers
if I use Zeus1 addCuratorEditableObjects true; it gives me an error saying expected array
if I use Zeus1 addCuratorEditableObjects [[(_this select 0)], true]; says expected group(saw online (_this select 0) is the group but didnt seem to work, and [[_this select 1], true] causes the spawner itself to become editable... a bit baffled been at this most of the day
it seems like addCuratorEditableObjects requires a variable name and I dont see a way inserting the name since each unit spawned doesnt have a variable name I can grab.

Is there a way of circumventing the need for a name?

Share this post


Link to post
Share on other sites
5 hours ago, _RoosterCat_ said:

"MyCuratorModule addCuratorEditableObjects [[MyCar], true];"

Note the brackets around MyCar, those represents an array (a list), which in the example only contains w/e MyCar points to.

 

addCuratorEditableObjects takes an array of objects as it's first right hand parameter.

That means we can't feed it the group reference directly, instead we have to convert the units of the group into an array. Luckily we have a command for that: units

 

The group is delivered to us through the passed arguments

5 hours ago, _RoosterCat_ said:

Passed arguments are [<group>,<module>,<groupData>].


These are accessible using param, params or directly from the "magic" variable _this.

 

So to put it all together:

Zeus1 addCuratorEditableObjects [ units param [0], true ];

 

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, mrcurry said:

Zeus1 addCuratorEditableObjects [ units param [0], true ];

Thank you for helping me understand the group referencing and the fact that it was an array.. I plug in the code and it gives me an error saying it's missing a ";" but reading the code it looks correct to me. I also tried using _this and params in place of param but all three come back with "missing ;"

"Zeus1 addCuratorEditableObjects [ units param [0], true ];" your code clearly has a ;
 

Share this post


Link to post
Share on other sites
2 hours ago, _RoosterCat_ said:

Thank you for helping me understand the group referencing and the fact that it was an array.. I plug in the code and it gives me an error saying it's missing a ";" but reading the code it looks correct to me. I also tried using _this and params in place of param but all three come back with "missing ;"

"Zeus1 addCuratorEditableObjects [ units param [0], true ];" your code clearly has a ;
 

 

You have just got a lesson in why you don't just copy-paste forum plain text straight into the game 🙂

This is what a copy of it looks like with a proper code editor:
 

ExtraChars.png?rlkey=puqrr4sqjnuyg1dfufs

 

I've cleaned it up in the previous post but to be safe type it in from scratch yourself instead. 

The code works, just tested it myself.

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, mrcurry said:

You have just got a lesson in why you don't just copy-paste forum plain text straight into the game 🙂

This is some amazing advice I haven't seen ANYWHERE!!! My man you helped me resolve a 2 day working issue. Typing it out allowed it to work! I really appreciate your feedback and assistance.

  • Like 1

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

×