Jump to content


Photo

Scripting - Build teams


  • Please log in to reply
10 replies to this topic

#1 motoma197

motoma197
  • Members
  • 28 posts

Posted 22 January 2019 - 04:20 PM

Hi

So first I'm doing this 

So I've been trying to create a custom map where an AI team is to produce teams from their production buildings, exactly how it's done in the campaign. 

I'll explain what I've been doing. This is with RotWK 2.02

First I create 2 scripts in a folder, both marked as subroutine with deactivate on success unchecked. The first script is IF: True, THEN: Null operation. The second IF: True, THEN: Move to waypoint
Under Teams I add a test team to try out the script. Under production condition I attach the first script, for 'on create' I attach the second script. Priority is 1000, build for is 300. I add 2 units on the team as testers, Min 1 Max 1 of each Easterling Horde and Orc Warrior Horde.

I save the game and on the map I place an orc pit and haradrim palace with the team that the scripts are attached to.

Nothing happens in game. 

 

I've tried this process on a number of different teams. I've tried using PlyrCreeps, PlyrTeam_1, PlyrTeam_2, PlyrSkirmishMordor, PlyrMordor and some others. No matter what I do it doesn't work. I've also tried not adding Skirmish Players but that doesn't help, the AI just does even more nothing  :D

 

Separate but related issue, whenever I try and add a player that isn't PlyrCreeps, none of their units are even selectable or interactable. They're just neutral no matter if I set diplomacy in playerlist or force allegiance with scripts, they're just dead. This is ok as I can use player scripts for most things but ideally I want to be able to have an AI that constantly produces untis from PBs then give them custom commands.

 

Any and all help appreciated! If I need to clarify anything any further I'll be happy to



#2 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 23 January 2019 - 07:57 PM

Evening,

Very pleased to see somebody getting to grips with good old team scripting! It is a pain in the arse though. Did you add a script giving PlyrCreeps Money and CP, as well as a script saying they're allowed to build units and buildings? Without those it'll just sit there and not produce any of your teams. Every other player besides PlyrCivilian and PlyrCreeps has their own AI and overrides anything you tell them to do. That's why they sit there doing nothing. So always have your AI teams on PlyrCreeps.

In skirmish you cannot add new players, as you found out. The units just default to PlyrNeutral and do nothing. Its a git.

If you need further help I can send you over a blank map with the scripts in-place.

Cheers,
Fudge



#3 motoma197

motoma197
  • Members
  • 28 posts

Posted 24 January 2019 - 06:41 AM

Thanks for the help! 
I gave them money and CP but didn't think of allowing them to build units and buildings. I tried adding these ones but even with them it didn't work, might have gotten them all wrong!
 
*** IF ***
    True.
*** THEN ***
  Override command points for Player 'PlyrCreeps' to total:  2000  maximum:  2000 
   Player 'PlyrCreeps' is allowed to build ALL buildings is TRUE . 
   Player 'PlyrCreeps' toggle auto build TRUE
   Player 'PlyrCreeps' is able to build units.
   Player 'PlyrCreeps' is able to build buildings.
   Player 'PlyrCreeps' gets $ 20000 
 
If you could send the example map through that'd be incredible! 


#4 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 24 January 2019 - 09:54 AM

You're very welcome. The system is so temperamental that it can waste your time on pointless bug-tests sometimes!

I am surprised those scripts didn't sort the issue for you. I have attached a map I made with the same scripts and it seems to work fine for me. Take a look and see if you can spot any differences to your script setup and let me know if you solve the issue.
 

https://1drv.ms/u/s!...ikd14njZukNM85y

Cheers,
Fudge



#5 motoma197

motoma197
  • Members
  • 28 posts

Posted 24 January 2019 - 12:08 PM

I'm not sure exactly what was different but it works! I think maybe the timer that leads to a flag becoming true as the build condition is what it could be. I only had a single TRUE conditions there before

 

Many thanks! I'm sure to have many more questions in the future, like you said this scripting system seems to be very counter-intuitive



#6 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 24 January 2019 - 05:33 PM

You're very welcome. The system is so temperamental that it can waste your time on pointless bug-tests sometimes!

I am surprised those scripts didn't sort the issue for you. I have attached a map I made with the same scripts and it seems to work fine for me. Take a look and see if you can spot any differences to your script setup and let me know if you solve the issue.
 

https://1drv.ms/u/s!...ikd14njZukNM85y

Cheers,
Fudge

 

Very interesting, this is new to me. 

 

I have a couple of questions:

  1. What's the counter for? By looking at the scripts I would guess it's to keep max 5 orc units on the field at a time but when I tried the map it only ever made 1 unit.
  2. How does "execute script sequentially" work and why is it used?
  3. How does the "build for X seconds" work? Does it override the gamedata time and produce the entire team once the specified time has run out (can I put 10s and have it instantly produce 100 orc hordes for example) or will the script have this much time to produce the units from the team, in other words, units will be produced one at a time with the time described by the ini?
  4. I assume "Priority" is used if you have multiple build scripts and the game has to decide what to build first? Is this value 0-100? Why did you pick 100 instead of 1 for example if you don't have any other scripts in conflict with it?
  5. What is "Success/Failure Priority"?
  6. How is the script "C Test" triggered? Since it's a subroutine it's very odd to me that it runs just by putting it as the Production Condition for the team. Wouldn't this make the script run an infinite amount of times since the script condition will always be true? I mean the other scripts are subroutines too but at least they are triggered by conditions set in the team settings. Very confusing.
  7. What does the "Percentage 100%" mean in the model condition script? To run the full animation?
  8. Why is the Haradrim Palace invisible?

Edited by Jokuc, 24 January 2019 - 05:39 PM.


#7 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 24 January 2019 - 09:11 PM

Glad it works! Let me know if you ever need anymore help.

To answer your questions Jokuc:

  1.  The Counter should have been 1. It just keeps track of whether the team is alive or not. So if its <1 then the AI knows to start building it again. I will put it above 1 sometimes as the AI can incorrectly build the same team simultaneously from two different buildings, thereby breaking the counter. Flags also work in this setup.
  2.  Execute Script Sequentially just means the team will execute the script actions in an order. So they do action 1, then action 2 and so on. Its essential for scripting patrols and such. In BFME 2 you can just tick the script sequential button, rather than telling one script to execute another sequentially (So you wouldn't need the TS script).
  3. I just used 300 because EA does. According to the WB manual - When a team’s script condition and priority have been met, the AI attempts to build the team for the number of frames in this field.
  4. Again I picked 100 just randomly. You could use 1.
  5. That field increase or decrease the priority for creating another instance of the team, according to whether it succeeds or fails in completing its objective. I believe this may not work in BFME 2.
  6. I cannot tell you exactly how it works. But the AI will monitor these condition scripts and build teams when the conditions defined in them are met. You can also put actions in these scripts for the team to carry out, you just have to tick "Execute associated actions" box.
  7. I am not sure what you mean by this? The 'On destroyed' field is set to 100%, so I can run a script that will reduce the counter/set a flag that the AI can use to build another instance of that team.
  8. I don't know why the haradrim palace is invisible..haha.


#8 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 24 January 2019 - 09:13 PM

You guys should use this manual. It is excellent and can answer many of your questions - https://www.scribd.c...dBuilder-Manual



#9 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 24 January 2019 - 09:28 PM

You can increase the number of instances on this team at any one time by increasing the 'Maximum' number  in the team identity tab. Its in the top right I believe? So the AI would produce X amount of that team.



#10 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 25 January 2019 - 05:53 AM

 

I am not sure what you mean by this? The 'On destroyed' field is set to 100%, so I can run a script that will reduce the counter/set a flag that the AI can use to build another instance of that team.
I don't know why the haradrim palace is invisible..haha.

 

 

12p.PNG

 

So the palace is not invisible for you?



#11 Fudge

Fudge

    title available

  • Project Team
  • 531 posts
  • Location:Devon, England
  • Projects:Luckily AotR Mapping

Posted 25 January 2019 - 10:56 AM

Yeah it is but I play with AotR installed so I guessed it was due to the mod files. I don't know why its invisible for vanilla?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users