Hard, hard problem.

For questions about using Classic.

Post » Mon Apr 21, 2008 9:57 pm

In my TD, you can place multiple turrets with different rate of fire/damage to kill the enemies. To attack, my event is like this.

---
> When turret[turret behavior] has target
+ Every turret[rate of fire]

= Shoot "Bullet" toward enemy
= Bullet[damage]=turret[damage]
---

In this way, when the first turret attacks, and there's another near, and they have both the same target, the second turret mimics the first turret's rate of fire.

I know the problem, Construct thinks that if two turrets have the same object as a target, they both shoot with the rate of fire of the first turret that saw the enemy.

It's hard to explain, and I don't want to distribute the game yet. Can someone PM me, and request the .cap, if possible? Or else, if you get what I mean with this thread, post here.
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Mon Apr 21, 2008 10:45 pm

Why don't you use the Turret movement's rate of fire feature? Set the rate of fire in milliseconds in the properties, and use the 'On Shoot' trigger to fire a bullet. This keeps the reload time independently for each turret saving you Every conditions and problems like these.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Tue Apr 22, 2008 12:28 pm

Yay, thanks!
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Apr 24, 2008 10:46 am

Umm... After a few tries, there's still the same problem... How can I fix it?
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Apr 24, 2008 11:09 am

They shouldn't do, each turret is storing an independent timer. Can you make an example .cap?
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Apr 24, 2008 11:38 am

[quote="Ashley":1qvj27z0]They shouldn't do, each turret is storing an independent timer. Can you make an example .cap?[/quote:1qvj27z0]

I can't reproduce it in another cap. In my TD, if I use the debugger, though, the values are always what they should be!

Reload time is always 2 seconds, even if the turret shoots every 0.10 seconds!
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Apr 24, 2008 11:40 am

Crap you beat me to replying.

Anyhow, if the variables are different then that means theres something wrong with your events. You may have to loop through each turret and tell each individual one to shoot, as you may be getting the problem that one turret is using another's variable. Thus it could be a selection problem

Anyhow, its REALLY not that hard a problem to fix :D
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Thu Apr 24, 2008 1:17 pm

[quote="alee":10y5uemw]Crap you beat me to replying.

Anyhow, if the variables are different then that means theres something wrong with your events. You may have to loop through each turret and tell each individual one to shoot, as you may be getting the problem that one turret is using another's variable. Thus it could be a selection problem

Anyhow, its REALLY not that hard a problem to fix :D[/quote:10y5uemw]

How to loop through all the turrets?
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Thu Apr 24, 2008 1:21 pm

You shouldn't have to do anything like that. Each turret keeps its own timer and fires at an independent rate, like in the RTS tech demo. Therefore, either a bug exists in the Turret behaviour, or something in your events is specifically breaking that. I suspect the latter since you can't reproduce it; if you simply spawn a bullet in an 'On Shoot' trigger, it will work fine, is that what you're doing?

For the record, though, you can loop through objects with 'For Each'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Apr 24, 2008 1:38 pm

[quote="Ashley":3pbt6fn4]You shouldn't have to do anything like that. Each turret keeps its own timer and fires at an independent rate, like in the RTS tech demo. Therefore, either a bug exists in the Turret behaviour, or something in your events is specifically breaking that. I suspect the latter since you can't reproduce it; if you simply spawn a bullet in an 'On Shoot' trigger, it will work fine, is that what you're doing?

For the record, though, you can loop through objects with 'For Each'.[/quote:3pbt6fn4]

It's probably my fault, but I can't find the cause of the problem.

Here's the full cap.

http://upload.namelezz.net/downloader.php?file=td16.cap
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests