Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 129
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: Applying Scripts  (Read 20100 times)

0 Members and 1 Guest are viewing this topic.

Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Applying Scripts
« Reply #30 on: July 07, 2007, 12:56:33 am »
Wow.

The Rekko Zan series of moves very clearly illustrates allot of scriptings potential- its one thing to talk about it, but to see it in action... amazing.

I thought of something else that scripting could 'help'-
Quote
Fortunately, script is very good at that and even has a method for switching models without using weapons; though its still experimental.
I remember some discusions on the old Bor Generatiion boards about making models selectable/switchable by use of button pressing instead of the usual way- I'm sure you've already considered this...

Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Re: Applying Scripts
« Reply #31 on: July 07, 2007, 03:32:13 am »
I can't see anything at the moment as I'm away all weekend but I'm sure it looks great. ;) ..... I'd love to see those afterimage effects.

I see my 'frankenspriting' word is catching on lol.

Damn it! I thought I might be the only one using text entities for super effects.  ;D

EDIT: Cleaned up my crazy SMS style post  :-[
« Last Edit: July 07, 2007, 04:44:18 pm by Orochi_X »


* Orochi_X says : " Sore ga doushita? " :looney:

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #32 on: July 07, 2007, 10:25:28 am »
Meh, the afterimages didn't capture very well and neither did the stars. In the module, they are made up of 14 frames running at delay 1 speed to spin smooth as silk and even though it doesn't look like it, they have transparency (even in the mod you have to look close to tell). In the video they look like static projectiles.

The afterimages consist of 2 frames looping at delay 1 with alpha transparency; one is a washed out copy of the character and the other is an all white copy. A script aligns the afterimage at an exact offset with the parent character. This is an almost exact replica of the dash effect for Hanzou used in World Heroes Jet and Prefect (The original versions simulated transparency by flashing off rapidly; we have the real thing here.).

Quote
Damn it! I thought i might be the only one using text entities for super effects. :-D

Sorry, that one is older then the hills.  ;)

If it makes you feel better, you did get Hanzou going first, and as you can see, my sprites won't even come close to your's in quality.

DC
« Last Edit: July 07, 2007, 10:33:47 am by Damon_Caskey »
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Re: Applying Scripts
« Reply #33 on: July 07, 2007, 05:04:05 pm »
Well , I had to come back early to see these videos!  ;)

As expected , the quality is A+ Great job on the frankenspriting.

To be honest , I was joking about all that text entity stuff. With modders like you , MrQ and bonus around , there aren't too many ideas I've come up with that haven't already been tried.....And I'm saving those for MKSF  ;)

your Hanzo looks great....Old school goodness all the way!


* Orochi_X says : " Sore ga doushita? " :looney:

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Applying Scripts
« Reply #34 on: July 08, 2007, 06:02:57 am »
 Thanks for the answer! I'm reading it.

 BTW I've tried the code in 2nd page but it doesn't work. I don't know exactly but I'm guessing it's from animID. I get the anim ID from old OpenBoR code (not so old though).
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline Orochi_X

  • Hero Member
  • *****
  • Posts: 3301
  • Now! Count up your crimes.
Re: Applying Scripts
« Reply #35 on: July 08, 2007, 03:33:29 pm »
This is taken from the latest openbor.h at sourceforge.....

Code: [Select]
ANI_IDLE      0
ANI_WALK    1
ANI_JUMP      2
ANI_LAND      3
ANI_PAIN      4
ANI_FALL      5
ANI_RISE      6
ANI_ATTACK1      7
ANI_ATTACK2      8
ANI_ATTACK3      9
ANI_ATTACK4     10
ANI_UPPER       11
ANI_BLOCK      12
ANI_JUMPATTACK      13
ANI_JUMPATTACK2      14
ANI_GET      15
ANI_GRAB      16
ANI_GRABATTACK      17
ANI_GRABATTACK2       18
ANI_THROW       19
ANI_SPECIAL      20
ANI_FREESPECIAL      21
ANI_SPAWN      22
ANI_DIE      23
ANI_PICK      24     // 7-1-2005 used when players select their character at the select screen
ANI_FREESPECIAL2 25
ANI_JUMPATTACK3      26
ANI_FREESPECIAL3     27
ANI_UP      28
ANI_DOWN      29
ANI_SHOCK      30
ANI_BURN      31
ANI_SHOCKPAIN      32
ANI_BURNPAIN      33
ANI_GRABBED      34
ANI_SPECIAL2      35
ANI_RUN      36
ANI_RUNATTACK     37
ANI_RUNJUMPATTACK       38
ANI_ATTACKUP      39
ANI_ATTACKDOWN      40
ANI_ATTACKFORWARD      41
ANI_ATTACKBACKWARD      42
ANI_FREESPECIAL4      43
ANI_FREESPECIAL5      44
ANI_FREESPECIAL6      45
ANI_FREESPECIAL7      46
ANI_FREESPECIAL8      47
ANI_RISEATTACK       48
ANI_DODGE      49
ANI_ATTACKBOTH      50
ANI_GRABFORWARD      51
ANI_GRABFORWARD2     52
ANI_JUMPFORWARD      53
ANI_GRABDOWN      54
ANI_GRABDOWN2      55
ANI_GRABUP      56
ANI_GRABUP2      57
ANI_SELECT       58
ANI_DUCK        59
ANI_FAINT       60
ANI_CANT       61
ANI_THROWATTACK       62
ANI_CHARGEATTACK        63
ANI_VAULT      64
ANI_JUMPCANT       65
ANI_JUMPSPECIAL      66
ANI_BURNDIE        67
ANI_SHOCKDIE      68
ANI_PAIN2        69
ANI_PAIN3       70
ANI_PAIN4       71
ANI_FALL2       72
ANI_FALL3       73
ANI_FALL4       74
ANI_DIE2       75
ANI_DIE3       76
ANI_DIE4       77
ANI_CHARGE       78
ANI_BACKWALK        79
ANI_SLEEP       80
ANI_FOLLOW1        81
ANI_FOLLOW2        82
ANI_FOLLOW3        83
ANI_FOLLOW4        84
ANI_PAIN5       85
ANI_PAIN6       86
ANI_PAIN7       87
ANI_PAIN8       88
ANI_PAIN9       89
ANI_PAIN10       90
ANI_FALL5       91
ANI_FALL6       92
ANI_FALL7       93
ANI_FALL8       94
ANI_FALL9        95
ANI_FALL10       96
ANI_DIE5      97
ANI_DIE6      98
ANI_DIE7       99
ANI_DIE8       100
ANI_DIE9       101
ANI_DIE10          102
ANI_TURN                 103   
ANI_RESPAWN              104   
ANI_FORWARDJUMP          105
ANI_RUNJUMP              106
ANI_JUMPLAND             107
ANI_JUMPDELAY            108
ANI_HITWALL              109

I'm not sure what id's the new unlimited animations are given.....Maybe DC or SX can help with that?

If I had to guess , I would probably say that they are dynamic....They would be tagged on at the end as you used them??  :hmm:


* Orochi_X says : " Sore ga doushita? " :looney:

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #36 on: July 08, 2007, 06:42:20 pm »
I don't have any clue. I just use a debug script that tells me what the ID of a given animation is during runtime; then I know.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #37 on: July 09, 2007, 11:37:51 am »
Oh, and here is said debug script. It's very expensive but that's no big thing since it's purly for development use. Place the script in scripts and then add this line to the entity header of a character you want to test: "script data/scripts/deb001.c". When the character (presumably a PC, but it doesn't have to be) is on screen the following info will be displayed. Only put it on one character at a time though, or you'll have a mass of unreadable text.

Life: Current HP, max HP, and %.
Animation: The current animation ID and frame.
Vars: For me, these are the current values of assigned variables I use for certain actions (forcing a target to move in synch with the player, finite animation loops, etc.). Usually they show as "NA" and always will for you unless you happen to assign a variable exactly like I do.
Target: The nearest opponent handle and name.
Range: X, Y, and Z ranges of nearest opponent. Remember to watch for negative values on the X and Z axis. This is invaluable for setting up range values.

