Solved Can you help me write this script?

Question that is answered or resolved.

DD Tokki

Well-known member
C:
void blockFreeze()
{//Freezes the opponent to give a little "pause moment" effect during the block, like SF3 Third Strike
    void self        = getlocalvar("self");
    void target    = getlocalvar("attacker");
    void subType    = getentityproperty(target, "subtype");
    float time        = openborvariant("elapsed_time");
    float freeze    = 30;

    //AVOID WEAPON AND PROJECTILE SUBTYPES, DOESN'T MAKE SENSE TO STOP THESE ENTITIES
    if(subType != openborconstant("SUBTYPE_WEAPON") && subType != openborconstant("SUBTYPE_PROJECTILE")){
        changeentityproperty(target, "aiflag", "frozen", 1);
        changeentityproperty(target, "freezetime", time+freeze);
    }
}

This script has an effect that temporarily stops movement, similar to a hit delay, in response to a block action. It is usually not applied to other actions, so I would like to change this script so that it can be used for any action. For example, I would like to apply this script to an enemy's action to temporarily stop the enemy and the player.
 
It is possible to freeze both entity and its opponent but the question is why?
Or rephrasing the question, what actions should freeze both attacker and defender briefly?
 
It is possible to freeze both entity and its opponent but the question is why?
Or rephrasing the question, what actions should freeze both attacker and defender briefly?
When a player or enemy character attacks, you can add a delay effect when they hit, but in this case, I want to add a script to the part where I want to perform it without hitting.

What I want to do first is to add a delay to the FALL action.
 
Do you want falling character to stop in midair briefly?
I'm trying to make a special death animation when a character falls, so I want to make it stop for a moment and then move.

I can stop it in text mode, but if I do that, the entire game stops every time an enemy dies,

so I want to implement a way to make only the characters stop when they hit.
 
I'm trying to make a special death animation when a character falls, so I want to make it stop for a moment and then move.

I can stop it in text mode, but if I do that, the entire game stops every time an enemy dies,

so I want to implement a way to make only the characters stop when they hit.
@DD Tokki I don't know if it will fit for your purpose, but you can use the frozen status in a @cmd function, this way enabling/disabling at any frame.


Code:
void frozen(int flag, int duration)
{//Turns frozen status
    void self = getlocalvar("self");

    changeentityproperty(self, "aiflag", "frozen", flag);
    changeentityproperty(self, "freezetime", openborvariant("elapsed_time")+duration);
}

Code:
anim runattack #BLITZ
    fastattack 1
    jugglecost 4
    forcedirection -1
    otg 1
    loop    0
    delay    8
    offset    153 175
    @cmd hitfx "data/sounds/sor2_hit2.wav"
    frame    data/chars/heroes/sammy/sor2/runatk00.png
    @cmd leaper 3.2 2.6 0
    @cmd keyMove 0 1.6
    @cmd frozen 1 400
    attack 148 122 32 25 12 1 0 0 20 12
    frame    data/chars/heroes/sammy/sor2/runatk01.png
 
@DD Tokki I don't know if it will fit for your purpose, but you can use the frozen status in a @cmd function, this way enabling/disabling at any frame.


Code:
void frozen(int flag, int duration)
{//Turns frozen status
    void self = getlocalvar("self");

    changeentityproperty(self, "aiflag", "frozen", flag);
    changeentityproperty(self, "freezetime", openborvariant("elapsed_time")+duration);
}

Code:
anim runattack #BLITZ
    fastattack 1
    jugglecost 4
    forcedirection -1
    otg 1
    loop    0
    delay    8
    offset    153 175
    @cmd hitfx "data/sounds/sor2_hit2.wav"
    frame    data/chars/heroes/sammy/sor2/runatk00.png
    @cmd leaper 3.2 2.6 0
    @cmd keyMove 0 1.6
    @cmd frozen 1 400
    attack 148 122 32 25 12 1 0 0 20 12
    frame    data/chars/heroes/sammy/sor2/runatk01.png
Thank you.
If there is a problem, it seems to be a problem with the character's settings, regardless of the script, so I postponed the work for now.

The current setting is set to "falldie 2" in the character header, so that when the character dies, the fall animation is kept as it is, and the "death" animation is played when the character hits the ground.

However, what I want to do is to create a special defeat animation by keeping "falldie 2".
This is a setting that does not fit "falldie 2" because it comes out right when the fall movement works.
Is there a way to react to the special attack with the death animation right away?
I want to keep the other attacks as the normal defeat condition.
 
You don't have to use falldie in the character header, so if you want to reference the structure of how the character dies depending on wherever it is (from the script), whether on or off the ground, you can play around with the values.

 
This is the script example of what I've meant in my last post:
C:
anim    burn
@script
   if(frame == 1){
     void self = getlocalvar("self");
     int Health = getentityproperty(self, "health");

     if(Health <= 0){
       changeentityproperty(self, "animation", openborconstant("ANI_BURNDIE"));
     }
   }
@end_script
...

This is from test entity I've made. This entity has death 2 set (same as falldie 2) however if it is finished by burn attack, it will play BURN animation but this script will change animation to BDIE at frame 2 which is 1 centisecond away from frame 1. IOW finishing this entity with burn attack will make it play BDIE animation as if it's using death 1.
 
This is the script example of what I've meant in my last post:
C:
anim    burn
@script
   if(frame == 1){
     void self = getlocalvar("self");
     int Health = getentityproperty(self, "health");

     if(Health <= 0){
       changeentityproperty(self, "animation", openborconstant("ANI_BURNDIE"));
     }
   }
@end_script
...

This is from test entity I've made. This entity has death 2 set (same as falldie 2) however if it is finished by burn attack, it will play BURN animation but this script will change animation to BDIE at frame 2 which is 1 centisecond away from frame 1. IOW finishing this entity with burn attack will make it play BDIE animation as if it's using death 1.
Thank you.

I'll try to make the death animation I want with this and the freeze script.
 
Back
Top Bottom