Spawn with different header properties

Aerisetta

Active member
I wanted to make all the characters on a stage spawn with nopain 1 and nodrop 2 so the stage is harder in this mode.

I wanted to avoid making a new character

I decided to spawn them with those properties changed. I wanted to check if this was a good/optimal way to do it. thx

Code:
spawn    Priest_Staff
@script
void main()
{
    void self = getlocalvar("self");
    getentityproperty(self, "nopain");
    getentityproperty(self, "nodrop");
    changeentityproperty(self, "nopain", 1);
    changeentityproperty(self, "nodrop", 2);
}
@end_script
coords 1200 650
item    book
itemalias book1
at 1300

spawn    Priest_Book
@script
void main()
{
    void self = getlocalvar("self");
    getentityproperty(self, "nopain");
    getentityproperty(self, "nodrop");
    changeentityproperty(self, "nopain", 1);
    changeentityproperty(self, "nodrop", 2);
}
@end_script
coords 1300 850
map        0 #base
#health    30
at 1300

####HARD
spawn    Priest_Harp
@script
void main()
{
    void self = getlocalvar("self");
    getentityproperty(self, "nopain");
    getentityproperty(self, "nodrop");
    changeentityproperty(self, "nopain", 1);
    changeentityproperty(self, "nodrop", 2);
}
@end_script
coords 800 750
map        0 #base
#health    30
at 1300
 
I haven't figured out how to

increase Maxhealth by 100 or x2 or increase damage dealth by x2 or add extra damage on top
 
I haven't figured out how to

increase Maxhealth by 100 or x2 or increase damage dealth by x2 or add extra damage on top
so you want these entities on a certain level to cause more damage and ther healths to double?

i believe their health cuold be handled better on the level.txt file itself, dont know if there could be a script that may be pasted on the level.txt file that could affect their amount of damage - such "multiplier" type script will have to be added to the characters text and it may need to activate by using branch....
it may be possible tho on a level.txt file too but would it be too taxing on the resources?.
this would be inline scripts tho, and they wold be activated using the alias...

it would be easier to just clone the entity and give it the ability to do 2wice the damage, and program the health in the level.txt file
 
nightslashers rebalance and 21c have a critical hit script for it main characters, where some punches deal a ot of damage seemingly at random, maybe such a script could be modified so your enemies can del more damage depending on their alias....
 
I wanted to check if this was a good/optimal way to do it. thx
@Aerisetta

My two cents about it, I suggest to use the onspawnscript event for this purpose. This way you can change any property according to different sittuations.
Same as other entity script events, you need to declare it at the character header and put the desired code inside your onspawn.c file.

entity file
Code:
name            Hero
health            100
mp                50
onspawnscript    data/scripts/onspawn.c

onspawn.c file
C:
void main()
{
    void self = getlocalvar("self");
    void branch = openborvariant("current_branch");
    int mHealth = getentityproperty(self, "maxhealth");

    if(branch == "test_level"){
        changeentityproperty(self, "nopain", 1);
        changeentityproperty(self, "nodrop", 2);
        changeentityproperty(self, "maxhealth", mHealth*2); //max health x2
        changeentityproperty(self, "health", mHealth*2); //current health x2
    }
}
 
@Kratus -
i have encountered the openborvariant("current_branch") thing before
i was wondering , is there no way to use the name of a level file instead as if one where using the name of an entity?

any way , using the current branch thing could also be used to increase an attack's damage if its included on script like the critical hit script if im not mistaken....
 
is there no way to use the name of a level file instead as if one where using the name of an entity?
@oldyz

I don't know if I understand correctly, but you don't need to use the level file name once you can define branch names at the levels.txt file. This way you can freely use any name, like this:

1682023286314.png

And you can name an entity with the same name as the current branch, allowing you to call both at the same time.
 
Hi

need to help to update this one

I want enemies in harder stages to have armor, and so previously i changed them to nopain1

However, i realized that this was too limiting for other reasons (i.e. there were times i needed the to activate a specific pain animation)

So I decided to control this with defense property instead. Im looking for help on how to write this in the function as the below does not work atm

Thx

