|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted August 23, 2012 03:37 PM |
|
|
Well I was playing H4 and I was thinking to implement yet another feature from H4 in my mod:
Satyrs (creature 192) cast Mirth
Leprechauns (creature 173) cast Fortune
I want it to be like the Elementals casting Protection spells. That means normal attack should be allowed as well.
____________
Not idly do the leaves of Lorien fall.
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 23, 2012 03:42 PM |
|
|
So it would just be like x% of the time they cast their spell?
I think this is even easier than I thought. Wouldn't you just use EA with either J or j and choose your percentage per level...?
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted August 23, 2012 03:49 PM |
|
|
No that's not what I meant. I meant to give them the ability to cast 3 times Mirth or Fortune per battle. Just like Storm Elementals cast protection from Air in battle. The number of casting times is found in ZCRTRAITS.txt file, I know how to edit that one.
With EA but then it will not be the same. It won't be instead of attacking.
____________
Not idly do the leaves of Lorien fall.
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 23, 2012 03:55 PM |
|
|
Ah ok I misunderstood you. Thought you meant by 'normal attacking should still be allowed' that they would do it and attack. You just want a basic creature that can cast. Gotcha. I'll see what I can do when I have a spare moment, but you can code it like this (pseudo code):
MM0 trigger
get position of mouse
get stack at position
make sure currents stack has enough spells left
if friendly and current stack is satyr, change to spell cursor
change hint text to 'cast mirth' or whatever
perhaps set some flag
CM trigger (and maybe that flag)
disable standard reaction (maybe not needed)
cast the spell on that creature
add battlelog message if wanted
stack done for the round
decrease stack spell count by 1
So something like that.
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted August 23, 2012 08:16 PM |
|
|
OK I see it needs a lot of work and most importantly battle triggers and that's a little too complicated for my taste. I was hoping there was a pattern already done (like the shooting creatures script) and it only needed to tweak the parameters at your taste.
No big deal though, it's not that important to add these abilities anyways...
____________
Not idly do the leaves of Lorien fall.
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 23, 2012 11:10 PM |
|
Edited by kegolo at 23:10, 23 Aug 2012.
|
Hopefully this isn't too many lines for you to handle. This makes creature 192 cast mirth on a friendly creature. The three lines you will have to change for leps I put a star next to. Having them both means you will also need to change up flag 444 to some other flag. Enjoy and ask if you don't understand (pretty basic though, almost exactly followed what I said needed to be done).
!?MM0;
!!IF:V444/0;
!!SN:X?y1/?y2/?y3/?y4; get parameters
!!MM:D?i; !!BMy1:T?y5; !!FU&y5<>192:E; !!FU|i>186/i<0:E;*192 for satyr
!!BMy1:I?y3;
!!BU:Ei/?y2; !!FU&y2=-1:E;
!!BMy2:I?y4; !!FU&y3<>y4:E;
!!BMy1:E?y3; !!FU&y3<1:E;
!!UN:R5/3/1; !!IF:V444/1;
!!VRz1:S^Cast Mirth^; !!MM:Mz1; *spell name hint
!?CM4&444;
!!CM:D?y1;
!!BU:Ey1/?y2;
!!BMy2:M49/3/2; !!BMy2:V20; *cast spell 49 for 3 turns at advanced lvl, show the spell animation
!!BG:N?y3; !!BMy3:Ed-1;
!!BG:A12;
!!CM:R0;
!!IF:V444/0;
|
|
Hero_Of_Light
Responsible
Supreme Hero
|
posted August 23, 2012 11:46 PM |
|
|
Thank you, it seems to work OK although it seems weird for some reasons:
-> The creature can cast it on itself (something that doesn't happen with other casting creatures)
-> The spell is cast without a sound
-> The Satyrs don't really do anything (when a creature casts a spell it uses the melee attack animation).
What I am saying is that although you get the same result it seems kind of unnatural (and like the game has a glitch or something).
I was hopping that the script gives the exact same function as the original creatures casting spells does. I do appreciate your help though and thanks again
P.S.: Just for future reference how can you add additional casters with this script? For instance how would I add a spell for the leprechauns? Would I just copy paste the script again (and change variables) or is there a way to implement the additional spellcaster on the same trigger?
____________
Not idly do the leaves of Lorien fall.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted August 24, 2012 01:15 AM |
|
|
I said it is difficult.
Applying spell with BM:M is just work around, make it work as genies do is another thing.
____________
Era II mods and utilities
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 24, 2012 05:58 AM |
|
Edited by kegolo at 06:39, 24 Aug 2012.
|
fixt. Uses flags 444,445 and v445.
!?MM0;
!!IF:V444/0;
!!SN:X?y1/?y2/?y3/?y4; get parameters
!!MM:D?i; !!BMy1:T?y5; !!FU&y5<>192:E; !!FU|i>186/i<0:E;
!!BMy1:I?y3;
!!BU:Ei/?y2; !!FU&y2=-1:E;
!!BMy2:I?y4; !!FU|y3<>y4/y1=y2:E;
!!BMy1:E?y3; !!FU&y3<1:E;
!!UN:R5/3/1; !!IF:V444/1;
!!VRz1:S^Cast Mirth^; !!MM:Mz1;
!?CM4&444;
!!CM:R0;
!!BG:S49;
!!CM:D?y1;
!!BU:Ey1/?v445;
!!BMy2:M49/3/2; !!BG:A10;
!!BG:N?y3; !!BMy3:Ed-1;
!!IF:V445/1;
!!IF:V444/0;
!?BG1&445;
!!VRz1:S^Mirth^; !!SS49:Wz1; !!SN:Pz1;
!!BMv445:V20;
!!IF:V445/0;
@Salamandre: Making it like genies would only be like 4 or 5 more lines right? Just an array that holds all the numbers for possible spells, then choose an index randomly...reset it each round.
|
|
Salamandre
Admirable
Omnipresent Hero
Wog refugee
|
posted August 24, 2012 08:15 AM |
|
|
I have no idea. It seems to me necessary to work directly in memory, much more checks are needed, like immunities, tactics phase, terrain, artefacts wielded and how AI will use it. For a custom scenario is good if only human, but for whole mod if AI can't have it it will be unbalanced.
____________
Era II mods and utilities
|
|
Bersy
Honorable
Supreme Hero
|
posted August 24, 2012 02:30 PM |
|
|
I already posted the code here to check the resistance to spell for a particular stack. That should be enough.
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 24, 2012 09:37 PM |
|
|
Probably the easiest thing to do for AI I would think is check if they defend, and if so, make them cast instead. Usually I would think casting is better than defending as long as it lasts more than a turn, especially a fairly good spell like mirth.
Bersey there must be a table that holds which creatures are casters, one that the WoG team knew about because commanders can cast, if it's findable it would be great to know.
|
|
OxFEA
Promising
Famous Hero
feanor on DF2.ru
|
posted August 24, 2012 11:21 PM |
|
|
I write about it one time (:
You can see adresses in amethyst sources.
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 25, 2012 12:05 AM |
|
Edited by kegolo at 00:05, 25 Aug 2012.
|
Link to thread where you wrote about it, or amethyst sources? (I don't think you mentioned it in your amethyst thread)
|
|
Bersy
Honorable
Supreme Hero
|
posted August 25, 2012 01:10 AM |
|
|
AI uses such magic stupidly, at least for commanders.
|
|
OxFEA
Promising
Famous Hero
feanor on DF2.ru
|
posted August 25, 2012 02:22 AM |
|
|
Quote:
AI uses such magic stupidly, at least for commanders.
AFAIK, commanders casting is badly done: AI uses wrong spell id when possibility of casting calculated.
|
|
Homer171
Promising
Supreme Hero
|
posted August 25, 2012 03:35 PM |
|
|
Hey, what is the code for 3rd upgrade or alternative upgrade? I tried to copy some lines from HoL 3 to make own script for ERA but no luck. How to do it?
And what about 3rd creature dwelling upgrade in town?
So if i would like my Steel Golems upgradable to Gold Golems what is the script?
|
|
kegolo
Promising
Famous Hero
of infamy
|
posted August 25, 2012 05:46 PM |
|
Edited by kegolo at 17:46, 25 Aug 2012.
|
!#MA:U33/116;
The dwelling one requires more work, but the actual line that is needed is
!!CA-1:D2/2/116/$;
where $ is the number of gold golems (I assumed you wanted it for foundry third slot). However you can only put that when inside the town, and the growth is sadly no linked to the growth of the regular golems, so if you buy a regular it won't decrease the gold golem count and vice versa. Don't try to run before you can walk. Try this to start (but I am sure it will be buggy):
!?CM1;
!!CA-1: T?y1 B3/39 M1/2/d/?y2; !!FU|y1<>2/-1:E;
!!CA-1:D2/2/116/y2;
|
|
Bersy
Honorable
Supreme Hero
|
posted August 27, 2012 06:52 PM |
|
|
Val reminded.
Display DL-dialog while right mouse button is being hold
!?FU70001;
; © GrayFace
x1 - dialog id
x2 = 1 (show dialog)
x2 = 0 (destroy dialog)
!!VRy1:Sv1;
!!SN:E7510739/1/x1; [find HDlg -> v1]
!!VRy2:Sv1; [y2 = HDlg]
!!if&y2<>0:;
!!if&x2<>0:;
!!SN:E5864096/1; [stop animation]
!!UN:Cy2/4/?v1; [v1 = dialog]
!!SN:E6245264/2/v1; [show while holding mouse button]
!!SN:E5864272/1; [continue animation]
!!en:;
!!SN:E7518240/2/y2; [destroy HDlg]
!!en:;
!!VRv1:Sy1;
Usage: instead of DL:S[ID] use !!FU70001:P[ID]/1;
|
|
Rytelier
Hired Hero
|
posted August 31, 2012 12:50 PM |
|
|
Can I place custom objects on map using ERM?
I used: !!UN:I1/1/0/40/100;
Game crashes, when I'm trying to place non custon object, it works good.
I also tried: !!UN:I1/1/0/40/0/40/100;
Still crashes. 40, 100 is a custom object that I made.
And another question: how to check terrain type, when hero is moving?
____________
|
|
|