|
|
JimV
Responsible
Supreme Hero
|
posted November 08, 2011 10:46 PM |
bonus applied by Cepheus on 10 Nov 2011. |
|
Quote: Is there a simple check for the spell [applicability] not many many tests? I think the program sets something to in/out to cast a spell or show able to cast a spell.
That was not many, many tests, only about one page of scripting. Take a look at script 45 or other WoG scripts to see many, many tests (performed successfully).
The test that Heroes performs on a stack for spell applicability occurs when the player has moved the mouse pointer over that stack, after choosing a spell. Possibly you could ask the player to move the cursor over all dead (friendly) stacks on the battlefield, and use the !?MM0 trigger to check the mouse pointer with UN:R5 to see whether it has changed to the spell-cast animation, and if so, add the hex number to a list, then have the player right-click the Cast Spell button to process the list. Otherwise I don't know how you propose to simulate the stack test for all dead stacks (assuming we are still talking about a mass resurrection spell).
By the time you implement that, I think I could write the testing script a few times over.
|
|
gnomes2169
Honorable
Undefeatable Hero
Duke of the Glade
|
posted November 09, 2011 03:32 AM |
|
|
This is from Robb... Here you go.
Quote: ZVSE
!#VRz162:S^Clone Warrior^;
!#VRz163:S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163; Archangel
!#VRz154:S^Clone^;
!#VRz155:S^Clone^;
!#UN:G1/19/0/162 G1/13/1/163; Grand Elf
Can u help?
I can't post.
The archangel renames to clone warrior but grand elf doesn't rename to clone.
Thx.
*Leaves discussion forever*
____________
Yeah in the 18th century, two inventions suggested a method of measurement. One won and the other stayed in America.
-Ghost destroying Fred
|
|
Robb
Adventuring Hero
|
posted November 09, 2011 05:07 AM |
|
|
Thanks gnomes.
My newest post!
____________
|
|
gnollking
Supreme Hero
|
posted November 09, 2011 09:26 AM |
|
|
Quote: ZVSE
!#VRz162:S^Clone Warrior^;
!#VRz163:S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163; Archangel
!#VRz154:S^Clone^;
!#VRz155:S^Clone^;
!#UN:G1/19/0/162 G1/13/1/163; Grand Elf
Can u help?
I can't post.
The archangel renames to clone warrior but grand elf doesn't rename to clone.
Thx.
You need to change the correct variables (154 & 155), that contain the new names, and also put the correct correct creature number (19, if you're correct) to the second UN:G. In case you don't understand, here's the working one (I think so, not checked):
Quote: ZVSE
!#VRz162S^Clone Warrior^;
!#VRz163S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163Archangel
!#VRz154:S^Clone^;
!#VRz155:S^Clone^;
!#UN:G1/19/0/154 G1/19/1/155; Grand Elf
____________
|
|
Magissia
Adventuring Hero
|
posted November 09, 2011 12:43 PM |
|
Edited by Magissia at 21:38, 09 Nov 2011.
|
Quote: !#UN:G1/13/0/162 G1/13/1/163;Archangel
Forgot semi colon !.
____________
My works
|
|
ceken4
Hired Hero
|
posted November 09, 2011 02:15 PM |
|
|
HI!
I have an idea for mass resurrections. I write a function without use
resurrection spell, but I do not know how can revive a dead stack (number in stack if 0). If a stack has no creatures because they died is the alive bit set to 1 or 0?
|
|
JimV
Responsible
Supreme Hero
|
posted November 09, 2011 03:48 PM |
|
|
[quoteIf a stack has no creatures because they died is the alive bit set to 1 or 0?
If you are asking about the "alive" flag bit (16), that designates a type of creature, not the status of a troop. If a creature is not undead (e.g., skeleton, wraith, etc.), not an elemental (e.g., air elemental, water elemental, etc.), not a golem, and not a gargoyle, then it is alive. Only alive creatures can be resurrected by the Resurrection spell, i.e., only dead "alive" creatures can be resurrected.
It would be good ERM practice to check all these claims in a test map: give a Hero various troops and write a script to show their value of bit value 16 (with MA:X) when they are right-clicked on in the Hero screen. Also, in battle a similar check could be made using BM:F.
Note: another complication for your script which I forgot to mention earlier is that two or more dead stacks may be on the same hex.
|
|
Robb
Adventuring Hero
|
posted November 09, 2011 03:54 PM |
|
Edited by Robb at 17:10, 09 Nov 2011.
|
Quote:
Quote: !#UN:G1/13/0/162 G1/13/1/163;Archangel
Forgot semi colon !
Um, no.
Look right before archangel.
Quote:
Quote: ZVSE
!#VRz162:S^Clone Warrior^;
!#VRz163:S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163; Archangel
!#VRz154:S^Clone^;
!#VRz155:S^Clone^;
!#UN:G1/19/0/162 G1/13/1/163; Grand Elf
Can u help?
I can't post.
The archangel renames to clone warrior but grand elf doesn't rename to clone.
Thx.
You need to change the correct variables (154 & 155), that contain the new names, and also put the correct correct creature number (19, if you're correct) to the second UN:G. In case you don't understand, here's the working one (I think so, not checked):
Quote: ZVSE
!#VRz162S^Clone Warrior^;
!#VRz163S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163Archangel
!#VRz154:S^Clone^;
!#VRz155:S^Clone^;
!#UN:G1/19/0/154 G1/19/1/155; Grand Elf
Well, if I hover my mouse over the grand elf it renames to clone.
Archangel renames to clone warrior.
But if I right click on them...
Grand elf is still grand elf.
Archangel is clone?
Edit : Well this isn't fixed but I tried something else.
Archer upgrading to grand elf(or supposely clone)
The script isn't working :
!!UN:T0/1/0/2 T0/1/1/19; [L2 archer, L2 Upgr. Grand Elf]
Edit : Fixed :
ZVSE
!?PI;
!!UN:T0/1/0/2 T0/1/1/19; [L2 archer, L2 Upgr. GrandElf]
Edit :
Pike man to crusader.
Archer to Grand Elf.
Archer to Arctic Sharpshooter.
I'm going to change the archer that upgrades to AS a sharshooter instead.
Edit : Why does the Archangel rename itself anybody?
It was Clone Warrior, which is good, then it is Clone, and now it is clone infantry!
P.S Clone infantry are Crusaders.
____________
|
|
ceken4
Hired Hero
|
posted November 09, 2011 09:40 PM |
|
|
I did it!
Calculating again a hp for all alive stack. Calculating new hp and lost of monsters. Give hp and monsters for all stacks what has alive bit set 1.
It is working but dead stack do not live againg and not active only has corps.
How can I say them to be live again (the number of monsters is stetting bigger than 0)
How can I redraw the battlefield fully (BU:R not working good for me, status line is same like in map screen).
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 09, 2011 09:54 PM |
|
|
The problem with such scripts is that if your creatures or enemy creatures stay on a dead corpse or two died in same spot, game will crash. Test it carefully before crying victory.
____________
Era II mods and utilities
|
|
Robb
Adventuring Hero
|
posted November 09, 2011 09:59 PM |
|
|
I tried ERM again and not renamng?
ZVSE
!#VRz162:S^Clone Warrior^;
!#VRz163:S^Clone Warrior^;
!#UN:G1/13/0/162 G1/13/1/163; Archangel
!#VRz152:S^Clone^;
!#VRz153:S^Clone^;
!#UN:G1/19/0/152 G1/13/1/153; Grand Elf
!#VRz150:S^Clone Infantry^;
!#VRz151:S^Clone Infantry^;
!#UN:G1/13/0/150 G1/13/1/151; Crusader
____________
|
|
JimV
Responsible
Supreme Hero
|
posted November 09, 2011 11:13 PM |
|
|
Quote: I did it!
Calculating again a hp for all alive stack. Calculating new hp and lost of monsters. Give hp and monsters for all stacks what has alive bit set 1.
It is working but dead stack do not live againg and not active only has corps.
How can I say them to be live again (the number of monsters is stetting bigger than 0)(*a)
How can I redraw the battlefield fully (BU:R not working good for me, status line is same like in map screen).(*b)
Well, I give you credit for trying, but not for paying attention to what others tell you. My final answers:
a) You can resurrect inactive stacks if they are alive-type creatures with the Resurrection spell, or re-animate inactive undead stacks with the Animate Dead spell. Otherwise the Heroes program will not know they are active stacks.
b) BU:R works for me , unless I have done something which screws up the Heroes program. Certain commands, such as HE:I, may need a /1 on the end to prevent an attempt to redraw the status lines. See ERM Help.
The types of creatures which can be resurrected in Heroes are as follows (to repeat myself):
There is a flag bit (16) which is set for creatures which are alive, i.e., not undead, not elementals, not golems, and not gargoyles. It can be checked with BM:F. That will eliminate most invalid creatures, but not Gold, Black, Diamond, or Darkness Dragons. Those could be checked for using creature type, BM:T.
In WoG, creatures can also have magic immunity which is experience-based (EA:B). These could be checked for using the EA(-#n-1):F and EA(-#n-1):B? commands. Actually, a Dragon might get Receptivity (no immunity to beneficial spells), so that could be checked for also.
Presence of the Orb of Vulnerability will eliminate natural immunities, but not experience-based immunities.
The Power of the Dragon Father which should be checked for, as it will prevent all spells except for 5th level spells. Also Cursed Ground, the Recanter's Cloak, and the Orb of Inhibition
You must also check that there is not an active stack (resurrected previous to the current stack) on the hex where you want to resurrect an inactive stack.
All these checks can be done in about a page of ERM script. Once you have a check for the Power of the Dragon Father, you can simply copy and paste that command and quickly change it into tests for the other artifacts, so the script should not take long to write - perhaps an hour. To keep yourself motivated, you can add tests a few at a time, then run the script in a test map under conditions in which only those tests are necessary. You should look up each command in the ERM Help as you use it.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 09, 2011 11:18 PM |
|
|
Quote: but not Gold, Black, Diamond, or Darkness Dragons. Those could be checked for using creature type, BM:T.
Isn't a specific flag to check those as well? (-2147483648)
____________
Era II mods and utilities
|
|
JimV
Responsible
Supreme Hero
|
posted November 10, 2011 12:05 AM |
|
Edited by JimV at 00:06, 10 Nov 2011.
|
I think that flag also applies to Azure Dragons, Rust Dragons, etc., which don't have natural immunity to Resurrection.
One last thought: if the intention is to circumvent the normal rules of Heroes 3 with the "mass resurrection" spell (I got this impression from the fact that checking the bit-value 16 flag only would apply the script to Black Dragons), then the simplest thing to do is to summon new creatures of the same type, number, and troop slot on top of the dead stacks using the BU:S summon command. There would still have to be a check for no active stack on the dead stack's hex, and the stack experience would have to be copied from the dead stack. (Any War Banner the dead stack had would be transferred to the Hero's backpack unless the script managed this also.)
Using this method, all creature types - Magic Elementals, Vampires, etc. - would be "resurrected".
|
|
Magissia
Adventuring Hero
|
posted November 10, 2011 03:01 AM |
|
Edited by Magissia at 03:04, 10 Nov 2011.
|
Salamander, i tested your script, it works, but not completly : if i win any fight, it will give the garisson to the winner, i had to add a position check, since you are forced to be on a given square when attacking the castle, it did the trick.
Here is the result
ZVSE
!?BA1; After fight
!!HE-1:P?y2/?y3/?y4; Check winner pos
!!HE-1:O?y1; Check who won
!!FU&y1<0:E; Execute if hero exist
!!GR93/112/1&y2=98/y3=114/y4=1:Oy1; Change owner if the winner was in front of the castle
!!UN:R1; Refresh screen
Thanks you for your precious help Salamandre
____________
My works
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted November 10, 2011 11:18 AM |
|
|
I said that you have to flag the battle position. I don't have your map, the coordinates etc. Of course it will change the garrison at each combat if you take it as it is.
That is all you had to do:
!?BA1&v998=99/v999=113/v1000=1; (assuming from previous page post that castle is at 99/113/1)
____________
Era II mods and utilities
|
|
Magissia
Adventuring Hero
|
posted November 10, 2011 01:25 PM |
|
|
|
mister_kalu
Known Hero
|
posted November 11, 2011 02:49 AM |
|
|
hello, i have a question that not allow me to progress, if exemplified perhaps you have a better understood.
you have 1 monster in battlefield and your opponent have 1 undead.
When you try to cast curse spell, the game throws the typical message: this spell will not...
example 2
you have 1 monster in battlefield and your opponent have 1 monster with a spell on it(frenzy, slow, stone skin). When you try to cast dispel magic with basic water magic or not water magic, the game throws the typical message: this spell will not...
so my question is, is possible to do changes between click on spell and that message?
for example in the first case.. change the undead to alive, to cast curse on it
!?CM4 ????
|
|
JimV
Responsible
Supreme Hero
|
posted November 11, 2011 03:43 AM |
|
Edited by JimV at 12:52, 11 Nov 2011.
|
Yes, I believe that is possible. See the BG command in ERM Help, and the !?BG0 trigger.
BG0 will be triggered once an action has been decided upon and is about to be implemented. For example, after you have selected the Curse spell and you click on the undead stack to try to cast Curse on it, at that point BG0 will be triggered.
Then using BG:A? you can get the type of action (exit unless the action is Hero casts spell). For a Hero cast, you can get the spell number with BG:S? (exit if it is not Curse). With BF:E? you can get the target stack number. Using that number, BM(stack number):?F will give you the bit flags for the target stack, and bit-value 16 (see MA:X) will tell you whether the stack is the "alive" type (not undead, not an elemental, not a golem, and not a gargoyle - I forget whether the Crystal Dragon is alive, but you can check in a test map; "alive" creatures are those which can be resurrected - unless they are immune to the spell, such as Black Dragons). I think - haven't tested - that changing the bit from 0 to 1 with VR:|16 might allow you to curse an undead. If you need to know for certain that the target is an undead rather than, say, a golem, you could use the creature type, BM:T. Better restore the original bit-value after the action under !?BG1, or, for example, an enemy Hero might try to cast Animate Dead on the stack after it is killed and possibly produce a crash.
If the Curse spell still does not work, you could use a different approach: cancel the action with BG:A and simulate it by making the creature's maximum damage equal to its minimum damage (BM:U), and applying the Curse animation to the stack (BM:V) and subtracting the appropriate spell points (mana) from the casting Hero (HE:I). That would be safer (less apt to cause a problem).
In general there is a round-about way to do almost anything in ERM, but usually it requires a combination of steps involving tests, decisions, and getting and setting of data. Reading ERM Help will give you the tools to accomplish those steps. That is how I learned the above information.
Update - Bad idea! Heroes will not allow the invalid action to be initiated, and therefore BG0 will not trigger. See later post.
|
|
mister_kalu
Known Hero
|
posted November 11, 2011 03:59 AM |
|
|
When you try this tactic on a battle with a "one" monster (the only monster in the opositte side), and the spell doesn't work normally ( curse on undead, basic dispel magic on hostile creatures, mind spell on titans),
are you sure that these tactics works?
doesn't work for me
at least the first method, the artificial curse maybe yes but when you cancel the action, the hero can cast a spell again.. and if you take A12: "no action" and make artificial spell, it works but the current stack loses his turn
|
|
|
|