Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Making a Spell That Works Only In Cities

RaduzielRaduziel Member Posts: 4,716
edited January 2018 in General Modding
Hi :)

Is there any way to make a spell only target neutral characters (non-hostiles out of the party)?

I'm working on a kind of Charm Person that I need to be completely useless against enemies (because of reasons)

Thanks.

Post edited by Raduziel on

Comments

  • AionZAionZ Member Posts: 3,033
    Use EFF File (177)

    Parameter 1: NONEVIL
    Parameter 2: EA

    Raduziel
  • RaduzielRaduziel Member Posts: 4,716
    edited January 2018

    Use EFF File (177)

    Parameter 1: NONEVIL
    Parameter 2: EA

    @Artemius_I just to clarify

    p1: 199 (NOTEVIL)

    p2: EA

    Resource the spell that I want to take effect.

    The resource field accepts .spl files or only .eff files?

    Thanks!

  • GrammarsaladGrammarsalad Member Posts: 2,509
    If you're going EE only, it might be better to use opcodes 326 or 324.

    In many ways, 324 is the easiest. All you need to do is make non-allied creatures immune to the spell as the very first effect. It must be the first effect. There are a number of IWDEE spells that use this trick (I think, e.g. Hold person works this way--In IWDEE only, though).

    Basically, I think you'd set param1 to 0, and param 2 to 51 (enemies).

    subtledoctorRaduziel
  • RaduzielRaduziel Member Posts: 4,716
    Ok, guys, a different subject now.

    I know the solution is somewhere around Opcode 324, but I just can't find the right parameters to use.

    I want to create a spell that can be used only when inside a city. This spell will, when cast in a valid condition, call another one that has a 25% os chance of raising the party's reputation by 1 or 5% of dropping it by the same amount (RAChaTa1).

    From IESDP I got the following info:

    Opcode 324

    I know that I want to use the 0x106 info (areatype) and the code for City is 8.

    If opcode 324 gives immunity from a spell so I guess I need to use the option 5 (not equal). This way I'll be immune every time I'm outside a city.

    Can you guys give me some help? Especially @subtledoctor @Grammarsalad , who loves this opcode apparently <3

  • subtledoctorsubtledoctor Member Posts: 11,460
    That one's beyond me, sorry. When dealing with stuff like areas, my knee-jerk assumption is that you have to use scripts.

    Grammarsalad
  • RaduzielRaduziel Member Posts: 4,716

    That one's beyond me, sorry. When dealing with stuff like areas, my knee-jerk assumption is that you have to use scripts.


  • GwendolyneGwendolyne Member Posts: 297
    You must add a new line in splprot.2da :

    NOT_IN_CITY 0x106 8 5

    with 0x106 = areatype (like outdoors, forest, etc)
    8 = CITY
    5 = not equal

    I once wrote a function to do this, but Argent77's one is better.

    Once done, use it with #324.

    RaduzielGrammarsalad
  • RaduzielRaduziel Member Posts: 4,716

    You must add a new line in splprot.2da :

    NOT_IN_CITY 0x106 8 5

    with 0x106 = areatype (like outdoors, forest, etc)
    8 = CITY
    5 = not equal

    I once wrote a function to do this, but Argent77's one is better.

    Once done, use it with #324.

    Thanks! You're always a life saver.

    But how do I fill the #324? What will be p1, p2, special, etc in this case?

  • kjeronkjeron Member Posts: 2,130
    edited January 2018
    Raduziel said:

    But how do I fill the #324? What will be p1, p2, special, etc in this case?

    Parameter1and Speical will be irrelevant, Parameter2 is the rownumber in SPLPROT that line is added at (the "index" variable that the function returns).
    5 (Not Equal) will not work correctly here though, you need to use 9 (Binary Not Match), so:
    NOT_IN_CITY 0x106 8 9
    Using the function:
    0x106 is the "stat"
    8 is the "value"
    9 is the "relation"

    Raduziel
  • RaduzielRaduziel Member Posts: 4,716
    Can I do something similar to be even more restrictive?

    Let's say: the spell will only work inside specific areas.

  • ArunsunArunsun Member Posts: 1,581
    edited January 2018
    Raduziel said:

    Can I do something similar to be even more restrictive?

    Let's say: the spell will only work inside specific areas.


    The AREATYPE part on .are files is coded on two bytes. In an unmodded game only 7 or 8 types are set in AREATYPE.IDS , out of 16 (2*8 bits) possible types. So it is possible, though not sure, that you could add a line to AREATYPE.IDS, flag the areas you want to work as being of this type you just created, and then use @Gwendolyne 's trick, changing the middle value to 256. Can't give you any guarantee this would work as I have never actually tried messing with that, but I don't see why not so it might be worth a try.
    Might cause compatibility issues if multiple modders decide to do things with areatype.ids, since the total number of entries would hardcap at 16 regardless but no mod that I know of make use of that so as they say, first come first served.

    Other than that, well, pretty much everything can be achieved through clever scripting, but it may get quite tedious, so I would first try my first method.

    Maybe @Avenger_teambg or another developer could enlighten us about what can be done with areatype.IDS.

    Raduziel
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Yeah, the area type is 16 bits, but nothing in the official games uses higher bits (except in PST).
    So you can have maximum 8 new values in areatype.ids
    If you combine multiple bits, you may have more values (at the cost of being mutually exclusive), and it would be more difficult (but not impossible) to create an splprot entry to discern them.

    Arunsun
Sign In or Register to comment.