Code:
    if(branch == "C01X" || branch == "C01-01X" || branch == "C01-02X" || branch == "C01-03X" || branch == "C01-04X" || branch == "C01-05X" ){
        changeentityproperty(self, "defense", normal 1 999);
        changeentityproperty(self, "defense", normal3 1 999);
 
Try this:
C:
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL"), 1, 999);
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL3"), 1, 999);
 

@Aerisetta


you can also tweak their knockdown count a little bit, like it takes them 2 strong attacks to knock them instead of just one like regular enemies...
 
Try this:
C:
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL"), 1, 999);
      changeentityproperty(self, "defense", openborconstant("ATK_NORMAL3"), 1, 999);
thx

Question

This seems to work for ATK_NORMAL1 to 9

But once I go above ATK_NORMAL10, it doesnt work

Any idea why?
 
Is maxattacktypes set in models.txt? If not, you need to increase its limit by giving a number of how many you want.

maxattacktypes {max}

  • Sets the maximum number of attack types.
  • PAIN,FALL, RISE, BLOCKPAIN and DEATH animations limit is also set together with this.
  • {max} is number of available types.
  • Default is 10 & maximum value is 99.

That's why it doesn't work for you.
 
Is maxattacktypes set in models.txt? If not, you need to increase its limit by giving a number of how many you want.



That's why it doesn't work for you.
Yes it's already set

maxattacks 99
maxattacktypes 99
maxfreespecials 99
maxfollows 99
 
C:
ATK_NORMAL
Hello
Currently the engine only supports the NORMAL10 variable

That is not true at all. Once you define a larger number of Maxattacks, the available NORMAL# increases along with it.

DC
 
That's weird. I don't understand why it's not working. Maybe damageentity can work?

damageentity(entity, other, force, drop, type)

  • Damage the entity.
  • 'entity' is the entity you want to damage.
  • 'other' who damage this entity, can be itself, if you specify a player's entity, score will be added. Default to the entity itself.
  • 'force' is the attack force. default to 1.
  • 'drop' is whether the attack knocks down the entity.
  • 'type' attack type, e.g., a shock attack or attack1-10, see openborconstant, the constants starts with 'ATK_'

If not, I don't know.
 
That is not true at all. Once you define a larger number of Maxattacks, the available NORMAL# increases along with it.

DC
I just re-confirmed
C:
changeentityproperty(self, "offense", openborconstant("ATK_NORMAL11"), 5);
There is no change in the damage. I have tested it many times in 4432, 6330 and other engines before, and there will be no variables, but the offense command is valid.
 
Last edited:
That is not true at all. Once you define a larger number of Maxattacks, the available NORMAL# increases along with it.
I rememeber seeing that limit on the engine code back in the day - the attack numbers goes only up to 10 when using script.

Correct me if I am wrong, but isn't this part? openbor.h

C:
typedef enum
{
    ATK_NONE            = -1,   // When we want no attack at all, such as damage_on_landing's default.
    ATK_NORMAL,
    ATK_NORMAL1            = ATK_NORMAL,
    ATK_NORMAL2,
    ATK_NORMAL3,
    ATK_NORMAL4,
    ATK_BLAST,
    ATK_BURN,
    ATK_FREEZE,
    ATK_SHOCK,
    ATK_STEAL,
    ATK_NORMAL5,
    ATK_NORMAL6,
    ATK_NORMAL7,
    ATK_NORMAL8,
    ATK_NORMAL9,
    ATK_NORMAL10,


    // For engine and script use. These are
    // applied automatically by various
    // conditions or intended for script logic.
    ATK_BOSS_DEATH, // KO leftover enemies when boss is defeated.
    ATK_ITEM,       // Scripting item logic. Item "attacks" entity that collects it.
    ATK_LAND,       // Touching ground during a damage on landing fall.
    ATK_LIFESPAN,   // Entity's lifespan timer expires.
    ATK_LOSE,       // Players (with lose animation) when level time expires.
    ATK_PIT,        // Entity falls into a pit and reaches specified depth.
    ATK_TIMEOVER,   // Players (without lose animation) when level time expires.


    // Default max attack types (must
    // be below all attack types in enum
    // to get correct value)
    MAX_ATKS,
    STA_ATKS        = (MAX_ATKS-10)
} e_attack_types;
 
I rememeber seeing that limit on the engine code back in the day - the attack numbers goes only up to 10 when using script.

Correct me if I am wrong, but isn't this part? openbor.h

C:
typedef enum
{
    ATK_NONE            = -1,   // When we want no attack at all, such as damage_on_landing's default.
    ATK_NORMAL,
    ATK_NORMAL1            = ATK_NORMAL,
    ATK_NORMAL2,
    ATK_NORMAL3,
    ATK_NORMAL4,
    ATK_BLAST,
    ATK_BURN,
    ATK_FREEZE,
    ATK_SHOCK,
    ATK_STEAL,
    ATK_NORMAL5,
    ATK_NORMAL6,
    ATK_NORMAL7,
    ATK_NORMAL8,
    ATK_NORMAL9,
    ATK_NORMAL10,


    // For engine and script use. These are
    // applied automatically by various
    // conditions or intended for script logic.
    ATK_BOSS_DEATH, // KO leftover enemies when boss is defeated.
    ATK_ITEM,       // Scripting item logic. Item "attacks" entity that collects it.
    ATK_LAND,       // Touching ground during a damage on landing fall.
    ATK_LIFESPAN,   // Entity's lifespan timer expires.
    ATK_LOSE,       // Players (with lose animation) when level time expires.
    ATK_PIT,        // Entity falls into a pit and reaches specified depth.
    ATK_TIMEOVER,   // Players (without lose animation) when level time expires.


    // Default max attack types (must
    // be below all attack types in enum
    // to get correct value)
    MAX_ATKS,
    STA_ATKS        = (MAX_ATKS-10)
} e_attack_types;

That's true, but elsewhere the engine generates constants at startup for the increased numbers. That's how you can reference any number of freespecials and follows. Maybe we looked over attacks, but I never had an issue. Y'all made me unsure now, lol. I'll have to look closer.

DC
 
That's true, but elsewhere the engine generates constants at startup for the increased numbers. That's how you can reference any number of freespecials and follows. Maybe we looked over attacks, but I never had an issue. Y'all made me unsure now, lol. I'll have to look closer.

DC
@DCurrent
I can confirm this issue, @pudu reported it to me some time ago and I registered in my "todo" list to try fixing it later.
In addition, we could add a new "ATK_ALL" in order to apply it to all attack types, same as we have in the entity header.
 
Back
Top Bottom