Code: [Select]
void main(){

    //Damon Vaughn Caskey
    //05/01/2007
    //
    //Provides various debuging information on screen for module building use.
   
    void vSelf = getlocalvar("self"); //Get calling entity.
    void vTarget = findtarget(vSelf); //Get nearest opponent to caller.
    void vTargetProp = "None"; //Target information display.
    void vValue1 = getglobalvar("1" + vSelf); //Get 1st global var assigned to caller (if any).
    void vValue2 = getglobalvar("2" + vSelf); //Get 2nd global var assigned to caller (if any).
    void vValue3 = getglobalvar("3" + vSelf); //Get 3rd global var assigned to caller (if any).
    void vValue4 = getglobalvar("4" + vSelf); //Get 4th global var assigned to caller (if any).
    float fMaxHP = getentityproperty(vSelf, "maxhealth"); //Get caller's maximum HP.
    int iHP = getentityproperty(vSelf, "health"); //Get caller's current HP.
    float fHP = iHP + 0.0; //Convert and store caller's HP as decimal.
    int iScale = fHP / fMaxHP * 100; //Find remaining % of callers HP.
    float fDisX = 0; //X distance to nearest opponent.
    float fDisY = 0; //Y distance to nearest opponent.
    float fDisZ = 0; //Z distance to nearest opponent.

    if (vTarget){ //Is there a valid opponent in range?

       fDisX = getentityproperty(vSelf, "x") - getentityproperty(vTarget, "x"); //Get X distance to nearest opponent.
       fDisY = getentityproperty(vSelf, "a") - getentityproperty(vTarget, "a"); //Get Y distance to nearest opponent.
       fDisZ = getentityproperty(vSelf, "z") - getentityproperty(vTarget, "z"); //Get Z distance to nearest opponent.
       
       vTargetProp = vTarget + " (" + getentityproperty(vTarget, "model") + ")"; //Get target model name.
     
    }

    if (iScale <= 0){ //Is % of HP vs. MaxHP equal to or below 0?

iScale = 0; //Set to 0/

    }else{ //% of HP vs. MaxHP is > 0.

iScale %= (++iScale); //Convert decimal to whole number.

    }

    if (!(vValue1)) { vValue1 = "NA"; } //If no 1st global var assigned to caller, display "NA".
    if (!(vValue2)) { vValue2 = "NA"; } //If no 2nd global var assigned to caller, display "NA".
    if (!(vValue3)) { vValue3 = "NA"; } //If no 3rd global var assigned to caller, display "NA".
    if (!(vValue4)) { vValue4 = "NA"; } //If no 4th global var assigned to caller, display "NA".

    drawstring(4, 70, 0, "Life: " + iHP + "/" + fMaxHP + " (" + iScale + "%%)"); //Draw health.
    drawstring(4, 80, 0, "Anim ID: " + getentityproperty(vSelf, "animationid") + ", Frame: " + getentityproperty(vSelf, "animpos")); //Draw animation properties.
    drawstring(4, 90, 0, "Vars: 1. " + vValue1 + ", 2. " + vValue2 + ", 3. " + vValue3 + ", 4. " + vValue4); //Draw assigned var values.
    drawstring(4, 100, 0, "Target: " + vTargetProp); //Draw target name.
    drawstring(4, 110, 0, "Range: X:" + fDisX); //Draw target X range.
    drawstring(4, 120, 0, "             Y:" + fDisY); //Draw target Y range.
    drawstring(4, 130, 0, "             Z:" + fDisZ); //Draw target Z range.
           
}

Like any script, this can easily be tweaked and rewritten to suit your individual needs, but don't get any bright ideas about modifying it to put in game text on the screen; Every single text character is technically a sprite, and the drawstring method only works as part of an update script. These two caveats make putting text on screen extremly expensive and not something you normally want to try outside of debugging even on a powerful computer. If you do try it, make it rare and make it count.

More to come..

DC
« Last Edit: July 09, 2007, 11:57:35 am by Damon_Caskey »
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Applying Scripts
« Reply #38 on: July 10, 2007, 04:43:46 am »
 Sorry guys, apparently I'm setting strict rule (key must be pressed at 3rd frame). I'm holding the button instead of pressing right when 3rd frame is played. I have changed the rule to key must be pressed after 2nd frame and it works now. Thanks for the info anyway.
 But, it doesn't work for 2nd player though. What should I do to fix it?

 I also tried to make alternate running attack but apparently it's buggy. It works but the animation stopped immediately after it is played and running continues.

 Hmmm... I need more functions than just these.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #39 on: July 10, 2007, 08:38:46 am »
Which script is not working for player 2?

All the functions in "lib001" should auto detect the player index and work work for any player. The "key#" script is a little different though. You have to duplicate the script file for each player (key1.c, key2.c, key3.c, key4.c) and change the index in each copy to match the player it runs for (0 = Pl1, 1 = Pl1, 2 = Pl3, 3 = Pl 4).

Inside of the keyscript though, you can turn right around and run playerkeys() on other indexes to find out if another player is holding down a key, or even use variables mixed and matched from each keyscript so as to create tag team moves with true key catures all around (lay, both players press U + A at same time while close, and they do a big double clothsline or whatever).

As for the run attack, I'm not sure what the problem is. I can tell you that I have several that work fine for me, and that most of what I am posting is simplified and or truncated from what I am actually applying in my module; so I know it works. On the other hand, script DOES have a bug or two; notably, certain combinations of frames (seems to be random, I can't pin it down), will cause instant teleportation to a corner during animation switching.

Post up what you have and maybe I can take a look.

DC

OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline zamuel

  • Commercial
  • Hero Member
  • *****
  • Posts: 564
