hey guys is there a script to force desired agression value to any enemy entity spawned in the level regardlees of it´s spawned method?
hey damon i know.. i was refering to alternate spawn methods like using entity spawners in wich you cant alter agression values in the level itself, you would have to edit the spaener entity it self... my ide was something like puting a script line in a dumy enity like setglobalvar("agression 300" = agression 5); so the any entity with agression 300 on his header would switch to agression 5 when spawned in that level.. of course this is hipotetical as i dont know if such script would work or how to make it so..You don't need script for that.
Aggression is a level spawn command too, and it overrides the model's default aggression setting.
DC
for dificulty set ups, otherway would have to make deeper modifications or leave as it is.....I can imagine coding something to alter all active enemies with aggression 300 to aggression 5. However the question is what's the logic behind this?
one way to do this is checking the openborvariant "current_set" and changing the aggression on the enemy spawn.for dificulty set ups, otherway would have to make deeper modifications or leave as it is.....
@Gurtag +1 to this idea, I suggest the same.one way to do this is checking the openborvariant "current_set" and changing the aggression on the enemy spawn.
I have some code like this on my enemies as their onspawnscript, but i my case it checks the number of players or npc and change it.
Works fine. Unless you set an alternative spawn animation on your level - then your onspawnscript get skipped.
@Gurtag If I understood correctly, you don't need a dummy entity for that. Just add a onspawnscript event in all your enemies (or at least in the ones you want) and the aggression will be changed automatically as soon as they spawn in the specified level (branch).my ide was something like puting a script line in a dumy enity like setglobalvar("agression 300" = agression 5);
onspawnscript data/scripts/onspawn.c
void main()
{
void self = getlocalvar("self");
void branch = openborvariant("current_branch");
int currentAggression = getentityproperty(self, "aggression");
int targetAggression = 300;
int newAggression = 5;
// GET THE CURRENT BRANCH NAME (LEVEL) AND THE CURRENT AGGRESSION.
// IF BOTH MATCHES, CHANGE THE AGGRESSION TO 5.
if(branch == "branch_name" && currentAggression == targetAggression)
{
changeentityproperty(self, "aggression", newAggression);
}
}
hey man .. like ilu sayd it will not work if some cases uses a follow# instead of the spawn or whatever anim has the onspawnscript...@Gurtag +1 to this idea, I suggest the same.
@Gurtag If I understood correctly, you don't need a dummy entity for that. Just add a onspawnscript event in all your enemies (or at least in the ones you want) and the aggression will be changed automatically as soon as they spawn in the specified level (branch).
First call the onspawn event in every character header like this:
And inside the onspawn.c, copy/paste the code below:
Code:void main() { void self = getlocalvar("self"); void branch = openborvariant("current_branch"); int currentAggression = getentityproperty(self, "aggression"); int targetAggression = 300; int newAggression = 5; // GET THE CURRENT BRANCH NAME (LEVEL) AND THE CURRENT AGGRESSION. // IF BOTH MATCHES, CHANGE THE AGGRESSION TO 5. if(branch == "branch_name" && currentAggression == targetAggression) { changeentityproperty(self, "aggression", newAggression); } }
@Gurtag Friend, I don't know if we are talking about the same situation, but in the SORX I use follow animations as a spawn animations and works fine.hey man .. like ilu sayd it will not work if some cases uses a follow# instead of the spawn or whatever anim has the onspawnscript...
##MAIN
name GalsiaB
type enemy
##LIFE
health 1 #SCRIPT
##POWER
offense 1 #SCRIPT
##SPEED
speed 1 #SCRIPT
##JUMP
jumpheight 1 #SCRIPT
##WEIGHT/HEIGHT
antigravity -1 #-1/-2/-3
height 74
##MISC
jugglepoints 60
guardpoints 20
guardrate 2
risetime 170
riseinv 0 1 #HEROES/BOSSES=0.5 - ENEMIES=0
makeinv 2 0
atchain 1
weapons Galsia_KnifeB none none none none none none none none GalsiaB
shadow 3
dust Dust
noquake 1 0
death 2
score -1 5 #MAINTAIN SCORE MULTIPLIER WHILE CHANGING MODELS
##SCRIPTS
didhitscript data/scripts/didhit/default.c
ondoattackscript data/scripts/ondoattack/default.c
onblockpscript data/scripts/onblockp/default.c
onblockwscript data/scripts/onblockw/default.c
onblocksscript data/scripts/onblocks/default.c
onmoveascript data/scripts/onmove/default.c
onmodelcopyscript data/scripts/onmodelcopy/default.c
ondrawscript data/scripts/ondraw/default.c
onspawnscript data/scripts/onspawn/galsia.c
ondeathscript data/scripts/ondeath/default.c
animationscript data/scripts/animation/default.c
takedamagescript data/scripts/takedamage/default.c
thinkscript data/scripts/think/default.c
script data/scripts/updateentity/default.c
##ICONS
icon data/sprites/icons/Galsia.png 1
##REMAPS
palette data/chars/enemies/galsia/sor3/_palette.png
alternatepal data/chars/enemies/galsia/sor3/alter1.png
alternatepal data/chars/enemies/galsia/sor3/alter2.png
alternatepal data/chars/enemies/galsia/sor3/alter3.png
alternatepal data/chars/enemies/galsia/sor3/alter4.png
alternatepal data/chars/enemies/galsia/sor3/alter5.png
alternatepal data/chars/enemies/galsia/sor3/alter6.png
alternatepal data/chars/enemies/galsia/sor3/alter7.png
alternatepal data/chars/enemies/galsia/sor3/alter8.png
##LOADS
load Galsia_KnifeB
## CUSTOM ANIMATIONS ##########################################################################
anim follow20 #WAIT SPAWN (GALSIA HIDE)
fshadow 0
loop 0
delay 12
offset 133 169
@cmd frozen 1
@cmd minz 0
@cmd flipTarget
drawmethod tintmode 2
drawmethod tintcolor 0_0_0
frame data/chars/enemies/galsia/sor3/hide00.png
@cmd delayDetect
fshadow 3
@cmd dasher 0 0 0.5
drawmethod tintmode 2
drawmethod tintcolor 0_0_0
frame data/chars/enemies/galsia/sor3/walk00.png
drawmethod tintmode 2
drawmethod tintcolor 20_20_20
frame data/chars/enemies/galsia/sor3/walk01.png
drawmethod tintmode 2
drawmethod tintcolor 40_40_40
frame data/chars/enemies/galsia/sor3/walk00.png
drawmethod tintmode 2
drawmethod tintcolor 80_80_80
frame data/chars/enemies/galsia/sor3/walk02.png
drawmethod tintmode 2
drawmethod tintcolor 120_120_120
frame data/chars/enemies/galsia/sor3/walk00.png
drawmethod tintmode 2
drawmethod tintcolor 160_160_160
frame data/chars/enemies/galsia/sor3/walk01.png
drawmethod tintmode 2
drawmethod tintcolor 200_200_200
@cmd minz 1
frame data/chars/enemies/galsia/sor3/walk00.png
nodrawmethod
@cmd frozen 0
bbox 119 99 26 72
frame data/chars/enemies/galsia/sor3/walk02.png
anim follow21 #WAIT SPAWN (GALSIA JUMP)
fshadow 0
loop 1
delay 16
offset 133 169
@cmd frozen 1
@cmd gravity 0
frame data/chars/enemies/galsia/sor3/jumpdelay00.png
@cmd cancel -999 100 -999 999 -999 999 openborconstant("ANI_FOLLOW22") "change"
frame data/chars/enemies/galsia/sor3/jumpdelay00.png
anim follow22 #LOOP STOP
fshadow 3
loop 0
delay 12
offset 133 169
@cmd hitfx "data/sounds/sor3_hit.wav"
@cmd sound "data/sounds/sor3_jumping.wav"
@cmd gravity 1
@cmd leaper 1 0.8 0.2
frame data/chars/enemies/galsia/sor3/jump00.png
@cmd frozen 0
@cmd jump 1
@cmd sound "data/sounds/sor3_attack.wav"
frame data/chars/enemies/galsia/sor3/jumpatk00.png
attack 130 112 31 30 4 1 0 0 10 12
bbox 109 107 44 45
@cmd voice "data/voices/sor3_enemy_attack.wav"
frame data/chars/enemies/galsia/sor3/jumpatk01.png
anim follow23 #WAIT SPAWN (GALSIA BOAT)
fshadow 0
loop 1
delay 8
offset 133 169
@cmd frozen 1
@cmd minz 0
@cmd setLayer -50
frame data/chars/enemies/galsia/sor3/jumpdelay00.png
@cmd aniXpos 60 1 openborconstant("ANI_FOLLOW24")
frame data/chars/enemies/galsia/sor3/jumpdelay00.png
anim follow24 #LOOP STOP
fshadow 3
loop 0
delay 8
offset 133 169
@cmd sound "data/sounds/sor3_jumping.wav"
@cmd setLayer 0
@cmd leaper 0 4 0.2
frame data/chars/enemies/galsia/sor3/jump00.png
@cmd jump 1
@cmd minz 1
frame data/chars/enemies/galsia/sor3/jump00.png
@cmd frozen 0
frame data/chars/enemies/galsia/sor3/jump00.png
## DEFAULT ANIMATIONS #########################################################################
anim spawn
loop 0
delay 1
offset 133 169
frame data/chars/enemies/galsia/sor3/idle00.png
anim idle
loop 1
delay 16
offset 133 169
bbox 119 99 26 72
@cmd clearL
frame data/chars/enemies/galsia/sor3/idle00.png
frame data/chars/enemies/galsia/sor3/idle01.png
frame data/chars/enemies/galsia/sor3/idle02.png
frame data/chars/enemies/galsia/sor3/idle01.png
anim walk
loop 1
delay 16
offset 133 169
bbox 119 99 26 72
frame data/chars/enemies/galsia/sor3/walk00.png
frame data/chars/enemies/galsia/sor3/walk01.png
frame data/chars/enemies/galsia/sor3/walk00.png
frame data/chars/enemies/galsia/sor3/walk02.png
You have to just add one single line in your enemies. An other method that may works is by using the @DCurrent enumeration script in a update event (maybe in the current level update), then it can detect every enemy and change the aggression automatically.my idea behind this was to set that agrssion value and force it in that specific level regardless of the way and/or animation the enemies spawn in it, that way i dont have to mod/clone/replace code on all my enemies and levels just for a dificulty seting wich only depends of a single parameter...
updatescript data/scripts/branch_name.c

void main()
{
/*
* Caskey, Damon V.
* 2022-01-26
*
* Example function to enumerate the entity
* collection and take action on each
* if they meet specfifc conditions.
*/
void entity_cursor = NULL();
int entity_count = openborvariant("count_entities");
int entity_index = 0;
int exists = 0;
int targetAggression = 300;
int newAggression = 5;
for(entity_index = 0; entity_index < entity_count; entity_index++){
entity_cursor = getentity(entity_index);
if(!entity_cursor){
continue;
}
exists = getentityproperty(entity_cursor, "exists");
if(!exists){
continue;
}
if(getentityproperty(entity_cursor, "aggression") != targetAggression){
continue;
}
/* Take your actions here. Sucking in, doing damage, etc. */
changeentityproperty(entity_cursor, "aggression", newAggression);
}
}
@Gurtag +1 to this idea, I suggest the same.
@Gurtag If I understood correctly, you don't need a dummy entity for that. Just add a onspawnscript event in all your enemies (or at least in the ones you want) and the aggression will be changed automatically as soon as they spawn in the specified level (branch).
First call the onspawn event in every character header like this:
And inside the onspawn.c, copy/paste the code below:
Code:void main() { void self = getlocalvar("self"); void branch = openborvariant("current_branch"); int currentAggression = getentityproperty(self, "aggression"); int targetAggression = 300; int newAggression = 5; // GET THE CURRENT BRANCH NAME (LEVEL) AND THE CURRENT AGGRESSION. // IF BOTH MATCHES, CHANGE THE AGGRESSION TO 5. if(branch == "branch_name" && currentAggression == targetAggression) { changeentityproperty(self, "aggression", newAggression); } }