Teraz jest So 14 cze, 2025 05:28


Problem z skryptem .sqf

Dział poświęcony edytorowi ArmA II i Operation Arrowhead, czyli tworzeniu misji.
  • Autor
  • Wiadomość
Offline
Avatar użytkownika

Sejtan

Major

Major

  • Posty: 676
  • Dołączył(a): Pn 19 lip, 2004 21:26
  • Lokalizacja: Starogard Gdański

Problem z skryptem .sqf

PostSo 04 wrz, 2010 23:26

Witam. Mam problem z skryptem poniżej. Niby wszystko działa, nie wyświetlają się żadne błędy, ale skrypt działa jak pętla..., a nie powinien (chyba :))) Uaktywnia się kilka razy na sekunde, przez kilkanascie sekund. Poznaję to po pomocniczym tekscie, który wyświetla się w określonych momentach skryptu.

Na pisaniu skryptów raczej słabo się znam... Tego wysmarowałem w oparciu o przykład:

Kod: Zaznacz cały
if (CONDITION) then
{
    STATEMENT;
    ...
}
else
{
    STATEMENT;
    ...
};

Żródło: Bohemia Interactive Community Wiki/Control Structures

Kod: Zaznacz cały
wyzwalacz = true;
sleep 5;
tk1 moveInDriver car;
tk2 moveInCargo car;
tk3 moveInCargo car;
tk4 moveInCargo car;
tank doMove position heli;
tank setSpeedMode "FULL";
_marker = createMarker ["hDown", position heli];
_marker2 = createMarker ["hDown2", position heli];
sleep 1;
"hDown2" setMarkerType "hd_warning";
"hDown" setMarkerShape "ELLIPSE";
"hDown" setMarkerSize [250, 250];
"hDown" setMarkerBrush "BORDER";
"hDown" setMarkerColor "ColorRed";
sleep 5;

waitUntil {count crew heli == 0};
if (alive heli) then
{
   tk1 doMove position heli;
   titleText ["Działa jeśli śmigło nie zostało zupełnie zniszczone.", "PLAIN"];
   if (tk1 distance heli < 50) then
      {
       doStop tk1;
       sleep 2;
       tk1 action ["getOut", car];
       tk2 action ["getOut", car];
       tk3 action ["getOut", car];
       sleep 2;
       nul = [tk1, "hDown", "SAFE"] execVM "ups.sqf";
       titleText ["Działa jeśli auto jest mniej niż 50 metrów od śmigła.", "PLAIN"];
      };
}
else
{
   tk1 doMove position tent;
   titleText ["Działa jeśli śmigło zostało zupełnie zniszczone.", "PLAIN"];
   if (tk1 distance tent < 50) then
      {
       doStop tk1;
       sleep 2;
       tk1 action ["getOut", car];
       tk2 action ["getOut", car];
       tk3 action ["getOut", car];
       sleep 2;
       nul = [tk1, "ALPHA", "SAFE"] execVM "ups.sqf";
       titleText ["Działa jeśli auto jest mniej niż 50 metrów od namiotu w Rawanaj.", "PLAIN"];
      };   
};
Offline
Avatar użytkownika

kondor

Major

Major

  • Posty: 880
  • Dołączył(a): Pt 11 lut, 2005 04:00
  • Lokalizacja: Berlin (wschodni)

PostN 05 wrz, 2010 00:05

No to wina tego czegoś co wywołuje ten skrypt, a nie skryptu.
Offline
Avatar użytkownika

Sejtan

Major

Major

  • Posty: 676
  • Dołączył(a): Pn 19 lip, 2004 21:26
  • Lokalizacja: Starogard Gdański

PostN 05 wrz, 2010 11:21

Hmmm... wywołanie skryptu wygląda następująco:
Śmigło wlatuje w wyzwalacz, który aktywuje skrypt:

Kod: Zaznacz cały
tk1 setBehaviour "COMBAT";
tk2 setBehaviour "COMBAT";
heli setCaptive false;
tk2 doTarget heli;
sleep 2;
tk2 doFire heli;

while {count crew heli == 1} do
{
 if (tk2 ammo "Stinger" < 1) then
    {
    nul = [] execVM "move.sqf"
    };
};

który uaktywnia move.sqf. :)

Tak... wiem troche namąciłem... ale tak to u mnie wygląda ;P
Offline
Avatar użytkownika

kondor

Major

Major

  • Posty: 880
  • Dołączył(a): Pt 11 lut, 2005 04:00
  • Lokalizacja: Berlin (wschodni)

PostN 05 wrz, 2010 12:14

Zauważ, że skrypt "move.sqf" wywołuje się tyle razy ile razy liczba załogi = 1 i został wystrzelony stinger. A że pętla jest wywoływana wielokrotnie w ciągu sekundy, to pomiędzy wystrzeleniem stingera, a zabiciem / wyskoczeniem załogi skrypt wywoła wielokrotnie.
Najprostszym naprawą jest dodanie zmiennej do warunku pętli, który wskazuje czy pocisk został wystrzelony:
Kod: Zaznacz cały
_pociskWystrzelony = false;
while {(count crew heli == 1) and (not _pociskWystrzelony)} do
{
   if (tk2 ammo "Stinger" < 1) then
   {
      [] execVM "move.sqf";
      _pociskWystrzelony = true;
    };
};


Ale "ładniej" możnaby to zrobić poprzez eventHandler "fired" (na wystrzelenie stingera) lub eventHandler "hit" (dla śmiegłowca)
Offline
Avatar użytkownika

Sejtan

Major

Major

  • Posty: 676
  • Dołączył(a): Pn 19 lip, 2004 21:26
  • Lokalizacja: Starogard Gdański

PostN 05 wrz, 2010 12:58

Przy w/w rozwiązaniu wyskakuje błąd "brak ;", ale zrobiłem "ładniej" z eventHandlerem "HIT" i działa jak należy :) Dzięki.
Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf

Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf

PostSo 07 wrz, 2024 03:16

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting
Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf

Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf

PostŚr 04 gru, 2024 21:40

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting
Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf

PostWt 04 mar, 2025 00:42

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruhttp://semiasphalticflux.ruhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.ruhttp://taskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruhttp://temperateclimate.ruhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru
Online

xersius

Pułkownik

Pułkownik

  • Posty: 99987
  • Dołączył(a): Pn 29 lip, 2024 15:01

Re: Problem z skryptem .sqf


Powrót do [ArmA II] Edytor

Kto przegląda forum

Użytkownicy przeglądający ten dział: Brak zidentyfikowanych użytkowników i 128 gości

cron