• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Script for attack{#}?

Bruce

Active member
Hello everyone,

is there a way to use it in script?
Code:
attack{#} {x} {y} {right} {down} {damage} {power} {block} {noflash} {pausetime} {z}
dropv _  _
?

I have the situation where I want to damage and knock up the target at certain distance and height depending on the player location.
I can't seem to find the script for attack{#} or similar (sorry if there is one on the forum already).

There are

Code:
        damageentity(target, self, 0, 0, openborconstant("ATK_NORMAL9"))
        changeentityproperty(target, "attacking", 1);
        changeentityproperty(target, "damage_on_landing", Damage);
        changeentityproperty(target, "projectile", 1);
        changeentityproperty(target, "direction",TargetDir);
        tossentity(target, Y, x, 0); // Toss opponent ;)

But it is not the same.

Sorry for the noob question and thank you so much.
 
Last edited:
Well, the script you've quoted above has the scripts that you need to achieve your goal.
What you need is to clarify these:
1. Who is the target? last enemy player interacted with? random active enemy on the field? or only grabbed enemy?
2. What does "depending on the player location" mean?
 
Well, the script you've quoted above has the scripts that you need to achieve your goal.
What you need is to clarify these:
1. Who is the target? last enemy player interacted with? random active enemy on the field? or only grabbed enemy?
2. What does "depending on the player location" mean?
I should have stated targets instead of target in the 1st post.
My goal is to try to create a wall splatter workaround without having to modify the fall animation of hundreds of enemy files.
My workaround is simple:
the player spawns the wall, then hits the targets to the wall, then the wall sends them back to the player for more combos.
I want to be able to control how fast and how high the player can juggle the targets to the wall,
and how fast and how high the wall can send them back to the player.
This way the player can continue hitting the targets after the targets are sent back to the player.

I am able to achieve it for single target with this:
Code:
attackone 0

spawn a wall
@cmd     WallSplatter 5 5.7 9
wallscript:
Code:
WallSplatter (int damage, int height, int Type) {   
    void self = getlocalvar("self");
    void target = getlocalvar("Target" + self);
    int TargetDir = getentityproperty(target,"direction");
    int PlayerDir = getentityproperty(self,"direction");
    int ScreenRes = openborvariant("hResolution"); // Get screen width
    float fX = getentityproperty(self, "x");
    int LowestXCord = openborvariant("xpos");
    int PlayerPos = fX - LowestXCord;
        ........
        ........
        damageentity(target, self, 0, 0, openborconstant("ATK_NORMAL9"))
        changeentityproperty(target, "attacking", 1);
        changeentityproperty(target, "damage_on_landing", Damage);
        changeentityproperty(target, "projectile", 1);
        changeentityproperty(target, "direction",TargetDir);
        tossentity(target, Y, x, 0); 
}
To be honest, I don't like using tossentity function...


MY goal is to be able to send multiple targets within the attack box to the wall with a script for this:
Code:
attackone 0
attack11 347 226 90 124    5 1 _ _ __Z
dropv _  _
Within the script I am able to use player's current position to control the height and the speed/distance of the targets

I hope it makes sense lol,

thank you
 
the player spawns the wall, then hits the targets to the wall, then the wall sends them back to the player for more combos.

So let me confirm this:
1. Player spawns a wall so the enemies are between player and the wall
2. Player knocks enemies toward the wall
3. The wall knocks enemies back toward player

You need script to ensure the knocked enemies would reach player no matter their momentum and position when touching the wall, right?
 
So let me confirm this:
1. Player spawns a wall so the enemies are between player and the wall
2. Player knocks enemies toward the wall
3. The wall knocks enemies back toward player

You need script to ensure the knocked enemies would reach player no matter their momentum and position when touching the wall, right?
Yep, that's right
 
My suggestion to solve that is to use didhitscript like this:
WallJugl.c
C:
void main(){
// Wallder's didhitscript
  void self = getlocalvar("self");
  void target = getlocalvar("damagetaker");
  int Par = getentityproperty(self, "parent");

  if(Par){
    int x = getentityproperty(target, "x");
    int z = getentityproperty(target, "z");
    int Px = getentityproperty(Par, "x");
    int Pz = getentityproperty(Par, "z");

    int Vx = (Px - x)/60;
    int Vz = (Pz - z)/60;

    tossentity(target, 3, Vx, Vz);
  }
}

Save that script in data/scripts folder.

Declare it in wall's header text with this line:
didhitscript data/scripts/walljugl.c

In order of this to work, the wall must be spawned as player's child or player must be wall's parent.
If done right, whenever wall hits an enemy, it will knock him/her/it toward player no matter where player is.
 
Save that script in data/scripts folder.

Declare it in wall's header text with this line:
didhitscript data/scripts/walljugl.c

In order of this to work, the wall must be spawned as player's child or player must be wall's parent.
If done right, whenever wall hits an enemy, it will knock him/her/it toward player no matter where player is.
Somehow it is not working for me with your Spawn and Bind script.
Doesn't your spawn and bind script automatically assign the wall to the player?
I am sure I must be doing something wrong. I will try to play with it again when I get a chance.
Check out this video and thanks to everyone on this forum who has helped me!:
I missed the juggle a few times because the wall couldn't throw the target to the player correctly.
I was actually using dropv values for it though.
 
My suggestion to solve that is to use didhitscript like this:
WallJugl.c
C:
void main(){
// Wallder's didhitscript
  void self = getlocalvar("self");
  void target = getlocalvar("damagetaker");
  int Par = getentityproperty(self, "parent");

  if(Par){
    int x = getentityproperty(target, "x");
    int z = getentityproperty(target, "z");
    int Px = getentityproperty(Par, "x");
    int Pz = getentityproperty(Par, "z");

    int Vx = (Px - x)/60;
    int Vz = (Pz - z)/60;

    tossentity(target, 3, Vx, Vz);
  }
}

Save that script in data/scripts folder.

Declare it in wall's header text with this line:
didhitscript data/scripts/walljugl.c

In order of this to work, the wall must be spawned as player's child or player must be wall's parent.
If done right, whenever wall hits an enemy, it will knock him/her/it toward player no matter where player is.

I have tried everything but it did not work, so I finally figured that I just assign the child to the parent directly in your didhit script and modified a the values a bit. It is working for me, but I am no sure if this would cause any issues to the Opbenbor engine.
Can you please take a look and see if this would cause any Openbor engine issues such as heavy load, , etc...?
Thank you so much
Code:
void main(){
    // Wallder's didhitscript
    void self = getlocalvar("self");
    void target = getlocalvar("damagetaker");
    void player;
    int i;
   
    for(i = 0; i < 4; i++){  
        player = getplayerproperty(i, "entity");
        if(player != NULL()){
            changeentityproperty(self, "parent", player);
        }
    }
    int Par = getentityproperty(self, "parent");

    if(Par){
        int x = getentityproperty(target, "x");
        int z = getentityproperty(target, "z");
        int Px = getentityproperty(Par, "x");
        int Pz = getentityproperty(Par, "z");

        int Vx = (Px - x)/100;
        int Vz = (Pz - z)/100;

        //tossentity(entity, height, speedx, speedz)
        tossentity(target, 1.5, Vx, Vz);
    }
}
 
It might work but kinda redundant IMO since parent won't change.

Anyways, I forgot to ask this before, how do you spawn this Wallder or whatever name you give to the entity? just spawn it and let it walk on its own or spawn then bind it to player who spawns it?
 
It might work but kinda redundant IMO since parent won't change.

Anyways, I forgot to ask this before, how do you spawn this Wallder or whatever name you give to the entity? just spawn it and let it walk on its own or spawn then bind it to player who spawns it?
I figured it is redundant, that's why I was concerned if the for-loop player check function within the didhitscript would overload the Openbor engine later.
Regardless, although it is working fine, I do not think it is a good practice to have the for-loop player check within the didhitscript like that as it would loop 4 times to check for the players instead of 1 time. If 4 players are active and they are using this didhitscript at the same time, there could be a problem...

I have tried your spawn and bind script and assigned the spawned entity to the parent with the bind# or by the entity name "Wall" within your spawn and bind script, but it did not work.
I did the same thing to spawn by the screen resolution script, same result. However, I forgot about the spawnframe and summonframe functions, so I have not tried them yet and I am at work right now, even so I don't know where to assign the spawned entity to the parent.
Maybe if I spawn a "Wall" entity using the spawnframe or summonframe in the player.c, I can assign the spawned entity to the parent like below?

Code:
@script       
    if(frame == __){
        void self = getlocalvar("self");
        void Child = getentityproperty("Wall", "entity");
        changeentityproperty(Child, "parent", self);
    }
@end_script

Spawning an entity is tricky and confusion for me for now, but I will get it eventually.
Your spawn and bind script is useful for me, and I will fix my summon skills using this script later.
I found a problem with the summonframe function that whenever I spawned an entity called "Helper" using this summonframe function,
spawning another entity called "Super" using this same summonframe function will not work.
I thought summonframe function was only allowed to spawn the same entity 1 entity at a time, but "Helper" and "Super" are 2 different entities.
Can you please give me some advise on this?

Thank you
 
I added the code below to the SpawnByScreenRes script, and it is working fine without having to include the for-loop in the WallJugl.c.
Basically, your WallJugl.c works! Thank you so much.
Code:
changeentityproperty(Spawn, "parent", self);

Is there a reason why there is no option to mark it as the answer in this topic?
 
Last edited:
Back
Top Bottom