Solved Vortex that attracts all enemies on screen

Question that is answered or resolved.

kimono

Well-known member
Hi, I'm trying lately to set a new blender item which spawns a vortex that can attract to its center and damage enemies for a certain period:
I just need to know how the vortex can aspirate them without they are able to do anything to avoid that.
Currently, the vortex is type none, that's why they ignore it.
The archive for testing purpose (stage motobar):

I tried a negative dropv with 0 damage and a second attack when they are near but maybye there is a better solution.
Thanks for your lights :)
 
Last edited:
Solution
@DCurrent

Yeah, I really do not want to put this update script on every entity. The trick here was the "getentity" function, to be honest I never used or even knew what it does, thanks to clarify. For a global script that affects all entities, I think it's the best way.

The only thing I maintained is the "vortexRate" to avoid the script to be connected with every engine cycle, maintaining it "timed", otherwise the fps will change the effect according to the current platform (Windows runs at 200+ fps and Android always at 60 fps or below).

I will update my library with this new script, thanks again.


@kimono

Now the script became more simple to use. All you need to do is to put in the updateentity event on the...
Thanks @Kratus, the script now works perfectly and I like the changing speed according the distance between the vortex and the affected entity :) . I like the way this script can simulate a magnetic force too, this can have many cool applications 8) .

I'm wondering if the opposite force is possible, starting for this script: an entity that generates a wave that pushes other entities away from the source?
Example: A sismic wave that pushes back obstacles and enemies.
@kimono
I'm glad the script worked :)

About the opposite force, you can invert all the "xVel" values from positive to negative or negative to positive.
And yes, you can use it to create a seismic wave or a telekinesis effect.
 
@Kratus: Is it possible to make some obstacles invulnerable to vortex effect? Some parts of the truck makes the scene a little chaotic :) :
jrBDpTy.png

The demo for testing purpose:
 
@kimono
I took a look at the code and saw that the truck parts are obstacles. We have some options:

1) Remove the type "obstacle" from the code to not allow these types to be affected by vortex
2) Let the type "obstacle" type and add each "defaultname" to identify the ones that can't be affected by the vortex

C:
/*
* Check for specific conditions to your module here.
* This example skips non-enemy types.
*/

if( getentityproperty(entity_cursor, "type") != openborconstant("TYPE_ENEMY")&&
   getentityproperty(entity_cursor, "type") != openborconstant("TYPE_OBSTACLE")&&
   getentityproperty(entity_cursor, "defaultname") != "truck00" &&
   getentityproperty(entity_cursor, "defaultname") != "truck01" &&
   getentityproperty(entity_cursor, "defaultname") != "truck02" &&
   getentityproperty(entity_cursor, "defaultname") != "truck03"){

    continue;
}
 
Back
Top Bottom