[SOLVED] Change AI Difficulty over time

Get help using Construct 2

Post » Wed Mar 21, 2012 6:40 am

Hey,

I'm new to this forum, just registered and I've downloaded Construct 2 Free Version and I've fallen in love with it. Such an awesome software. I'm thinking of buying a License, because it's worth it.

I'm in a bit of a pinch though. Let me explain.

My game is a top view monster defense game, there's 2 different types of monsters.
1) Monster. Has 2 Instance Variables, "Health: 4, and Damage: 2" Spawn every 5 seconds.
2) Boss. Has 2 Instance Variables, "Health: 40, and Damage: 10" Spawn every 60 seconds.

Now, every 60 seconds I want both the monsters to have increased difficulty, for example Monster to get 4 more health and 1 more damage.

I did this as an "System -> Every X Seconds -> Monster Add 4 to Health" and so on.

But that only works for the monsters that's allready spawned, the monsters that spawn after the 60 second mark has the basic attributes and are unaffected by the change.

So how do I make the change in variables/attributes apply to the monsters that are about to spawn?

I hope I made myself clear. Help is needed.
Jonsterz2012-03-21 15:52:34
B
13
S
5
G
2
Posts: 64
Reputation: 3,012

Post » Wed Mar 21, 2012 7:51 am

you could do some global variables that will be increased as well and for new spawned monster, you add the count of that variable to the initial health.
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Wed Mar 21, 2012 8:30 am

But that only works for the monsters that's allready spawned, the monsters that spawn after the 60 second mark has the basic attributes and are unaffected by the change.
Yes, that's for sure - it should work so. The monsters have after their creation the instance-values that are set in the object. You have to set the values for the instancevariables of them below the spawning in the eventsheet.
quick example Joe72012-03-21 08:44:10
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Wed Mar 21, 2012 3:43 pm

Thanks for the help, I'm starting to understand how it works. But what you sent me did not exactly what I was looking for, it did in a way though. Maybe I explained it a bit wrong.

Your program creates another sprite of the same monster but with the bonus, and at the same time spawns the old one, without the bonus. If I follow your example, I'd have to make a new row for each upgrade.

I just want to endlessly increase the difficulty every 60 seconds.




NEVERMIND. During this post I made it work. I'll tell you how.

I added a global variable "AddMonsterHealth = 2"
And an Event that Increases "AddMonsterHealth" every 60 seconds by 2.
And the monster that spawns, has it's own "Health variable" increase by "AddMonsterHealth".

This works because the "AddMonsterHealth" Increases by 2 every second, and the "Health" variable in the monster is set by "AddMonsterHealth"

I feel proud now. But I wouldn't have made it without your help Joe7, so thank you! :)

B
13
S
5
G
2
Posts: 64
Reputation: 3,012

Post » Wed Mar 21, 2012 3:43 pm

Make a Global Variable for every type of enemy, and instead of adding to the instance variables, add to the global variables. Then add an event that sets the instance variables to the global variables every tick.

[code]
Global Variable SetMonsterHP = X

Every tick:
-> Set Instance Variable MonsterHP to SetMonsterHP

Every X seconds:
-> Add X to SetMonsterHp

[/code]

Edit: Ah, I see you beat me to it Nimtrix2012-03-21 15:45:11
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Mar 21, 2012 3:52 pm

Haha yeah, but thank you anyway! :)
B
13
S
5
G
2
Posts: 64
Reputation: 3,012


Return to How do I....?

Who is online

Users browsing this forum: Muini and 29 guests