Changing Animations Upon Certain Level Directions

maxman

Well-known member
This has never been asked before, but recently, I started to use an update script on an entity for changing animations, depending on the level direction being set. For example, if I use both, rightleft or right, in levels, I wanna let an entity retain to its anim idle. But if I want to use leftright or left as direction levels, I want it to change to anim follow1.

1up.txt:
Code:
name    1up
health    0
type    item
shadow    0
facing 1
palette none

script
@script
void main(){
    void self = getlocalvar("self");
    int LDir = getlevelproperty("direction");

    if(LDir == "leftright" || LDir == "left"){
        performattack(self, openborconstant("ANI_FOLLOW1"));
    }else{
        setidle(self, openborconstant("ANI_IDLE"));
    }
}
@end_script

anim idle
    loop    1
    delay    80
    offset    14 19
    frame    data/chars/misc/1up.png
    drawmethod tintmode 1
    drawmethod tintcolor 255_255_255
    delay 3
    frame    data/chars/misc/1up.png

anim follow1
    loop    1
    delay    80
    offset    14 19
    frame    data/chars/misc/1up2.png
    drawmethod tintmode 1
    drawmethod tintcolor 255_255_255
    delay 3
    frame    data/chars/misc/1up2.png

I got an error for probably using a level property which causes a crash.

Log:
Code:
Total Ram: 4171603968 Bytes
 Free Ram: 764149760 Bytes
 Used Ram: 6287360 Bytes

debug:nativeWidth, nativeHeight, bpp, Hz  1366, 768, 24, 60
OpenBoR v3.0 Build 6391, Compile Date: Apr  8 2020

Game Selected: ./Paks/ROD MAXED OUT!.pak

FileCaching System Init......    Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............    480x272 (Mode: 1)

Loading menu.txt.............    Done!
Loading fonts................    1 2 3 4 5 6 7 8 Done!
Timer init...................    Done!
Initialize Sound..............   
Loading sprites..............    Done!
Loading level order..........    Done!
Loading model constants......    Done!
Loading script settings......    Done!
Loading scripts..............    Done!
Loading models...............

