![]() |
#21
|
||||||
|
||||||
![]() Quote:
Quote:
Quote:
actor.Name().Contains("BoB_RAF_F_FatCat_Early") so every plane in the goup counted. Quote:
Quote:
you can improve the script. For example: Code:
using System; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { int planecounter = 0; public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages) { base.OnActorDead(missionNumber, shortName, actor, damages); AiAction MakeNewAircraft = GamePlay.gpGetAction("SpawnAircraft"); if (actor != null && MakeNewAircraft != null) { if (actor.Name().Contains("BoB_RAF_F_FatCat_Early")) { planecounter++; if (planecounter >= 2) { MakeNewAircraft.Do(); GamePlay.gpHUDLogCenter("New Enemy spawned!"); } } } } } Quote:
Last edited by FG28_Kodiak; 10-15-2011 at 02:58 PM. |
#22
|
||||
|
||||
![]()
hey Kodiak!thx again will try that out immediately.....
but yet i have another question:i want to build a mission, where london gets continually bombed....i mean really destroyed, that if one flies over the city, one can see the damage everywhere...for that i used the script called "scripting for dummies" i think where one can create a main mission and 3submissions which will load after a certain time...it works, but now i have the problem that my He's stay on the map, and every ten minutes 30new He's spawn to bomb the city...so after 30minutes the mission grinds my pc to a halt because i have over 100 planes in the air...so i want the He's to dissapear again after they reached a certain waypoint...is that possible???and how?? this is what i have so far... Last edited by David198502; 10-15-2011 at 04:40 PM. |
#23
|
|||
|
|||
![]()
It's possible, the easy way.
Code:
using System; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { public override void OnActorCreated(int missionNumber, string shortName, AiActor actor) { base.OnActorCreated(missionNumber, shortName, actor); if (actor is AiAircraft) { switch ((actor as AiAircraft).InternalTypeName()) { case "bob:Aircraft.Ju-87B-2": case "bob:Aircraft.Ju-88A-1": case "bob:Aircraft.He-111H-2": case "bob:Aircraft.He-111P-2": Timeout(60, () => // Time in Seconds { (actor as AiAircraft).Destroy(); }); break; } } } } An other possibility is to check if the plane reach the last waypoint and then destroy it, but this is a little bit more complicated. Last edited by FG28_Kodiak; 10-15-2011 at 05:13 PM. |
#24
|
||||
|
||||
![]()
hey Kodiak....thx will try that too!if that works, the fmb will become a whole new world of possibilities for me...
i tried the script with the planecounter command.but when i fly the mission, the second group spawns after i shot down only one plane...it will spawn a new group everytime i shoot a single plane. |
#25
|
|||
|
|||
![]() Quote:
![]() ![]() "I've a dream" ![]() OK what are the Problems. The first, not only the plane itself has a name which contains "BoB_RAF_F_FatCat_Early", the pilot (and gunners) also contains it. We need something that checked if it is a plane. For this we need a if-clause that check: if (actor is AiAircraft) so we only get the plane. If we want examine the crew extra we could use: if (actor is AiPerson) So now we only get the plane, but an other problem still exist. i use the if - clause: if (planecounter >= 2) but whats the problem, with this if-clause the planes spawn after shooting down two, but also after three , four .... so it should changed in if (planecounter == 2) so the script should now look like: Code:
using System; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { int planecounter = 0; public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages) { base.OnActorDead(missionNumber, shortName, actor, damages); AiAction MakeNewAircraft = GamePlay.gpGetAction("SpawnAircraft"); if (actor != null && MakeNewAircraft != null && actor is AiAircraft) { if (actor.Name().Contains("BoB_RAF_F_FatCat_Early")) { planecounter++; if (planecounter == 2) { MakeNewAircraft.Do(); GamePlay.gpHUDLogCenter("New Enemy spawned!"); } } } } } ![]() |
#26
|
||||
|
||||
![]()
.
Last edited by Osprey; 10-16-2011 at 09:30 AM. |
#27
|
||||
|
||||
![]()
thx Kodiak..believe me, yesterday i started too have closer look in those scripts,and i also looked at your really detailed tutorials on sturmovik.de,and i wanted to solve the problem by myself....i have the same dream...will look at it and try to understand.
@sorry Osprey if it was due to me that your question was overheard Last edited by David198502; 10-16-2011 at 01:33 PM. |
#28
|
||||
|
||||
![]()
It's ok, I blanked it and I've done some reading, but I'm getting just plain frustrated that's all:
I put this into my dogfight folder and opened in FMB, and then did 'Play Mission'. It worked perfectly. BUT, when I used the same code on my mission (obviously with the triggername edited) it was ignored. I have an historical mission I am making. There is a bomber attack spawning deep in France and it requires a fighter sweep 5 mins ahead. The fighter bases are nearer to the coast so at present they all spawn in together and naturally the fighters have completed their run well before the bombers are in the area. Here's what I have done and stumbled on: 1. An area trigger for the fighters so that when the bombers pass through the trigger zone they spawn in. The outcome is that the trigger is totally ignored. There is another bug where DOUBLE the number of aircraft are spawned in as you've set up in the mission. No idea why. 2. I changed the trigger to a time delay copying your script but again, the fighters simply spawned in. This time I had them groundstart but on one base the ground wasn't rendered in time and all the fighters nosedived into the sea - in the middle of France!!! 3. I changed the trigger time delay to match your script for a single fighter but again the trigger was ignored. What I really don't understand is how your script works and mine doesn't yet the only difference is the fighter group selected and the map. Why would your script be run but mine ignored?? Quote:
Last edited by Osprey; 10-16-2011 at 10:52 AM. |
#29
|
||||
|
||||
![]()
OK I've just found out something interesting. What appears to be happening is that the FMB is spawning in double the number of objects for these fighters, no idea why. I've been running the script and instantly seeing the spawning in fighters thus assumed that it hadn't worked. This time I let it run a little and et voila! upon 60 seconds, the designated time, a NEW group spawned in - this caused the others to explode because they hadn't yet moved off their spawn position!!!
So this is a result, this means that it's a case of getting rid of these initial airgroups in the mission. Has anyone seen this before??? Is this some weird cahcing problem because I can't see a problem in the .mis file. Last edited by Osprey; 10-16-2011 at 11:08 AM. |
#30
|
|||
|
|||
![]()
Can you upload your complete mission, please. So it's easier to debug.
![]() |
![]() |
|
|