- Joined
- Dec 3, 2020
- Messages
- 968
So I want the AI to launch an attack wave, but it will either send 2 Grunts, or 2 Raiders or 1 Grunt and 1 Raider to attack. It will have a 40% chance to send 2 Grunts, 30% to send 2 Raiders and 30% to send 1 Grunt and 1 Raider.
I mean that it will only send 1 of these 3 different possible options (if one of them happens then the others will not).
Would I do it inside the InitAssaultGroup() like this:
//* WAVE 1 *
call InitAssaultGroup()
// 40% Chance to send 2 Grunts
call CampaignAttackerEx( 2,2,2, GRUNT )
// 30% Chance to send 2 Raiders
call CampaignAttackerEx( 2,2,2, RAIDER )
// 30% Chance to send 1 Grunt and 1 Raider
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
Or before it like this:
// // 40% Chance to send 2 Grunts
//* WAVE 1 - a *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, GRUNT )
call SuicideOnPlayer(M2,user)
// 30% Chance to send 2 Raiders
//* WAVE 1 - b *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, RAIDER )
call SuicideOnPlayer(M2,user)
// 30% Chance to send 1 Grunt and 1 Raider
//* WAVE 1 - c *
call InitAssaultGroup()
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
This is important to know, although I'm sure it doesn't matter THAT much.
My real question is how do I exactly write the code in JASS?
Example:
if (random integer between 1 and 10 less than or equal to 4) {
//* WAVE 1 - a *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, GRUNT )
call SuicideOnPlayer(M2,user)
} else if (random integer between 1 and 10 less than or equal to 7) {
//* WAVE 1 - b *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, RAIDER )
call SuicideOnPlayer(M2,user)
} else {
//* WAVE 1 - c *
call InitAssaultGroup()
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
}
I don't know what I need to write in JASS for the if, else if, else statement to work properly
I mean that it will only send 1 of these 3 different possible options (if one of them happens then the others will not).
Would I do it inside the InitAssaultGroup() like this:
//* WAVE 1 *
call InitAssaultGroup()
// 40% Chance to send 2 Grunts
call CampaignAttackerEx( 2,2,2, GRUNT )
// 30% Chance to send 2 Raiders
call CampaignAttackerEx( 2,2,2, RAIDER )
// 30% Chance to send 1 Grunt and 1 Raider
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
Or before it like this:
// // 40% Chance to send 2 Grunts
//* WAVE 1 - a *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, GRUNT )
call SuicideOnPlayer(M2,user)
// 30% Chance to send 2 Raiders
//* WAVE 1 - b *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, RAIDER )
call SuicideOnPlayer(M2,user)
// 30% Chance to send 1 Grunt and 1 Raider
//* WAVE 1 - c *
call InitAssaultGroup()
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
This is important to know, although I'm sure it doesn't matter THAT much.
My real question is how do I exactly write the code in JASS?
Example:
if (random integer between 1 and 10 less than or equal to 4) {
//* WAVE 1 - a *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, GRUNT )
call SuicideOnPlayer(M2,user)
} else if (random integer between 1 and 10 less than or equal to 7) {
//* WAVE 1 - b *
call InitAssaultGroup()
call CampaignAttackerEx( 2,2,2, RAIDER )
call SuicideOnPlayer(M2,user)
} else {
//* WAVE 1 - c *
call InitAssaultGroup()
call CampaignAttackerEx( 1,1,1, GRUNT )
call CampaignAttackerEx( 1,1,1, RAIDER )
call SuicideOnPlayer(M2,user)
}
I don't know what I need to write in JASS for the if, else if, else statement to work properly
Last edited: