I have a question.

DD Tokki

Well-known member
If you look at street of rage 2x, when an enemy appears, they appear off the screen, and when hit by a player, they fall inside the screen as if "subject_to_screen" was applied. Can you give me some information about this feature?
 
  • Wow
Reactions: NED
@Kratus may be using script to set the subject_to_screen flag depending on special needs for SORX, but you don't have to do it that way. You can just define the subject_to_screen option in model text files. Entities from that model that are spawned outside of the screen boundaries are free to move about until they cross into the screen. After that, the subject_to_screen takes effect and they can't leave the screen boundary any more.

The option is off by default for enemy and NPC types, and on for players.

DC
 
@Kratus may be using script to set the subject_to_screen flag depending on special needs for SORX, but you don't have to do it that way. You can just define the subject_to_screen option in model text files. Entities from that model that are spawned outside of the screen boundaries are free to move about until they cross into the screen. After that, the subject_to_screen takes effect and they can't leave the screen boundary any more.

The option is off by default for enemy and NPC types, and on for players.

DC
I am using this exact trick, but many reports that this enemy can't even enter the screen
 
@Kratus may be using script to set the subject_to_screen flag depending on special needs for SORX, but you don't have to do it that way. You can just define the subject_to_screen option in model text files. Entities from that model that are spawned outside of the screen boundaries are free to move about until they cross into the screen. After that, the subject_to_screen takes effect and they can't leave the screen boundary any more.

The option is off by default for enemy and NPC types, and on for players.

DC
thank you for telling me. applied result
subject_to_screen 0 (Enemy)
subject_to_screen 1 (Player)
With subject_to_screen 1, the enemy can't leave the screen, but instead of appearing off-screen, it pops up at the end inside. The subject_to_screen command did not produce the desired result. Is there any other way?
 
Do you want to allow enemies to be offscreen after being spawned BUT after the enter screen, they aren't allowed to go offscreen anymore?
I want spawned enemies to appear off-screen and not be able to exit inside the screen when making contact with the player. An example is Street of Rage 2x, enemies don't leave the screen when they fall.
 
Last edited:
Hi @DD Tokki
In the Street of Rage 2x the subject to screen is dinamically changed according to defined sittuations, basically I'm reproducing the SOR4 behaviour.

The feature contains 2 steps:

1) If the enemy take any damage, the subject_to_screen is set to 1 at the "takedamage.c" event.
2) Once the enemy is not getting any hit and is blocked by any screen edge, the subject_to_screen is set to 0 (in fact I set it to -1 for enemies, for some reason this is the default flag value when they are spawned).

Below you can see the scripts:

takedamage.c
C:
void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}

onblocksscript.c
C:
void edgeLock()
{//Unlock the screen edge (for enemies) according to defined instances, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");

    if(vType == openborconstant("TYPE_ENEMY")){
        void sType    = getentityproperty(self,"subtype");
        int idling    = getentityproperty(self, "aiflag", "idling");
        int walking    = getentityproperty(self, "aiflag", "walking");
        int running    = getentityproperty(self, "aiflag", "running");
        int rising    = getentityproperty(self, "aiflag", "rising");

        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(idling || walking || running || rising){
                changeentityproperty(self, "subject_to_screen", -1);
            }
        }
    }
}
 
Hi @DD Tokki
In the Street of Rage 2x the subject to screen is dinamically changed according to defined sittuations, basically I'm reproducing the SOR4 behaviour.

The feature contains 2 steps:

1) If the enemy take any damage, the subject_to_screen is set to 1 at the "takedamage.c" event.
2) Once the enemy is not getting any hit and is blocked by any screen edge, the subject_to_screen is set to 0 (in fact I set it to -1 for enemies, for some reason this is the default flag value when they are spawned).

Below you can see the scripts:

takedamage.c
C:
void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}

onblocksscript.c
C:
void edgeLock()
{//Unlock the screen edge (for enemies) according to defined instances, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");

    if(vType == openborconstant("TYPE_ENEMY")){
        void sType    = getentityproperty(self,"subtype");
        int idling    = getentityproperty(self, "aiflag", "idling");
        int walking    = getentityproperty(self, "aiflag", "walking");
        int running    = getentityproperty(self, "aiflag", "running");
        int rising    = getentityproperty(self, "aiflag", "rising");

        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(idling || walking || running || rising){
                changeentityproperty(self, "subject_to_screen", -1);
            }
        }
    }
}
thank you. But I don't know how to use it.
If you put a script in the game, the game will end before you do damage to enemies.

name zako-a1
type Enemy
aimove chase
health 100
speed 6
running 14 3.5 2 1
jumpspeed 12
jumpheight 3.8
jumpmove 0 1
risetime -220
grabdistance 20
antigravity -30
falldie 2
gfxshadow 1 2
noquake 1
nolife 1
antigrab 100
grabforce 100
hostile player npc
candamage player npc obstacle

animationscript data/scripts/script.c
ondrawscript data/scripts/hpbar.c
takedamagescript data/scripts/takedamage.c
onblocksscript data/scripts/onblocksscript.c

I've tried applying the script to other games at the same time, but it ends the same way.
 
Last edited:
thank you. But I don't know how to use it.
If you put a script in the game, the game will end before you do damage to enemies.

name zako-a1
type Enemy
aimove chase
health 100
speed 6
running 14 3.5 2 1
jumpspeed 12
jumpheight 3.8
jumpmove 0 1
risetime -220
grabdistance 20
antigravity -30
falldie 2
gfxshadow 1 2
noquake 1
nolife 1
antigrab 100
grabforce 100
hostile player npc
candamage player npc obstacle

