{
//Checks if the region is highlighted and therefore a region that can be moved into and does combat checks
if self.visible=1 then
{
{
//Am I a baddie?
if self.ishostile=0 then
{
//Moves army since there is no enemy to be found
global.selected.x=self.x
global.selected.y=self.y
}
else
{
//Begins combat calculations
var combatcalc;
combatcalc=random(1);
if combatcalc=1 then
{
//You lose! haha!
with(global.selected) {
instance_destroy();
}
}
else
{
//Win
with(self.garrison) {
instance_destroy();
}
self.garrison=global.selected.id;
global.selected.x=self.x
global.selected.y=self.y
ishostile=0;
}
}
}
//Now we dehighlight the regions already highlighted
var adjRegions;
var highregion;
adjRegions = global.selected.region.adjacentRegions //just to make the variable shoter for the rest of the code
for(i=0; i<ds_list_size(adjRegions); i+=1){
highregion=ds_list_find_value(adjRegions, i)
highregion.visible=0
}
//Tells the new region that I now control it and ends this unit's turn
global.selected.region=self.id
global.selected.lastturn=global.selected.lastturn+1;
global.selected=0;
global.havegone=global.havegone+1;
}
else
{
exit
}
}
- Game Maker Community
- → Viewing Profile: Topics: ProxatorDesign
ProxatorDesign
Member Since 01 Jul 2012Offline Last Active Aug 15 2012 02:54 AM
Community Stats
- Group New Member
- Active Posts 14
- Profile Views 338
- Member Title GMC Member
- Age 19 years old
- Birthday October 5, 1993
-
Gender
Male
-
Location
United States
-
Interests
Programming, Logic, Games
-
Version
GM8
Topics I've Started
Turn based strategy region attacking issues
09 August 2012 - 07:27 PM
So in my turn-based game, I use a list for each region that defines what regions are adjacent. I also define a variable that determines whether or not a region is friendly/unoccupied or hostile. But whenever the army in question moves into a hostile region with a hostile army, the combat mechanic I had as a placeholder dosen't fire. The army just moves right in the region without either army being destroyed. Here is the script I am using.
Turn-based mechanic without grids
26 July 2012 - 07:03 AM
Ok, here's the dealio
Me and 2 others are currently working on a game project. It's a turn-based strategy game that will be similar in scope to how Hearts of Iron works. The map will be divided into several regions and armies can only move to an adjacent region once per turn. Only problem is, we've tried almost anything we can think of in terms of how to implement this. Ranging from treating the regions as objects and going from there(that got messy really quick), to using arrays to define regions.
I'm not asking anyone to do this for me, I just need some advice from people who might have done this before to what they did to get their guys moving and getting the turn system to work. We can handle AI (as painful as it will be)
Many thanks!
ProxatorDesign
Me and 2 others are currently working on a game project. It's a turn-based strategy game that will be similar in scope to how Hearts of Iron works. The map will be divided into several regions and armies can only move to an adjacent region once per turn. Only problem is, we've tried almost anything we can think of in terms of how to implement this. Ranging from treating the regions as objects and going from there(that got messy really quick), to using arrays to define regions.
I'm not asking anyone to do this for me, I just need some advice from people who might have done this before to what they did to get their guys moving and getting the turn system to work. We can handle AI (as painful as it will be)
Many thanks!
ProxatorDesign
- Game Maker Community
- → Viewing Profile: Topics: ProxatorDesign
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content