Artifacts
From Original War Support Wiki
Tutorial By: Serpent
Source: OWEditor Identify, Sand of Siberia Mod
Contents |
Artifacts Type
Each artifact has diffrent size. Artifact 1 can be carry by engineer.
Programming Artifact
Find Artifacts on Map
FindArtifact(art_num); // art_num is artifact number (1 - 5)
Returns the coordinates of the specified artifact.
Example
coords := FindArtifact(1); x := coords[1]; y := coords[2];
SetArtifactRes
SetArtifactRes(side, boolean);
- side - specifies the side.
- boolean - true of false.
Makes the specified side able/unable to research the artifact technology (tech_artifact).
SetArtifactUse
SetArtifactUse(side, art_icon, art_behav, building);
- side - specifies the side.
- art_icon - specifies the looking (and position) of the button and must be one of the following constants:
art_exp_left art_exp_mid art_exp_right art_use_atom art_use_cube art_use_dead art_use_exclamation art_use_eye art_use_hand art_use_human art_use_power art_use_sibdestruct art_use_sibexplosion art_use_tau art_use_teleport
You can check every button in Interface/Nation/1024/GameScreen/buttons.tga.
- art_behav - specifies behaviour of the button:
- art_no - removes button from building panel.
- art_gray - disable button.
- art_instant - works like a normal button.
- art_place - prompt to select a location on the map.
- art_unit - prompt to select specifiy unit on map.
- building - building identifier.
On ArtifactUsed
Triggers when a button created by SetArtifactUse is activated.
On ArtifactUsed(side, param1, param2, param3) do
- side - return's which side used an artifact.
- param1 - return's which buttons was used (for example: art_use_eye).
- param2 - depends on the button behaviour. For art_instant return's 0. For art_unit return's the identifier of the chosen unit. For art_place return's x-coordinate of the selected hex.
- param3 - depends on the button behaviour. For art_instant and art_unit return's 0. For art_place return's y-coordinate of the selected hex.
On ArtifactResearchComplete
Triggers when the artifact technology (tech_artifact) is researched.
On ArtifactResearchComplete(building) do
- building - return's lab identifier.
On ArtifactLoaded
Triggers when an artifact is loaded on a cargo bay.
On ArtifactLoaded(unit, artifact_num) do
- unit - return's cargo id.
- artifact_num - return's artifact number.
On ArtifactUnloaded
Triggers when an artifact is unloaded from a cargo bay.
On ArtifactUnloaded(unit, artifact_num) do
- unit - return's cargo id.
- artifact_num - return's artifact number.
Example Code
On ArtifactResearchComplete(lab) do begin if GetSide(lab) = your_side then player_res_art := true; // enable artifact button End; Every 0$01 trigger FilterAllUnits([[f_side, your_side], [f_or, [f_btype, b_lab_full], [f_btype, b_lab_siberium]]]) and player_res_art do var x, y, lab, coords; begin enable; coords := FindArtifact(1); // artifact coord's x := coords[1]; y := coords[2]; lab := NearestUnitToXY(FilterAllUnits([[f_side, your_side], [f_or, [f_btype, b_lab_full], [f_btype, b_lab_siberium]]]), x, y); // lab id if player_artifact_ready = false then // if artifact is not ready if GetDistUnitXY(lab, x, y) < 6 then // if distance from lab is lower than 6 begin if BuildingStatus(lab) = bs_idle then // if lab not working SetArtifactUse(your_side, art_exp_left, art_instant, lab) // enable button else SetArtifactUse(your_side, art_exp_left, art_gray, lab); // disable button end else SetArtifactUse(your_side, art_exp_left, art_gray, lab); // disable button if player_artifact_ready then // if artifact ready if GetDistUnitXY(lab, x, y) < 6 then // if distance from lab is lower than 6 begin if BuildingStatus(lab) = bs_idle then // if lab not working SetArtifactUse(your_side, art_icon, art_unit, lab) // enable button else SetArtifactUse(your_side, art_icon, art_gray, lab); // disable button end else SetArtifactUse(your_side, art_icon, art_gray, lab); // disable button End; On ArtifactUsed(s, icon, cr1, cr2) do var x, y, i, lab, side; begin x := FindArtifact(1)[1]; y := FindArtifact(1)[2]; lab := NearestUnitToXY(FilterAllUnits([[f_side, your_side], [f_or, [f_btype, b_lab_full], [f_btype, b_lab_siberium]]]), x, y); if icon = art_exp_left then // if player click art_exp_left button begin SetSpecResearch(lab, time_res_art, true); // start spec research in lab SetArtifactUse(your_side, art_exp_left, art_no, lab); // hide button end; if icon = art_icon then // if player click art_icon button begin if cr1 in FilterAllUnits([f_type, unit_building]) then // if selected unit is building begin side := GetSide(cr1); if FilterAllUnits([[f_side, side], [f_btype, b_siberite_power]]) > 0 then begin for i in FilterAllUnits([[f_side, side], [f_or, [f_btype, b_oil_power], [f_btype, b_solar_power], [f_btype, b_siberite_power]]]) do SetLives(i, 1); // destroy all power plants player_res_art := false; // disable artifact SetArtifactUse(your_side, art_icon, art_gray, lab); // disable button Wait(time_to_reuse); // wait to refresh artifact player_res_art := true; // enable artifact end; end; end; End; On SpecResearchComplete(lab) do // if spec research is completed begin if GetSide(lab) = your_side then // if specify lab is yours begin SetArtifactUse(your_side, art_exp_left, art_no, lab); // delete button player_artifact_ready := true; // artifact is ready Hint('ArtVulcano'); // display hint end; End; On SpecResearchCancel(lab, progress) do // if someone cancel researching begin SetArtifactUse(your_side, art_exp_left, art_instant, lab); end; // Code from Sand of Siberia Mod by Serpent