Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: New Spells Plugin, The
Thread: New Spells Plugin, The This thread is 13 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 · «PREV / NEXT»
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 30, 2022 12:33 PM

A temporary solution

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted March 30, 2022 05:02 PM
Edited by Szaman at 17:05, 30 Mar 2022.

As promise, here is one spell:
Hour of Power

It has everything, even sounds files

Description: Casting this spell gives a selected unit a temporary increase power and vitality. Does not work for the undead.

....

Originally i wanted this spell to be combined power of Bless, Bloodlust, Precision, Fortune and slayer to one (all experts lvl) plus it gives 50% more HP to selected unit (a counter spell for age). Last 1-3 turns.

My inspiration come from the MM6-8 series but in Heroes 3 there is no "light magic". So my thought is to make it a lvl 5 water magic.




 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 30, 2022 08:41 PM

There is already a similar spell called Toughness in the plugin, so it would be confusing to stack both spells. Also there is no small picture representing effect in the package.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fanofheroes
fanofheroes


Famous Hero
posted March 30, 2022 08:48 PM

That would be a cool spell if you could send an enemy player back in time to the creatures, town development, explored map, and hero development they had say a few days ago.  Since the image is an hourglass.  And on expert level, you can send all opponents back in time!!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 30, 2022 09:00 PM

This is possible but wouldn't it be the most powerful spell in the game?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
fanofheroes
fanofheroes


Famous Hero
posted March 30, 2022 09:28 PM

AlexSpl said:
This is possible but wouldn't it be the most powerful spell in the game?



It would most definitely be!! hahah maybe in combination with an artifact or hero level.  this would also piss off a lot of players in the multiplayer hahahah!!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted March 31, 2022 12:49 AM
Edited by Szaman at 00:55, 31 Mar 2022.

AlexSpl said:
There is already a similar spell called Toughness in the plugin, so it would be confusing to stack both spells...


I know about Toughness spell (gives 25% more hp?), would it some how collided/broke the game if the player would cast Toughness and Hour of power? I'm aware that both spells would make a OP unit (75% more HP)
But somehow that the point. Spell Age is also quiet OP (and that of course a good thing), and we need some "counter spell" for that, and my Hour of Power would a counter for that.

Eventually i can think something different than 50% more hp, maybe 50% chances to block enemy spell? I'm open to suggestions.

AlexSpl said:
...Also there is no small picture representing effect in the package.


Sorry, my bad... do you need just the BMP file or Def?
Here are both.

-------------

Little offtop:
Would be great if you manage to translate your tutorial from Russian to English and give a example spell how you make it. That way i could make myself everything.

Basically, you are doing the hard work now and if i could gain that knowledge there would be two us with the power to add new spells

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Liso1
Liso1


Known Hero
posted March 31, 2022 09:00 AM

AlexSpl said:
A temporary solution


I searched but didn't notice it, thank you, I added this information to the video as well https://youtu.be/tuXI7zJufy0
____________
Heroes 3 Wake of Gods Portal

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 31, 2022 01:55 PM
Edited by AlexSpl at 17:03, 31 Mar 2022.

Quote:
I know about Toughness spell (gives 25% more hp?), would it some how collided/broke the game if the player would cast Toughness and Hour of power? I'm aware that both spells would make a OP unit (75% more HP)

Toughness increases unit's health by 30%/40%/50% at Basic/Advanced/Expert Water Magic. Hour of Power can also be added, just additional work is needed to "befriend" it with the spells altering unit's health already (Age, Poison, and Toughness). This means you will have to add an additional case to the code of each of them. I can do it, of course, but it won't feel as a unique spell.

Quote:
Would be great if you manage to translate your tutorial from Russian to English and give a example spell how you make it. That way i could make myself everything.

Try to use Google Translate. I don't think I have a wish to write it all again And, after all, it's just an example that works with my old source code (btw, do you have it?). Later I will release a new version of the plugin with new source code which will be slightly different. Maybe then I will update that guide, but basic steps will be unchanged for certain.

Try this link to the translated page. I think it's a good translation. You can ask me if you don't follow something, of course.

Quote:
Eventually i can think something different than 50% more hp, maybe 50% chances to block enemy spell? I'm open to suggestions.

Anything you think would be appropriate while we haven't reached the first soft limit of 96* spells, eliminating which will need rewriting the code working with bitsets in one or two functions. The next soft limit is 128 spells, and with some extra work it's possible to have almost unlimited number of spells (don't know about limitations of code working with defs though, but I'm sure it's not a problem either).

*) I don't remember exactly if I fixed it already

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted March 31, 2022 05:04 PM

OK... then lets go As a example i take the Toughness spell

; Spell #90<---Spell number, number can be random? but can't repeat it self?
[Toughness]<---Spell name
<Enabled> = 1<---Spell in Enable if "1", disable if "0"?
<Type> = 1<--- Type? What those that mean?
<Sound.FileName> = "Sysmsg.wav"<--File sound name, and it must be always "wav" format?
<Animation.ID> = 86<--Animation number, like spell number it can be a custom number, but can't repeat it self.
; SF_AI_NON_DAMAGE_SPELL(NOT A DAMAGE SPELL)|SF_NOT_AT_WAR_MACHINE(CAN'T BE CASTED ON AMMO CRATE/BALLISTA/CATAPULT)|SF_SINGLE_TARGET|SF_TIME_SCALE(WHAT IS THIS?)|SF_BATTLE_SPELL(ITS A COMBAT SPELL)
<Attributes> = 266261<---(What is it?)
<Level> = 4<---(its a lvl 4 spell)
<School.Earth> = 0<--(its not a earth magic)
<School.Water> = 1<--(its a water magic)
<School.Fire> = 0<--(its not a fire magic)
<School.Air> = 0<--(its not a air magic)
<Cost.None> = 20<--(cost 20 SP if you don't know this magic)
<Cost.Basic> = 16<--(cost 16 SP if you know this magic on basic)
<Cost.Advanced> = 16<--(cost 16 SP if you know this magic on advanced)
<Cost.Expert> = 16<--(cost 16 SP if you know this magic on expert)
<Effect.Power> = 0<--(What is this? what power?)
<Effect.None> = 130<--(What is this? what effect none?)
<Effect.Basic> = 130<--(What is this? what effect basic?)
<Effect.Advanced> = 140<--(What is this? what effect advanced?)
<Effect.Expert> = 150<--(What is this? what effect expert?)
<ChanceToGain.Castle> = 10<--(this is easy, chances of getting the spell in town, but what is the max value? 0=sorry bro, not in this town)
<ChanceToGain.Rampart> = 10
<ChanceToGain.Tower> = 10
<ChanceToGain.Inferno> = 10
<ChanceToGain.Necropolis> = 10
<ChanceToGain.Dungeon> = 10
<ChanceToGain.Stronghold> = 0
<ChanceToGain.Fortress> = 0
<ChanceToGain.Conflux> = 5
<AIValue.None> = 20<--(AIValue? what is it?)
<AIValue.Basic> = 20<--(AIValue? what is it?)
<AIValue.Advanced> = 40<--(AIValue? what is it?)
<AIValue.Expert> = 60<--(AIValue? what is it?)
<ForceCappedDuration> = 0<--(ForceCappedDuration what is it?)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 31, 2022 05:17 PM

Quote:
; Spell #90<---Spell number, number can be random? but can't repeat it self?
[Toughness]<---Spell name
<Enabled> = 1<---Spell in Enable if "1", disable if "0"?
<Type> = 1<--- Type? What those that mean?
<Sound.FileName> = "Sysmsg.wav"<--File sound name, and it must be always "wav" format?
<Animation.ID> = 86<--Animation number, like spell number it can be a custom number, but can't repeat it self.
; SF_AI_NON_DAMAGE_SPELL(NOT A DAMAGE SPELL)|SF_NOT_AT_WAR_MACHINE(CAN'T BE CASTED ON AMMO CRATE/BALLISTA/CATAPULT)|SF_SINGLE_TARGET|SF_TIME_SCALE(WHAT IS THIS?)|SF_BATTLE_SPELL(ITS A COMBAT SPELL)
<Attributes> = 266261<---(What is it?)
<Level> = 4<---(its a lvl 4 spell)
<School.Earth> = 0<--(its not a earth magic)
<School.Water> = 1<--(its a water magic)
<School.Fire> = 0<--(its not a fire magic)
<School.Air> = 0<--(its not a air magic)
<Cost.None> = 20<--(cost 20 SP if you don't know this magic)
<Cost.Basic> = 16<--(cost 16 SP if you know this magic on basic)
<Cost.Advanced> = 16<--(cost 16 SP if you know this magic on advanced)
<Cost.Expert> = 16<--(cost 16 SP if you know this magic on expert)
<Effect.Power> = 0<--(What is this? what power?)
<Effect.None> = 130<--(What is this? what effect none?)
<Effect.Basic> = 130<--(What is this? what effect basic?)
<Effect.Advanced> = 140<--(What is this? what effect advanced?)
<Effect.Expert> = 150<--(What is this? what effect expert?)
<ChanceToGain.Castle> = 10<--(this is easy, chances of getting the spell in town, but what is the max value? 0=sorry bro, not in this town)
<ChanceToGain.Rampart> = 10
<ChanceToGain.Tower> = 10
<ChanceToGain.Inferno> = 10
<ChanceToGain.Necropolis> = 10
<ChanceToGain.Dungeon> = 10
<ChanceToGain.Stronghold> = 0
<ChanceToGain.Fortress> = 0
<ChanceToGain.Conflux> = 5
<AIValue.None> = 20<--(AIValue? what is it?)
<AIValue.Basic> = 20<--(AIValue? what is it?)
<AIValue.Advanced> = 40<--(AIValue? what is it?)
<AIValue.Expert> = 60<--(AIValue? what is it?)
<ForceCappedDuration> = 0<--(ForceCappedDuration what is it?)

Lines starting from ";" symbol are comments and for reference purposes only.

<Type>. 1 = on ally, -1 = on enemy, 0 = area/summoning/adventure spell

<Sound.FileName>. I guess you have to use wavs, but if your engine supports different sound formats, then you can use them.

<Attributes>. For example, 266261. It is sum of spell flags in decimal (see ERM help for more details).

<Effect>, <AIValue>. Values for spell formulas/AI estimates, see sptraits.txt to understand what those values are for the original spells.

<ForceCappedDuration>. You can cap a spell duration by entering here a certain number of rounds (for example, 3 for Bloodlust).

Other guesses are correct.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 31, 2022 06:00 PM

Just in case you cannot find spell flags -

enum FSpellFlags
{
 SF_BATTLE_SPELL = 0x1,
 SF_MAP_SPELL = 0x2,
 SF_TIME_SCALE = 0x4,
 SF_CREATURE_SPELL = 0x8,
 SF_SINGLE_TARGET = 0x10,
 SF_SINGLE_SHOOTING_STACK = 0x20,
 SF_EXPERT_MASS_VERSION = 0x40,
 SF_TARGET_ANYWHERE = 0x80,
 SF_REMOVE_OBSTACLE = 0x100,
 SF_DAMAGE_SPELL = 0x200,
 SF_MIND_SPELL = 0x400,
 SF_FRIENDLY_MASS = 0x800,
 SF_NOT_AT_WAR_MACHINE = 0x1000,
 SF_SPELL_FROM_ARTIFACT = 0x2000,
 SF_DEFENSIVE = 0x4000,
 SF_AI_DAMAGE_SPELL = 0x8000,
 SF_AI_AREA_EFFECT = 0x10000,
 SF_AI_MASS_DAMAGESPELL = 0x20000,
 SF_AI_NON_DAMAGE_SPELL = 0x40000,
 SF_AI_CREATURES = 0x80000,
 SF_AI_ADVENTUREMAP = 0x100000,
};


Choose what attributes your spell will have, sum the corresponding values and convert the sum to a decimal number.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted March 31, 2022 06:24 PM
Edited by Szaman at 18:39, 31 Mar 2022.

<Effect.Power>
hmm... lets see.. i have checked the sptraits.txt.

Notice that spells that are not "damage spells" like quicksand/bless/curse have "0" value. Basically those spells don't do any damage at all. So "blessing/curses" spells will always have "0"

Next...

Magic Arrow. There is "10" so... the "base damage" is "10". Hero with 0 power poitns and no school will do 10 poitns of damage, the damage increase per power point, so... 10 power poitns= 100 dmg if no school or basic, with advanced/expert school the "base damage is increase by 20/30".

Example:

Hero:
0 power points, no school=10 dmg
10 power points, no school=100 dmg
0 power poits, advanced magic school=20 dmg
10 power poits,expert magic school=300 dmg

That explains "<Effect.Power>".

----------------

<AIValue> the sptraits.txt, does't explain anaything about the <AIValue> in magic arrow spell there are always "10". Bigger the value the AI uses the spell more afficent or more frequently?

----------------
<ForceCappedDuration> So if will put a number "3" that means the spell will last only 3 turns? or it will multiply with power points?

example:
Hero:
1 power point=6 turns?
2 power points=9 turns?
3 power poitns=12 turns?

-----------------

<Attributes> Is this important? or i can put random numbers here? A example would be nice

-----------------

So my "ini" file looks like this for now.
; Spell #94
[Hour of Power]
<Enabled> = 1
<Type> = 1
<Sound.FileName> = "HourOfPower.wav"
<Animation.ID> = 90
; SF_AI_NON_DAMAGE_SPELL|SF_NOT_AT_WAR_MACHINE|SF_SINGLE_TARGET|SF_TIME_SCALE|SF_BATTLE_SPELL
<Attributes> = ???
<Level> = 5
<School.Earth> = 0
<School.Water> = 1
<School.Fire> = 0
<School.Air> = 0
<Cost.None> = 30
<Cost.Basic> = 25
<Cost.Advanced> = 20
<Cost.Expert> = 17
<Effect.Power> = 0
<Effect.None> = 25
<Effect.Basic> = 50
<Effect.Advanced> = 100
<Effect.Expert> = 200
<ChanceToGain.Castle> = 15
<ChanceToGain.Rampart> = 10
<ChanceToGain.Tower> = 20
<ChanceToGain.Inferno> = 3
<ChanceToGain.Necropolis> = 0
<ChanceToGain.Dungeon> = 5
<ChanceToGain.Stronghold> = 0
<ChanceToGain.Fortress> = 0
<ChanceToGain.Conflux> = 18
<AIValue.None> = ???
<AIValue.Basic> = ???
<AIValue.Advanced> = ???
<AIValue.Expert> = ???
<ForceCappedDuration> = 3

Quote:
Choose what attributes your spell will have, sum the corresponding values and convert the sum to a decimal number.



a example would be nice and how do i do it?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted March 31, 2022 06:44 PM

Quote:
Magic Arrow. There is "10" so... the "base damage" is "10". Hero with 0 power poitns and no school will do 10 poitns of damage, the damage increase per power point, so... 10 power poitns= 100 dmg if no school or basic, with advanced/expert school the "base damage is increase by 20/30".

You can use those fields for your new spells or you may hardcode values for your fomulas. It's up to you to decide. Just mind that you have 5 customizable values which you can use in your formulas. Those 5 are enough for all original spells, but if you are up to something more complex, you may just set them to zero and use own spell parameters in your code.

Quote:
<AIValue> the sptraits.txt, does't explain anaything about the <AIValue> in magic arrow spell there are always "10". Bigger the value the AI uses the spell more afficent or more frequently?

AIValue doesn't change the battle AI behavior, it is used for AI estimates of heroes, map objects, etc. So you can just set them to what you find appropriate, orienting yourself to the original spells' values.

Quote:
<ForceCappedDuration> So if will put a number "3" that means the spell will last only 3 turns? or it will multiply with power points?

No, to be exact, duration of a spell is min(heroSpellPower, "<ForceCappedDuration>'s value"). 0, if it's not capped.

You can always experiment with numbers to see what they mean.

Quote:
<Attributes> Is this important?

Yes, but not all of them are important. Still it's better to set correct attributes than to get undefined behavior.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted April 01, 2022 01:18 AM
Edited by Szaman at 01:31, 01 Apr 2022.

My head hurts:I hated math in school but ok, google is my friend here

enum FSpellFlags
{
SF_BATTLE_SPELL = 0x1,
SF_MAP_SPELL = 0x2,
SF_TIME_SCALE = 0x4,<---(COULD YOU EXPALIN THIS?)
SF_CREATURE_SPELL = 0x8,
SF_SINGLE_TARGET = 0x10,
SF_SINGLE_SHOOTING_STACK = 0x20,<---(AND THIS?)
SF_EXPERT_MASS_VERSION = 0x40,
SF_TARGET_ANYWHERE = 0x80,
SF_REMOVE_OBSTACLE = 0x100,
SF_DAMAGE_SPELL = 0x200,
SF_MIND_SPELL = 0x400,
SF_FRIENDLY_MASS = 0x800,
SF_NOT_AT_WAR_MACHINE = 0x1000,
SF_SPELL_FROM_ARTIFACT = 0x2000,
SF_DEFENSIVE = 0x4000,<---(AND THIS?)
SF_AI_DAMAGE_SPELL = 0x8000,
SF_AI_AREA_EFFECT = 0x10000,
SF_AI_MASS_DAMAGESPELL = 0x20000,
SF_AI_NON_DAMAGE_SPELL = 0x40000,
SF_AI_CREATURES = 0x80000,
SF_AI_ADVENTUREMAP = 0x100000,
};

So basically those are so called "Hexadecimal" numbers, right? and i have to convert them to "Decimal".

So my spell is a Battle spell (SF_BATTLE_SPELL = 0x1,), is a single target spell (SF_SINGLE_TARGET = 0x10), is not targeted for war machines (SF_NOT_AT_WAR_MACHINE = 0x1000,), it's a non damage spell (SF_AI_NON_DAMAGE_SPELL = 0x40000,).

So...
0x1
0x10
0x1000
0x40000
SUM
0x41011(Hexadecimal)
Convert to decimal (I used this program)
266257

I'm doing it right?
So my <Attributes> will be?
<Attributes> = 266257

------------------
So my "ini" spell look like this now, it is finished here?

EDIT:
; Spell #94
[Hour of Power]
<Enabled> = 1
<Type> = 1
<Sound.FileName> = "HourOfPower.wav"
<Animation.ID> = 90
; SF_AI_NON_DAMAGE_SPELL|SF_NOT_AT_WAR_MACHINE|SF_SINGLE_TARGET|SF_TIME_SCALE|SF_BATTLE_SPELL
<Attributes> = 266257
<Level> = 5
<School.Earth> = 0
<School.Water> = 1
<School.Fire> = 0
<School.Air> = 0
<Cost.None> = 30
<Cost.Basic> = 25
<Cost.Advanced> = 20
<Cost.Expert> = 17
<Effect.Power> = 0
<Effect.None> = 25
<Effect.Basic> = 50
<Effect.Advanced> = 100
<Effect.Expert> = 200
<ChanceToGain.Castle> = 15
<ChanceToGain.Rampart> = 10
<ChanceToGain.Tower> = 20
<ChanceToGain.Inferno> = 3
<ChanceToGain.Necropolis> = 0
<ChanceToGain.Dungeon> = 5
<ChanceToGain.Stronghold> = 0
<ChanceToGain.Fortress> = 0
<ChanceToGain.Conflux> = 18
<AIValue.None> = 50
<AIValue.Basic> = 60
<AIValue.Advanced> = 60
<AIValue.Expert> = 120
<ForceCappedDuration> = 3

What's next?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted April 01, 2022 01:55 AM
Edited by AlexSpl at 02:22, 01 Apr 2022.

Quote:
My head hurts:I hated math in school

This is bad, because I'm afraid you won't be able to follow the main part of my guide. Nevertheless, check if you are able to follow this basic guide to writing plugins.

SF_TIME_SCALE - has a duration,
SF_SINGLE_SHOOTING_STACK - used for such spells as Precision and Forgetfulness,
SF_DEFENSIVE - don't know if this flag is used, it seems the original spells don't have it, but I'm not sure.

Quote:
I'm doing it right?

Yes, it's exacly how attributes value is calculated.

Quote:
So my "ini" spell look like this now, it is finished here?

Seems OK.

Quote:
What's next?

Now you have to write some code. First, I recommend you to create your first plugin following steps from the guide I've mentioned above. Second, you have to add a few lines to the NewSpells plugin code and make a dll with your new spell added. Maybe it seems not so easy to do, but once you add the Water Shield from the second guide, you'll understand the pattern.

Mind, that the Water Shield is harder in implementation, so your Hour of Power, actually, will need just a few lines of code.

Basically, by writing code you add some IDs and define the behavior of your spell when you apply it and when you reset it.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted April 01, 2022 03:05 AM
Edited by AlexSpl at 16:56, 01 Apr 2022.

We can simplify the whole process even more. I can share the current solution and post some pictures of each step of adding a new spell later.

I hope you have no problems with simple things, such as IDs and strings. For example,

#define SPELLS_NUM 95
...
#define SPL_EXPLOSION 93
#define SPL_HOUR_OF_POWER 94


#define ANIMS_NUM 90
...
#define ANIM_INCINERATION 88
#define ANIM_HOUR_OF_POWER 89


It seems pretty intuitive what you should do, doesn't it?

But to follow my pictures (with adding cases to applySpell() and resetSpell() functions), try to make sure you can actually build your first plugin.

Simpler than that it will be only providing you with a ready plugin (dll), but then you won't be able to add other new spells of yours

* * *
NewSpells.h







Done with NewSpells.h. See, it's extremely simple

* * *

dllmain.cpp



struct WaterShieldSpell
{
  int defenseBonus;  
}
waterShieldSpell[2][21];


For the Water Shield spell we need only one field called defenseBonus, but you can add as many spell's parameters here as you wish.



case SPL_WATER_SHIELD:
  if (schoolLevel == SL_NONE || schoolLevel == SL_BASIC)
waterShieldSpell[stack->side][stack->index_on_side].defenseBonus += (int)(1 + o_pCreatureInfo[stack->creature_id].defence * 0.1);

  if (schoolLevel == SL_ADVANCED)
waterShieldSpell[stack->side][stack->index_on_side].defenseBonus += (int)(2 + o_pCreatureInfo[stack->creature_id].defence * 0.2);

  if (schoolLevel == SL_EXPERT)
waterShieldSpell[stack->side][stack->index_on_side].defenseBonus += (int)(3 + o_pCreatureInfo[stack->creature_id].defence * 0.3);

  stack->creature.defence += waterShieldSpell[stack->side][stack->index_on_side].defenseBonus;

  break;


Here you write a spell's logic. Can be as complex as you wish. This code is applying every time you cast a spell.



case SPL_WATER_SHIELD:
  stack->creature.defence -= waterShieldSpell[stack->side][stack->index_on_side].defenseBonus;
 
  if (stack->creature.defence < 0)
 stack->creature.defence = 0;

  break;


Here you write a spell's logic. Can be as complex as you wish. This code is applying every time a spell is gone.

And, if you have a custom animation, write down its name here, like it's done for some of the new spells with custom animations. For example, this code is for the Incineration spell -



Now all that's left is to build your plugin by pressing F7 key, and...

Voila! You successfully added simplified Water Shield

See? Easy

* * *

Here is the latest solution. Sharing for 14 days, password is 0xD5ABB in decimal. The archive with the homm3.h header is there.

Well, it's not the latest build, but spells should work. The pictures above are made for this build anyway

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted April 01, 2022 03:13 AM

Quote:
check if you are able to follow this basic guide to writing plugins.


Oww..God..Well.. I think a hit a wall here...

I'm not a programmer sadly;( and even basic C++ lanquage is beyond me...

Well, atleast i tried...

I have some left materials from my old mod and i thought that would somehow us it here

I could ask you to do the "coding" but i think it would be rude from my part to ask yo do it.

To bad there is no simple way to implant new things.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted April 01, 2022 03:18 AM

Well, describe precisely what the Hour of Power should do. And I'll code it later.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Szaman
Szaman


Known Hero
posted April 01, 2022 03:36 PM

AlexSpl said:
Well, describe precisely what the Hour of Power should do. And I'll code it later.


Hour of Power
---
lvl 5 Water Spell
---
Mana Cost:
None:30
Basic:25
Advanced:20
Expert:17
---
Chance to gain in:
Castle:15
Tower:20
Inferno:3
Necropolis:0
Dungeon:5
Stronghold:0
Fortress:0
Conflux:18
---
Spell duration:3 turns
---
Can't be casted on undead
Single Target spell
Can't be casted on war machines
---
Technical description:
A combined spell of Bless, Bloodlust, Fortune and slayer to one (all experts lvl) + 50% more hp.

Description in-game:
Combined power of Water and light magic, gives a selected friendly unit great powers, doesn't work on the undead.

--------

Don't lose hope with that plugin yet.. i have a friend who is a programmer who knows C++ very well and agreed to help mi with my plugin, this will be mind blowing experience for me I hope my brain will survive this

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 13 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1115 seconds