|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 26, 2015 03:40 PM |
|
|
Try this
!?LEx/y/z;
!!HE-1:A2/128/?y1/?y2; check the number of ABs hero has (y1 = equipped, y2 in backpack)
!!FU|y1<1/y2<1:E;
!!HE-1:N?y1;
!!FU338357:Py1/3;
!!IF:Q1/8/128/1^Message^; message IF artifact was found
!?FU338357;
; x1 - hero
; x2 - slot
!!UN:C6919480/4/?y1; [y1 - BASE]
!!VRy2:Sx1*1170+y1+136736; [y2 - pointer to hero structure]
!!SN:E5123648/2/y2/x2;
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 26, 2015 03:50 PM |
|
|
Thanks, it seems to work OK
One last question though. If I want this to be triggered by two separate events, do I copy the script twice (one with the coordinates of the first event and two for the second)? Or is there a way to include the coordinates of the two events on this same script?
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 26, 2015 03:51 PM |
|
|
No, separate events need again the code. Just paste it again with only coordinates changed but ignore this:
!?FU338357;
; x1 - hero
; x2 - slot
!!UN:C6919480/4/?y1; [y1 - BASE]
!!VRy2:Sx1*1170+y1+136736; [y2 - pointer to hero structure]
!!SN:E5123648/2/y2/x2;
It will trigger for both events.
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 26, 2015 04:20 PM |
|
|
It works on both events, thanks but I found a small bug.
It doesn't work when Armageddon's Blade is on backpack.
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 26, 2015 04:26 PM |
|
|
!?LEx/y/z;
!!HE-1:A2/128/?y1/?y2; check the number of ABs hero has (y1 = equipped, y2 in backpack)
!!FU|y1<1/y2<1:E;
!!if&y1>0/y2<1:; if artifact not equipped but in backpack
!!HE-1:A3/128/1/1; remove
!!en:;
!!if&y2>0:; if artifact equipped
!!HE-1:N?y1;
!!FU338357:Py1/3;
!!en:;
!!IF:Q1/8/128/1^Message^; message IF artifact was found
Replace first part with this.
____________
Era II mods and utilities
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 26, 2015 04:35 PM |
|
|
Still doesn't work.
I mean, it works when equipped, it doesn't when unequipped.
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 26, 2015 04:49 PM |
|
|
My bad. Replace | with & or the entire line:
!!FU|y1<1/y2<1:E;
with
!!FU&y1<1/y2<1:E;
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 26, 2015 05:07 PM |
|
|
Thanks it seems to work now!
I don't know If you remember, but a long time ago I asked you for a script that instantly kills attacker and defender If one of them has sword of Frost and other Armageddon's Blade. I needed this script for the Tarnum campaigns where it was said that if these two swords collide the end of days would come (and the start of H4 as well).
I revisited the issue and I thought that another way around it is to add an event (right before the final battle) that checks for Armageddon's Blade and discards it (by adding also a text that clarifies the reasons). It works OK now and the storyline is kept clean thanks to you.
Here is the script that you gave me a long while ago:
Try this then but probably will bug, as killing heroes before battle starts is going to mess then whole thing:
!?BA0&1000; battle start
!!SN:W^HoL_disaster^/0; initialize clash
!!BA:H0/?y11 H1/?y12; check heroes ID
!!FU&y12<0:E;
!!HEy11:A2/128/?y1/?y2 A2/163/?y3/?y4;
!!HEy12:A2/128/?y5/?y6 A2/163/?y7/?y8; check if they have artifacts 128/163
!!VRy9|y2=1/y4=1:S99;
!!VRy10|y6=1/y8=1:S99;
!!SN&y9=99/y10=99:W^HoL_disaster^/99; create condition
!!SN:W^HoL_disaster^/?y1;
!!FU&y1<99:E;
!!IF:M^custom message (both artifacts are present)^;
!!HEy11:A2/128/?y1/?y2 A2/163/?y3/?y4;
!!HEy11&y2>0:A3/128/1/1;
!!HEy11&y4>0:A3/163/1/1;
!!HEy12:A2/128/?y1/?y2 A2/163/?y3/?y4;
!!HEy12&y2>0:A3/128/1/1;
!!HEy12&y4>0:A3/163/1/1; remove artifacts
!!HEy11:K;
!!HEy12:K;
The way I remember it it should make both heroes retreat and then removed the artifacts.
Now that I have a small experience on adding scripts on single scenarios (the idea didn't occur to me back then I guess) do you think you can modify this and make it work? Since it is only for a single scenario all I need is for the heroes to retreat or be defeated, because If Tarnum (in this campaign) loses a battle then the scenario is lost anyway so there is no need to make a big fuss about it.
To make it simpler, the script would:
1) check for both artifacts before battle (and occur ONLY IF both are equipped
2) Give a message to clarify what happened
3) Both heroes are either defeated or retreat (would prefer defeated)
If it's too much to ask then it's OK, I appreciate the effort anyway.
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 27, 2015 04:05 PM |
|
|
I don't understand, what you ask is exactly what the script you quoted does. Why need another one?
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 29, 2015 10:36 AM |
|
|
Yes it works OK my bad.
The reason I posted it again is that I tried it on a single scenario and nothing happened, it didn't work. But when I entered it in my mod script then it worked fine. So it's OK.
I may not use it though because I am afraid it might interact with my other part of script. !?BA0&1000; is a trigger you gave me for other functions as well, do you thing there might be a problem there?
Can something else be used? Like !?BA0&998; or something?
____________
Not idly do the leaves of Lorien fall.
|
|
XEricSin
Famous Hero
|
posted November 29, 2015 01:07 PM |
|
|
function getGameState
Hi
I am thinking of giving a hero the ability to recall to a position that was set earlier, similar to the feature in The Dragon Slaughter.
But I do not want to use the CM mouse trigger.
I want to record the position of the hero when the player presses [ key and teleport the hero to this position when player press ].
and I found the function !?FU77003 can be the trigger in the ERM help. It also says I could use the function getGameState to determine the current window. But how to use the getGameState function?
Thanks.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 29, 2015 01:18 PM |
|
|
For example, from "TEW4" mod:
!?FU77003;
!!SN:L^Era.dll^/?y1 Ay1/^GetGameState^/?y2 Ey2/1/?y98;
!!FU&y99<>6053040:E; exit if not town screen
You can find similar example all over the mods released.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 29, 2015 01:22 PM |
|
|
Hero_Of_Light said: !?BA0&1000; is a trigger you gave me for other functions as well, do you thing there might be a problem there?
Can something else be used? Like !?BA0&998; or something?
If triggers are correctly scripted and organized, there is no risk to have multiple actions for one trigger, this is what programming does. In fact, most of the time you don't have the choice and the best way is to use a single trigger. Timer 2 (in wog core scripts) is the trigger for probably more than one thousand actions and it works okay, no reason to bug.
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted November 29, 2015 01:57 PM |
|
|
OK then, I'll run some test and then I'll see what I will do. To be honest I don't know if I am going to use this, since the Sword of Frost is one of the unused WoG artifacts in my mod and it will only appear in a scenario If its placed in map editor. So I don't think it will come up that much.
I think the solution you gave me earlier with the trigger event is more elegant. It's good to know it works though... I may use it in the future. Thanks a lot!
____________
Not idly do the leaves of Lorien fall.
|
|
XEricSin
Famous Hero
|
posted November 29, 2015 02:23 PM |
|
|
Salamandre said: For example, from "TEW4" mod:
!?FU77003;
!!SN:L^Era.dll^/?y1 Ay1/^GetGameState^/?y2 Ey2/1/?y98;
!!FU&y99<>6053040:E; exit if not town screen
You can find similar example all over the mods released.
I guess y98 stores the value of game state.
and y99 is a typo, it should be y98?
and is there a list that I can refer to to find out the value for different game state?
Thanks.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 29, 2015 02:55 PM |
|
|
No, it is y99, try it. As for the list, there isn't any, just use the script above to get all values when pressing a key.
|
|
XEricSin
Famous Hero
|
posted November 29, 2015 03:37 PM |
|
|
Salamandre said: No, it is y99, try it. As for the list, there isn't any, just use the script above to get all values when pressing a key.
Ok.
but if I want to only activate the trigger when window is the adventure map (not town, not battle,not others). How can I set the condition (y99<>?)?
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 29, 2015 03:49 PM |
|
|
Just get the game state with debug message, note down its value then use it as condition.
!?FU77003; when press a key
!!SN:L^Era.dll^/?y1 Ay1/^GetGameState^/?y2 Ey2/1/?y98;
!!IF:M^ game state is %Y99^;
!!FU&y99<>[...]:E; exit if not the window you want.
____________
Era II mods and utilities
|
|
XEricSin
Famous Hero
|
posted November 29, 2015 04:36 PM |
|
|
Salamandre said: Just get the game state with debug message, note down its value then use it as condition.
!?FU77003; when press a key
!!SN:L^Era.dll^/?y1 Ay1/^GetGameState^/?y2 Ey2/1/?y98;
!!IF:M^ game state is %Y99^;
!!FU&y99<>[...]:E; exit if not the window you want.
Great. Thanks a lot.
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted December 04, 2015 03:31 PM |
|
|
I've been modding the original Heroes III campaigns to work with my mod. So far the progress is great!
The new creatures and town lineups appear in the original campaigns. Furthermore, now the campaign's difficult can be set as you wish. I've been playing RoE campaigns in Impossible and let me tell you that they are way harder than you might think! And it is nice to be able to score Archangel in Long Live the Queen etc.
While everything worked smoothly, there are a few minor setbacks. These seem hardcoded though, as I don't know any other possible way to solve these.
1) In RoE maps, Air, Fire, Water and Earth Elementals are set to neutral and not Conflux. I am guessing that since Conflux didn't appear till Armageddon's Blade, the Elementals where set to neutral even If these commands are present.
!!MA:O112/8; [Conflux]
!!MA:O113/8; [Conflux]
!!MA:O114/8; [Conflux]
!!MA:O115/8; [Conflux]
Is there a way to fix this? I've set the campaigns' scenarios to Wake of Gods. It is weird, because since I saved them as wake of Gods maps, I could actually add Phoenixes in RoE campaigns. But still, the Elementals remain Neutral.
2) Also, I was wondering if it is possible to add the damage dealt by citadels in the RoE campaigns. I know this was added later on as a feature, but I think it would be nice to make it work in all of the campaigns (as IF it was a feature that was always there).
These bugs are no big deal. The fact that the original campaigns are playable in my mod is way more important. I was just wondering if there's a way to change these two features (either with an ERA command or a Plugin.
____________
Not idly do the leaves of Lorien fall.
|
|
|