Joystick: "UNKNOWN" connected at port: 0 at 2025-01-12 09:46:41
Cacheing 'Flash' from data/chars/misc/flash.txt
Cacheing 'Axel' from data/chars/heroes/Axel/axel.txt
Cacheing 'Mai_Frost' from data/chars/mai/mai.txt
Cacheing 'Terry' from data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt
Cacheing 'Aki' from data/chars/Aki/Aki.txt
Cacheing 'Shinryu' from data/chars/heroes/KOF_099_Jhun_Sprite.7z/shinryu.txt
Cacheing 'Clark' from data/chars/heroes/clark/clark.txt
Cacheing 'Athena' from data/chars/heroes/athena/xi/athenaxi.txt
Cacheing 'Mina_Inferno' from data/chars/mina/mina.txt
Cacheing 'Kim' from data/chars/kim/kim.txt
Cacheing 'Evy' from data/chars/Vanessa/Vanessa.txt
Cacheing 'Hanzo' from data/chars/heroes/hanzo/hanzo.txt
Cacheing 'reweap' from data/chars/misc/reweap.txt
Cacheing 'Athena94' from data/chars/heroes/athena/94/athena94.txt
Cacheing 'Atena95' from data/chars/heroes/athena/95/atena95.txt
Cacheing 'Aten94' from data/chars/heroes/athena/aten94.txt
Cacheing 'Aten95' from data/chars/heroes/athena/aten95.txt
Cacheing 'coll1' from data/bgs/select/col1.txt
Cacheing 'coll1b' from data/bgs/select/col1b.txt
Cacheing 'coll2' from data/bgs/select/col2.txt
Cacheing 'coll2b' from data/bgs/select/col2b.txt
Cacheing 'coll3' from data/bgs/select/col3.txt
Cacheing 'coll3b' from data/bgs/select/col3b.txt
Cacheing 'coll4' from data/bgs/select/col4.txt
Cacheing 'coll4b' from data/bgs/select/col4b.txt
Cacheing 'coll5' from data/bgs/select/col5.txt
Cacheing 'coll5b' from data/bgs/select/col5b.txt
Cacheing 'TerrySel' from data/bgs/select/terrysel.txt
Cacheing 'powave' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/powave.txt
Cacheing 'burnknuc' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/burnknuc.txt
Cacheing 'bkdust' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/bkdust.txt
Cacheing 'powdunk' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/powdunk.txt
Cacheing 'JoeD' from data/chars/joe/joed.txt
Cacheing 'JoeNPC' from data/chars/joe/joenpc.txt
Cacheing 'ShermieNPC' from data/chars/shermie/shermienpc.txt
Cacheing 'K'NPC' from data/chars/k/knpc.txt
Cacheing 'Hotdog' from data/chars/misc/hotdog.txt
Cacheing 'Pizza' from data/chars/misc/pizza.txt
Cacheing '1upR' from data/chars/misc/1upR.txt
Cacheing '1upG' from data/chars/misc/1upG.txt
Cacheing '1upB' from data/chars/misc/1upB.txt
Cacheing '1up' from data/chars/misc/1up.txt
Cacheing 'Money' from data/chars/misc/money.txt
Cacheing 'Time' from data/chars/misc/time.txt
Cacheing 'Gold' from data/chars/misc/gold.txt
Cacheing 'Box' from data/chars/misc/box.txt
Cacheing 'Table' from data/chars/misc/table.txt
Cacheing 'Chair' from data/chars/misc/chair.txt
Cacheing 'Fence' from data/chars/misc/fence.txt
Cacheing 'Drum' from data/chars/misc/drum.txt
Cacheing 'Phone' from data/chars/misc/Pbooth.txt
Cacheing 'Joe' from data/chars/joe/joe.txt
Cacheing 'Jones' from data/chars/jones/jones.txt
Cacheing 'K'' from data/chars/k/k.txt
Cacheing 'Cheng' from data/chars/Cheng/Cheng.txt
Cacheing 'Eiji' from data/chars/eiji/eiji.txt
Cacheing 'Lin' from data/chars/lin/lin.txt
Cacheing 'Shermie' from data/chars/enemies/shermie/shermie.txt
Cacheing 'Hwa' from data/chars/hwa/hwa.txt
Cacheing 'Max' from data/chars/max/max.txt
Cacheing 'Genjuro' from data/chars/genjuro/genjuro.txt
Cacheing 'Choi' from data/chars/choi/choi.txt
Cacheing 'Billy' from data/chars/billy/billy.txt
Cacheing 'Seth' from data/chars/seth/seth.txt
Cacheing 'Whip' from data/chars/whip/whip.txt
Cacheing 'Gato' from data/chars/gato/gato.txt
Cacheing 'Geese' from data/chars/Geese/Geese.txt
Cacheing 'no1' from data/chars/no1/no1.txt
Cacheing 'robot' from data/chars/robot/robot.txt
Cacheing 'Knife' from data/chars/misc/knife.txt
Cacheing 'Shot' from data/chars/misc/shot.txt
Cacheing 'Star' from data/chars/misc/star.txt
Cacheing 'light' from data/chars/misc/light.txt
Cacheing 'heli' from data/chars/misc/heli.txt
Cacheing 'rain' from data/chars/misc/rain.txt
Cacheing 'bridge' from data/chars/misc/bridge.txt
Cacheing 'Lucky' from data/chars/bosses/lucky/lucky.txt
Cacheing 'Garcia' from data/chars/enemies/garcia/garcia.txt
Cacheing 'Ruhut' from data/chars/enemies/ruhut/ruhut.txt
Cacheing 'TerryPortA' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryporta.txt
Cacheing 'TerryPortB' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryportb.txt
Cacheing 'TerryPortC' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryportc.txt
Cacheing 'Mike' from data/chars/mike/src_mike.txt
Cacheing 'PhoneB1' from data/chars/misc/phoneb/phone.txt
Cacheing 'PhoneB' from data/chars/misc/phoneb/phoneb.txt
Cacheing 'PhoneA' from data/chars/misc/phoneb/phonea.txt
Cacheing 'birds' from data/chars/misc/birds/birds.txt
Cacheing 'scrSel' from data/bgs/select/scrSel.txt
Cacheing 'selection' from data/bgs/select/selection.txt
Cacheing 'bgmgrid' from data/bgs/select/bgmgrid.txt
Cacheing 'selectR' from data/bgs/select/selectr.txt
Cacheing 'selectG' from data/bgs/select/selectg.txt
Cacheing 'selectB' from data/bgs/select/selectb.txt
Cacheing 'arrowl' from data/chars/misc/arrowl.txt
Cacheing 'St2_Disco1' from data/bgs/3rave2/rave/disco1.txt
Cacheing 'St2_Disco2' from data/bgs/3rave2/rave/disco2.txt
Cacheing 'St2_Laser' from data/bgs/3rave2/rave/laser.txt
Cacheing 'St2_People' from data/bgs/3rave2/rave/people.txt

