![]() |
Kodiak your script to destroy planes works fine.i tried it with 6He's and they disappeared after a minute like they should.yesterday i tried to replace the He's with Hurricanes and edited the script to destroy them instead of He's.it didnt work cause i used a wrong name for them.so i looked again at your script and how you defined the name for the He's.your script states He-111P-2, but i in the FMB the He's are defined as He 111P-2...so without the first hyphen.today i looked in the mission file itself and there the aircraft is defined as in your script...so i assume that if i want to destroy hurricanes or any other planes, i have to look in the .mis file first to know the correct designation for them...!?...is that correct?
i also tried to destroy only certain groups, so that not all He's disappear after a minute. so i added two seperate flights of He's and displaced the section: case "bob:Aircraft.He-111H-2": with: case "bob:Aircraft.0.BoB_LW_KuFIGr_706.03": didnt work, so i tried: case "bob:AirGroup.0.BoB_LW_KuFIGr_706.03": ...but that didnt work as well... i also tried to destroy only one single plane of the group, but that didnt work either, but im sure its possible. another question about this script: as it is now, the planes will disappear after a period of 60seconds. but do the 60seconds count from the beginning of the mission, or from the moment when the airplane is spawned? cause if i would have different flights of He's all spawning at different times, but after 60seconds of the mission they destroy themself again, all flights which would normally spawn after one minute, wouldnt appear at all, because they are destroyed before they are born.. |
It's ok, I found the problem! This is the trouble with no documentation, there's nothing to tell you the minor little bits and bobs. It was "Script spawn or" unchecked. It works now :D
I do find something weird though, don't know if others get it but seems that at some airfields when the AI spawn in they drop into the sea underneath the land. Ever seen it? |
hey Kodiak, godfather of COD scripting,how do i correctly combine two scripts?
i tried to kombine your script where the airplanes get destroyed after a certain period with the script which combines a main and three submissions....both of their own work well, but as soon as i paste the "destroying" script into the other, none of them will work.... |
@David:
I use the InternalTypeName of the plane, here others for the flyable planes: bob:Aircraft.Bf-109E-3 bob:Aircraft.Bf-109E-3B bob:Aircraft.Bf-109E-1 bob:Aircraft.Bf-109E-4 bob:Aircraft.Bf-109E-4B bob:Aircraft.Bf-110C-4 bob:Aircraft.Bf-110C-7 bob:Aircraft.Ju-87B-2 bob:Aircraft.Ju-88A-1 bob:Aircraft.He-111H-2 bob:Aircraft.He-111P-2 bob:Aircraft.SpitfireMkIa bob:Aircraft.SpitfireMkI bob:Aircraft.HurricaneMkI bob:Aircraft.HurricaneMkI_dH5-20 bob:Aircraft.BlenheimMkIV bob:Aircraft.SpitfireMkIIa to figure this out the KI-Only Planes you can add: Code:
GamePlay.gpLogServer(null, "InternalTypeName: {0}", new object[]{(actor as AiAircraft).InternalTypeName()}); To destroy the planes from a specific Airgroup is not possible in OnActorCreated(..) at the time of creation there is no Airgroup. But you can use the ActorName Code:
GamePlay.gpLogServer(null, "ActorName: {0}", new object[] { (actor as AiAircraft).Name() }); Code:
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor) Server: InternalTypeName: bob:Aircraft.Bf-109E-4 Server: ActorName: 0:BoB_LW_LG2_I.000 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.000 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.001 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.002 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.010 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.011 Server: InternalTypeName: bob:Aircraft.He-111H-2 Server: ActorName: 0:BoB_LW_KuFlGr_706.012 so if you like to destroy planes from a Airgroup you could use: Code:
if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706")) Code:
if (actor is AiAircraft && actor.Name().Contains("BoB_LW_KuFlGr_706.010")) |
Quote:
|
1 Attachment(s)
there it is...
|
Ok, i see couldn't work
this is the main block: Code:
using System; so you must place public override void OnActorCreated(....) { ..... ..... } and public override void OnTickGame(...) { ..... ..... } between the brackets. Your fault was that you placed the OnActorCreated into the OntickGame and this is not allowed in C#. Hint: Open your Clod Console and you will see error messages if anything goes wrong. So should your code look like: Code:
using System; |
Very interesting thread. Thank you, Kodiak.
I guess spawning the same group OnTrigger again and again may not work because when the group spawns the 2nd time it belongs to the second mission, etc. The game engine includes mission counter as far as I understand from naryv's examples. I think a long_name of a group may include a mission (submission) number. Maybe the way to load the same group OnTrigger is to make a sub-mission which includes both an airgroup and a trigger. Then load the same submission OnTrigger. Can not grasp it 100% myself, just thinking aloud. |
No, that works, but you have to clear the trigger again, after it was triggered.
If you have the following for the trigger: Code:
Code:
if (MissionTimer1IntA.Elapsed.Minutes >= 30) //wieder freischalten des Triggers |
ok Kodiak...i tried the script.
the He's of the main mission disappear after the 60seconds, but all other He's of the submissions will stay on the map... so i pasted the relevant part of the script in all the submissios to destroy these He's as well.....this works! ...but is it possible to edit the script of the main mission, that all He's, including the ones of the submissions, disappear? i looked at your brilliant tutorials on sturmovik.de and saw that its possible to destroy planes not only after a certain time, but when they cross a certain waypoint...but honestly im a bit overwhelmed by all its details that i dont consider myself capable of doing this by myself.... i also saw that it is possible to load submissions randomly...but in your tutorial you have some conditions which determine whether a mission is loaded or not(mission x will not be loaded if one destroys friendly vehicle)...i would like to load submissions randomly, regardless of any conditions, every xx seconds.is that possible? i think its a better solution for my purpose to load submissions by random than loading mission after mission in determined sequence, because this would add an surprising factor, and i think it would shorten the script drastically, if i want to have 20 or more submissions. btw, i really appreciate your help, and admire your patience with me!thx in advance... PHP Code:
|
All times are GMT. The time now is 06:53 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.