Re: Applying Scripts for fun and profit
« Reply #40 on: July 10, 2007, 09:41:07 pm »
Just browsing and noticed this...

Quote
Can levels be made bigger- or more 'interactive' with scripting? Specifically, could you make the playing-field less pedestrian- like going right,then down a ladder then left again, etc.?

More interactive? You bet! Bigger? No. You actually don't even have to use scripts to do tricks like ladder climbing and such, but even with script there is no way I know of to scroll the playing field on any plane other then the one it is set for.

I thought this was doable.  I thought that at one point, back before the switch from BorGen, utunnels had made an update that allowed Z scrolling as well as X if your playing field settings were bigger than the screen.  They were enhanced by walls, hole, and platforms.  While he was using it to mimic the terrain shifts in Golden Axe, using blockade and setting the scrol direction to 'both' just might pull it off.  You would need a lot of visual trickery to get ladders to work (since there is no true Y scrolling) but bridges that expand on the Z axis should work.

*EDIT by DC* Just fixed the post for you Zamuel. You had inadvertently enclosed your own comments in the quote box.
« Last Edit: July 11, 2007, 12:46:27 am by Damon_Caskey »
FOLH Progress
Primary game: Done!
Extra mode: Done!

Street Team: Reign of the Iron Dragon - http://lavalit.com:8080/index.php/topic,6240.0.html

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #41 on: July 11, 2007, 12:49:32 am »
It may well be doable, just not to my knowledge; thus why I said "there is no way I know of" to do it.

As far as I knew, UT gave up on the idea and instead went for standard platform and walls to get the effect he wanted without completing it. I'll do some hunting and see if I am wrong. It would be cool to find out I am.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Applying Scripts
« Reply #42 on: July 14, 2007, 03:39:46 am »
The "key#" script is a little different though. You have to duplicate the script file for each player (key1.c, key2.c, key3.c, key4.c) and change the index in each copy to match the player it runs for (0 = Pl1, 1 = Pl1, 2 = Pl3, 3 = Pl 4).

Ah, so that's why! I duplicate the code for 2nd player in same key1.c, no wonder it doesn't work.
 Let me give it a try first. BTW that means each hero must use all of those 4 different scripts (at least) right? Eh, or just 2 for 2 players.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: Applying Scripts
« Reply #43 on: July 14, 2007, 08:24:30 am »
You don't duplicate the key# script for a character, you duplicate it for a player. Key1.c always activates when player 1 pushes a key, key2.c for player 2 and so on; it doesn't matter what character the player is controlling. Essentially the key scripts should all by identical except for their name and the player index in the script.

Within key script itself you will need to check for different characters and then have them respond to whatever keys you have in mind.

Code: [Select]

if (vName == "Hanzou"){ //Playing as Hanzou?

       ...Hanzou's key capture checks and actions.

}else if (vName == "Joe"){ //Playing as Joe?

       ...Joe's key capture checks and actions.

}else if (vName == "Ryu"){ //Playing as Ryu?

       ...Ryu's key capture checks and actions.

}

And so on...

Now technically you don't HAVE to do it like I do; that's the nifty thing with script. You could for example parse through the actions and once the right one is found you check for the character. I would recommend using my method though, because of efficiency. Remember that whether or not an action takes place the script still runs every time a key is pressed AND released. It's obviously important to program as efficiently as you can and check for the largest scope first, which will almost always be what character is being played. So then if I have 15 moves for Joe, but the player is controlling Ryu, then engine doesn't have to check the 15 items Joe; it skips right over them. This is a tiny gain to be sure, but every little bit counts.

DC
« Last Edit: July 14, 2007, 08:39:14 am by Damon_Caskey »
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Applying Scripts
« Reply #44 on: July 15, 2007, 12:39:15 pm »
 I think we're talking in different frequency here DC. OK, before it gets worse, I want to ask something:
1. Why key#.c can be used without 'animationscript' command?
2. Why the previous code (in 1st page) need to use that command?

 While I'm here I want to ask this also:
1. You said in other thread that I could force enemy to play certain animation. How to do it?
2. Is there a way to force enemy to be in certain condition such as falling? I want to make an attack that knock down enemy even if the enemy uses nodrop.

 Oh yes, this is the code for alternate runningattack:

Code: [Select]
if (vAniID == 36){ // Running?
                 
              if (iAttack3){
                       
                 changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW6")); //Switch to desired animation.
                 changeentityproperty(vSelf, "animpos", 0); //Switch to desired frame.           
   
              }
     }

 Like I said, hero plays FOLLOW6 very quick then continues running when I try it. I'm aware of the issues you mentioned, just not sure what's the side effect for this code.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal