Neutral Global Spells?

We’ve moved over to the paradox forums. Please come visit us there to discuss:
You can still read the collective wisdom - and lolz - of the community here, but posting is no longer possible.

Home Forums Modding and Map Making Neutral Global Spells?

This topic contains 8 replies, has 3 voices, and was last updated by  max.magician 6 years, 11 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #185120


    I’m currently in my ‘Man, I wanna work on my LevelEd stuff’-mode and I had an Idea for map design including a 3rd party Armageddon spell.
    So, is it possible to set map-affecting spells/effecs (apart from map-wide “On cast fire of script X” etc.) ?

    So, e.g. 2 player Skirmish-scenario with an undisjunctable Armageddon Effect present (If possible switched on/off by scripts/re’-casted’ X turns after disjunction through script + timer).
    A neutral spell origin would allow for negative/positive Globals to affect all players, I’d guess.

    Basically setting (permanent) Cosmic Events



    Hi Thariorn,

    First of all the spell needs to exist.
    And then you can have the Independents cast it.
    But it can be disjuncted.
    So you would need to check every turn (with a timer that resets itself) whether the spell is still active, and if not, cast it again (or, if you’re friendly, check every 5 turns, so people sometimes have a benefit from their investment).

    In fact, I did that for the Empire of the Sun in map 2 of the campaign, so you can see there how I did it (it’s more complex there as an AI is casting it instead of the Independent, so I had to make sure he wasn’t already casting something else, something you won’t need to do).

    You’ll have to use:
    * void PlayerCastSpell(playerAlias : string, position : LUAHMPos, spellResourceId : string)
    Cast Spell on Strategic Map

    * int PlayerGetNumSustainedSpells(playerAlias : string)
    Get the number of spells the player is sustaining.

    * SustainedSpell PlayerGetSustainedSpell(playerAlias : string, index : int)
    Get the sustained spell for the player at the specified index.

    And then you’d need the resourceID of the spell. I can tell you that once you’ve chosen which one. You can check that number against the return value from PlayerGetSustainedSpell to see if it’s still ‘up’. And you need it to cast it in the first place as well.
    Also, if the spell works only on enemies for example things get more complicated, since the Independents are not at war with anyone (the Independent Player never is, anyway). So then you’d need to use an AI after all.

    If you have any questions please ask them, I’d like to help 🙂



    Hmmm, if I’d need a player to have enemy-affecting Spells work this way, things would get a bit weird.

    Of course I could set up a third player with whom everyone HAS to be at war.
    Said player wouldn’t have any cities, no spells to research, a fixed external mana-income- barely enough to sustain his spell – aswell as being imprisoned in an unaccessbile part of the Underground.

    I’d rather come up with a map-concept where a neutral AGe of Death was in place, but I guess I wouldn’t be able to set those raised units to ‘Hate all’, right 😕

    Oh, are the Eternal Lords Maps unlocked to scram through like the Vanilla Campaigns? Didn’t know that ~



    They should be..



    Hi Narvek,

    I have a very similar problem to Thariorn’s… Can’t get the spell to work.

    I tried both

    local hellPosition = HexWorld:GetScriptingS():GetPosition(“HELL”)
    HexWorld:GetScriptingS():PlayerCastSpell(“PLAYER4”, hellPosition, “#0000011A0000112D”)


    HexWorld:GetScriptingS():PlayerCastSpell(“PLAYER4”, HexWorld:GetScriptingS():GetPosition(“HELL”), “#0000011A0000112D”)

    It seems that Player 4 refuses to do the poison domain spell at his city named Hell. What am I doing wrong? The sustainedspells should be only necessary, well to sustain the spells after being cast. Am i wrong here?

    Please let me know, I am really curious!




    Hi max. magician,

    if you are letting a player cast a spell you need to make sure he isn’t already casting a spell (otherwise that will interfere).
    That’s why using independents is safe as they never cast.

    For AI, I had to do something similar in EL 3 for Melenis, for casting her Age of Death spell. Basically I made a timer that checked whether the spell could be cast, and if not, the timer would reset (timers has a runtime of 1).
    I will copy the script on the timer here:

    -- Melenis casts Age of Death
    if not HexWorld:GetScriptingS():PlayerIsCasting("MELENIS") then
      HexWorld:GetScriptingS():PlayerCastSpell("MELENIS", HexWorld:GetScriptingS():GetPosition("MELENISTHRONE"), "#0000032F0000035F")

    Hope that helps you!

    PS: the sustainedspell? If you mean PlayerGetSustainedSpell, that’s used with PlayerGetNumSustainedSpells to check whether a player has a certain spell active (in map 2, Ankhnaton casts Tropical Domain again if you disjunct it, after a few turns. I had to code that (he gives up if you disjunct it enough)).



    Dear Narvek,

    Thanks for your reply! Apparently, I am doing something wrong though. I am trying to test the script by doing the following steps:

    1. In turn 1, I give to player4 500 CP and 500 Mana, so I can be sure that he will have enough to do the spell (HexWorld:GetScriptingS():PlayerAddCP(“PLAYER4”, 500) and HexWorld:GetScriptingS():PlayerAddMana(“PLAYER4”, 500)

    2. I set the timer TESTSPELL running TRUE; with a duration of 1. On elapse the following script runs:

    if not HexWorld:GetScriptingS():PlayerIsCasting(“PLAYER4”) then
    HexWorld:GetScriptingS():PlayerCastSpell(“PLAYER4”, HexWorld:GetScriptingS():GetPosition(“HELL”), “#0000011A0000112D”)

    3. I observe the players domain (I ve put him as an ally to check) but it seems that he never casts the Poison Domain.

    Conclusion: Either I make something wrong (should the script be to false and trigger it with another timer?) OR the ID for Poison Domain is wrong OR something else that I cannot figure out.

    Any further help would be much appreciated!





    Hello Max,

    Checked your ID and it’s wrong for your purpose. You are using the ID of the SKILL, while you need the ID of the SPELL, which is:


    You don’t need to give CP or Mana to cast (will still require mana upkeep though). Good luck 🙂



    Excellent! It now works fine! Thanks a lot Narvek!


Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.