animationscript data/scripts/script.c
ondrawscript data/scripts/hpbar.c
takedamagescript data/scripts/takedamage.c
onblocksscript data/scripts/onblocksscript.c

I've tried applying the script to other games at the same time, but it ends the same way.
Is the game crashing? Could you post the log file?

Probably it can be due to the "rising" instance, if I'm not wrong this one only works in the latest source code. In case you are using the build 6391 or older, I suggest replacing it with the "riseattacking", or you can remove it if it's unnecessary for your project.

In fact I'm only using the rising instance because some characters in my game can move during the rise or riseattack animations.
 
게임이 충돌합니까? 로그 파일을 게시할 수 있습니까?

아마도 "상승하는" 인스턴스 때문일 수 있습니다. 내가 틀리지 않은 경우 이 인스턴스는 최신 소스 코드에서만 작동합니다. 빌드 6391 또는 이전 버전을 사용하는 경우 "riseattacking"으로 교체하거나 프로젝트에 필요하지 않은 경우 제거할 수 있습니다.

사실 저는 게임의 일부 캐릭터가 상승 또는 상승 공격 애니메이션 중에 움직일 수 있기 때문에 상승 인스턴스만 사용하고 있습니다.
 

Attachments

If you don't have plans for adding multiple scripts in the takedamage event, replace the "void edgeLock()" by the "void main()".
Otherwise, copy/paste the code below:

C:
void main()
{
    edgeLock();
}

void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}
 
If you don't have plans for adding multiple scripts in the takedamage event, replace the "void edgeLock()" by the "void main()".
Otherwise, copy/paste the code below:

C:
void main()
{
    edgeLock();
}

void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}
thank you. Finally it runs.
 
Great, I'm glad the script worked :)
May I ask one more question?

void number()
{
void self = getlocalvar("self");
void f;
int damage = getlocalvar("damage");
int x, z, a, t;
int atkType = getlocalvar("attacktype");
if(damage > 0 && atkType != openborconstant("ATK_TIMEOVER"))
{
x = getentityproperty(self, "x")+4;
z = getentityproperty(self, "z")+1;
a = getentityproperty(self, "a")+40;
setspawnentry("name", "number");
while(damage)
{
t = damage % 10;
f = spawn();
changeentityproperty(f, "position", x,z,a);
updateframe(f, t);
damage/=10;
x -= 8;
}
}
}

It's a damage script, can I use it in combination with the previous script?
 
May I ask one more question?

void number()
{
void self = getlocalvar("self");
void f;
int damage = getlocalvar("damage");
int x, z, a, t;
int atkType = getlocalvar("attacktype");
if(damage > 0 && atkType != openborconstant("ATK_TIMEOVER"))
{
x = getentityproperty(self, "x")+4;
z = getentityproperty(self, "z")+1;
a = getentityproperty(self, "a")+40;
setspawnentry("name", "number");
while(damage)
{
t = damage % 10;
f = spawn();
changeentityproperty(f, "position", x,z,a);
updateframe(f, t);
damage/=10;
x -= 8;
}
}
}

It's a damage script, can I use it in combination with the previous script?
Yes, in this case you need to combine both in the same event, like this:

C:
void main()
{
    edgeLock();
    number();
}

void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}

void number()
{
    void self = getlocalvar("self");
    void f;
    int damage = getlocalvar("damage");
    int x, z, a, t;
    int atkType = getlocalvar("attacktype");
    
    if(damage > 0 && atkType != openborconstant("ATK_TIMEOVER"))
    {
        x = getentityproperty(self, "x")+4;
        z = getentityproperty(self, "z")+1;
        a = getentityproperty(self, "a")+40;
        setspawnentry("name", "number");
        
        while(damage)
        {
            t = damage % 10;
            f = spawn();
            changeentityproperty(f, "position", x,z,a);
            updateframe(f, t);
            damage/=10;
            x -= 8;
        }
    }
}
 
Yes, in this case you need to combine both in the same event, like this:

C:
void main()
{
    edgeLock();
    number();
}

void edgeLock()
{//Lock the screen edge (for enemies) if take any damage, like SOR4
    void self    = getlocalvar("self");
    void vType    = getentityproperty(self,"type");
    void sType    = getentityproperty(self,"subtype");
    int dead    = getentityproperty(self, "dead");

    if(vType == openborconstant("TYPE_ENEMY")){
        if(sType != openborconstant("SUBTYPE_NOTGRAB")){
            if(!dead){
                changeentityproperty(self, "subject_to_screen", 1);
            }
        }
    }
}

void number()
{
    void self = getlocalvar("self");
    void f;
    int damage = getlocalvar("damage");
    int x, z, a, t;
    int atkType = getlocalvar("attacktype");
   
    if(damage > 0 && atkType != openborconstant("ATK_TIMEOVER"))
    {
        x = getentityproperty(self, "x")+4;
        z = getentityproperty(self, "z")+1;
        a = getentityproperty(self, "a")+40;
        setspawnentry("name", "number");
       
        while(damage)
        {
            t = damage % 10;
            f = spawn();
            changeentityproperty(f, "position", x,z,a);
            updateframe(f, t);
            damage/=10;
            x -= 8;
        }
    }
}
Thank you very much. The functions I want to do have been implemented.
 
Back
Top Bottom