Loaded 'Flash' from data/chars/misc/flash.txt
Loaded 'Axel' from data/chars/heroes/Axel/axel.txt
Loaded 'Mai_Frost' from data/chars/mai/mai.txt
sound_load_sample can't load sample from file 'data/sounds/mai.wav'!
sound_load_sample can't load sample from file 'data/sounds/mai.wav'!
Loaded 'Terry' from data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt
Loaded 'TerryPortA' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryporta.txt
Loaded 'TerryPortB' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryportb.txt
Loaded 'TerryPortC' from data/chars/heroes/kof_2k3_terry_sprite.7z/terryportc.txt
Command 'if(openborvariant("in_selectscreen")){' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'void' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'int' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'int' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'int' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'int' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'void' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'void' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'void' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'void' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '/*' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'for(){' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '*/' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'if(getlocalvar("remapsfx")' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '/*if(' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '(press' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '||' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command ')' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '{' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'playsample(sfx01,' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'setlocalvar("remapsfx",' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}*/' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'if(map' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'playsample(sfx01,' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'setlocalvar("remapsfx",' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'if(map' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'playsample(sfx02,' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'setlocalvar("remapsfx",' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'if(map' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'playsample(sfx03,' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'setlocalvar("remapsfx",' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'if(getlocalvar("remapsfx")' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command 'setlocalvar("remapsfx",' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '}' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Command '@end_script' not understood in file 'data/chars/heroes/kof_2k3_terry_sprite.7z/terry.txt'!
Loaded 'powave' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/powave.txt
Loaded 'burnknuc' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/burnknuc.txt
Loaded 'bkdust' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/bkdust.txt
Loaded 'powdunk' from data/chars/heroes/kof_2k3_terry_sprite.7z/effects/powdunk.txt
Loaded 'Aki' from data/chars/Aki/Aki.txt
Loaded 'Shinryu' from data/chars/heroes/KOF_099_Jhun_Sprite.7z/shinryu.txt
Loaded 'Clark' from data/chars/heroes/clark/clark.txt
WARNING: data/chars/heroes/clark/clark.txt tries to load a non-numeric value at cancel, where a number is expected!
erroneus string: a
Loaded 'Athena' from data/chars/heroes/athena/xi/athenaxi.txt
Loaded 'aten94' from data/chars/heroes/athena/aten94.txt
Loaded 'aten95' from data/chars/heroes/athena/aten95.txt
Loaded 'Mina_Inferno' from data/chars/mina/mina.txt
Loaded 'Kim' from data/chars/kim/kim.txt
sound_load_sample can't load sample from file 'data/sounds/diepla.wav'!
Loaded 'Evy' from data/chars/Vanessa/Vanessa.txt
Loaded 'Hanzo' from data/chars/heroes/hanzo/hanzo.txt
Loaded 'Athena94' from data/chars/heroes/athena/94/athena94.txt
Command 'if(frame==1){' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'void' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'int' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'int' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'int' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'if(hps==null()){' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'hps' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command '}' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'changeentityproperty(self,"maxhealth",' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'changeentityproperty(self,"health",' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'setglobalvar("hp"' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command '}' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command '@end_script' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'if(frame==1){' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'void' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'int' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'changeentityproperty(self,"maxhealth",' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command 'changeentityproperty(self,"health",' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command '}' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Command '@end_script' not understood in file 'data/chars/heroes/athena/94/athena94.txt'!
Loaded 'Atena95' from data/chars/heroes/athena/95/atena95.txt
Loaded 'coll1' from data/bgs/select/col1.txt
Loaded 'coll1b' from data/bgs/select/col1b.txt
Loaded 'coll2' from data/bgs/select/col2.txt
Loaded 'coll2b' from data/bgs/select/col2b.txt
Loaded 'coll3' from data/bgs/select/col3.txt
Loaded 'coll3b' from data/bgs/select/col3b.txt
Loaded 'coll4' from data/bgs/select/col4.txt
Loaded 'coll4b' from data/bgs/select/col4b.txt
Loaded 'coll5' from data/bgs/select/col5.txt
Loaded 'coll5b' from data/bgs/select/col5b.txt
Loaded 'TerrySel' from data/bgs/select/terrysel.txt

Loading models...............    Done!
Object engine init...........    Done!
Input init...................   
1 joystick(s) found!
UNKNOWN - 2 axes, 10 buttons, 0 hat(s)
Done!
Create blending tables.......    Done!
Save settings so far........    Done!



Can't play music file 'data/music/remix'

Can't play music file 'data/music/<VT_EMPTY>   Unitialized/title.bor'

Can't play music file 'data/music/remix'

Can't play music file 'data/music/remix'

Can't play music file 'data/music/menu'

Can't play music file 'data/music/remix'
Loaded 'scrSel' from data/bgs/select/scrSel.txt
Loaded 'selection' from data/bgs/select/selection.txt
Loaded 'bgmgrid' from data/bgs/select/bgmgrid.txt
Loaded 'selectr' from data/bgs/select/selectr.txt
Loaded 'selectg' from data/bgs/select/selectg.txt
Loaded 'selectb' from data/bgs/select/selectb.txt
Level Loading:   'data/levels/rave02.txt'
Total Ram: 4171603968 Bytes
 Free Ram: 605270016 Bytes
 Used Ram: 51912704 Bytes

Loaded '1up' from data/chars/misc/1up.txt

********** An Error Occurred **********
*            Shutting Down            *

Unable to load updateentityscript '' in file 'data/chars/misc/1up.txt'.
Total Ram: 4171603968 Bytes
 Free Ram: 603721728 Bytes
 Used Ram: 53456896 Bytes

Release level data...........
Level Unloading: 'data/levels/rave02.txt'
Total Ram: 4171603968 Bytes
 Free Ram: 603738112 Bytes
 Used Ram: 53456896 Bytes

RAM Status:
Total Ram: 4171603968 Bytes
 Free Ram: 603770880 Bytes
 Used Ram: 53456896 Bytes

Done!

Release graphics data........    Done!
Release game data............

Unload 'Flash' ............Done.
Unload 'Axel' ............Done.
Unload 'Mai_Frost' ............Done.
Unload 'Terry' ............Done.
Unload 'TerryPortA' ............Done.
Unload 'TerryPortB' ............Done.
Unload 'TerryPortC' ............Done.
Unload 'powave' ............Done.
Unload 'burnknuc' ............Done.
Unload 'bkdust' ............Done.
Unload 'powdunk' ............Done.
Unload 'Aki' ............Done.
Unload 'Shinryu' ............Done.
Unload 'Clark' ............Done.
Unload 'Athena' ............Done.
Unload 'Aten94' ............Done.
Unload 'Aten95' ............Done.
Unload 'Mina_Inferno' ............Done.
Unload 'Kim' ............Done.
Unload 'Evy' ............Done.
Unload 'Hanzo' ............Done.
Unload 'Athena94' ............Done.
Unload 'Atena95' ............Done.
Unload 'coll1' ............Done.
Unload 'coll1b' ............Done.
Unload 'coll2' ............Done.
Unload 'coll2b' ............Done.
Unload 'coll3' ............Done.
Unload 'coll3b' ............Done.
Unload 'coll4' ............Done.
Unload 'coll4b' ............Done.
Unload 'coll5' ............Done.
Unload 'coll5b' ............Done.
Unload 'TerrySel' ............Done.
Unload 'scrSel' ............Done.
Unload 'selection' ............Done.
Unload 'bgmgrid' ............Done.
Unload 'selectR' ............Done.
Unload 'selectG' ............Done.
Unload 'selectB' ............Done.
Unload '1up' ............Done.

Release game data............    Done!
Release timer................    Done!
Release input hardware.......    Done!
Release sound system.........    Done!
Release FileCaching System...    Done!

**************** Done *****************

Unable to load updateentityscript '' in file 'data/chars/misc/1up.txt'.
 
I've tried acquiring levelproperty direction and got crash also but the error message was different.
Code:
Loading scripts..............    Level property 'direction' is not supported.

 Available properties:

    basemap
    bgspeed
    cameraxoffset
    camerazoffset
    gravity
    hole
    maxfallspeed
    maxtossspeed
    quake
    rocking
    scrollspeed
    type
    vbgspeed
    wall


Script compile error in 'update': getlevelproperty line 15, column 20

However, instead of acquiring level direction with script, why not directly declare script to force 1up to perform FOLLOW1 in levels with direction leftright or left?
If that's not practical since 1up could be dropped by obstacles or other entities, you could use global variable which tells all 1ups that it needs to perform FOLLOW1 in levels with direction leftright or left.
 
Back
Top Bottom