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: 7
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: OpenBoR Basic Tutorials  (Read 11513 times)

0 Members and 1 Guest are viewing this topic.

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
OpenBoR Basic Tutorials
« on: August 07, 2008, 11:52:42 am »
 It's about time we have basic tutorials like this. I'll start some here. I hope others would share some too.
 Although the format is same with Tricks, this is tutorial.

 Setting Branch

 Intro: For those who have played PeaceKeepers and Rushing Beat Shura, you must have seen branches. Branches lead to different paths in game and some might lead to different story and ending. Having branches in a mod would give more replayability. This tutorial will explain how to set branches in a mod.
 However bear in mind that type of branch explained here is only touch n go type. It means "Touch it then you'll go somewhere". Other type is possible with script but it won't be explained here.
 Procedure: To implement a branch, there are 2 texts to edit. 1st, levels.txt to set branching path. 2nd, entity text to make branch to touch, let's name it branch entity.
 1: In levels.txt, a command must be declared to define where the alternate path would be. For example:

Quote
...
file   data/levels/levelA2.txt
branch  PathB
file   data/levels/levelB11.txt
file   data/levels/levelB12.txt
next
file   data/levels/levelB21.txt
file   data/levels/levelB22.txt
end
...

 'branch PathB' defines a path to go, in this sample are levelB1 and so on. This branch is accessible by touching branch entity which points to PathB. It doesn't matter in which level that entity is touched though, it could be in levelA2.txt or even in levelB11.txt.
 Another thing to note, if levelA2.txt is cleared normally (not touching branch entity that is), 'branch' will be skipped as if it's not there so don't hesitate to use this command.
 'end' defines end of path. From sample above it's accessed by clearing levelB22.txt. When it's accessed, game will end as if last level in a level set/game mode is cleared. It's optional but useful to create alternate ending ;).
 'branch' and 'end' can be declared more than once for more branches and endings. Give unique name to branches so you won't be confused where to go.
 Note:
1. 'branch' declared in a level set or game mode is accessible from any level WITHIN that set only. You can't jump from a set to other set.
2. This step is mandatory even if you are using script based branching.

 2: To make branch entity, make an entity like this:

Quote
name    BranchB
type    endlevel
shadow    0
branch    PathB

anim idle
   delay   10
   offset   1 1
   bbox   0 0 20 20
   frame   data/chars/misc/empty.gif

  This entity is endlevel type which means it will end current level if touched and brings players to next level. Branch PathB alters level to go to branch PathB defined in levels.txt above.
  This entity only requires IDLE animation. In this example, it's using empty.gif which is invisible but any sprite can be used for better visual. Bbox defines that it's touchable. AFAIK setting longer and higher bbox has no effect so don't bother trying.

 As usual, don't forget to load this entity in models.txt, like this:

Quote
know   BranchB      data/chars/misc/branch/branchB.txt

 After both steps are done, the last thing to do is to spawn this branch entity in a level like this:

Quote
spawn   BranchB
coords   -110 165
at   1950

 The branch effect is ready to use!
 Oh yes, whatever sprite you're using for branch entity, give good visual or clue so players know that there's branch.

 Issue: There are 3 issues related to this feature:
1. If a branch entity is already spawned before ending a level by defeating boss, that level will end instantly instead of after boss has fallen to ground.
2. Accessing branch entity at last level of level set or right before 'end', ends current game instead of going to other level pointed by branch entity. To solve this issue, simply put dummy level after that level:

Quote
...
file    data/levels/roomX.txt # Branch here
file    data/levels/room.txt # Dummy level

set  ...

 If branch entity is accessed in roomX.txt, it will work normally.
3. Accessing branch entity at level right before 'next', brings Stage Complete screen before going to other level instead of just go there. To solve this issue, simply put dummy level after that level:

Quote
...
file    data/levels/roomX.txt # Branch here
file    data/levels/room.txt # Dummy level
next

 If branch entity is accessed in roomX.txt, it won't access 'next' too. Alternate method is by putting 'scene' after that level.

 Extra: After you understand how to make normal touch n go branches, you could combine it with certain level types to make advanced branching effect. Here are some examples:
 1. Combining Bonus Level with branch entity produces Time Based Branching. Timer in Bonus Level will be the time limit while branch entity will become the goal to touch.
 2. Combining Endless Level with branch entity produces Room Branching (ala Splatter House 3). Endless level will be the room while branch entity will become door or portal to other room.

 Script: There's a script function related to branching, it's:

Code: [Select]
jumptobranch({name}, {immediately});
 {name} is branch's name made in #1 step above.
 {immediately} is a flag which determine when players jump to that branch.
 0 = After level ends
 1 = Immediately or right when this function is run


 Bonus Level

 Intro: In some games like Final Fight, there are 2 bonus stages where player destroy car or glasses until time runs out or until car is fully wasted or all glasses are shattered. Bonus levels are great way to give break to players from beating enemies. This kind of levels can be made in OpenBoR.
 However, this tutorial only explains how to set a level into a time limited level. The content of the level won't be explained and so does the bonus tallying at the end. Content of level could be anything from destroying drums or car, knocking bikers to a race. For bonus tallying, script is the only way to make it currently.
 Procedure: First of all, you need to make a normal level. Then add this in the header:

Quote
type            1 0 0

 With this setting, the level will turn into time limited level. It's not fully time limited though cause it could end by other means. These events could end this level:
 1. Time runs out
 2. No more obstacles in level
 3. No more items in level
 4. Defeat of boss(es)
 5. No more enemies in level
 6. Touching endlevel or branch entity

 Let's exclude #4, #5 and #6 for now since they work like that in normal level too. The most important event is #1 cause that's the main idea here. #2 and #3 are available to make level ends if there aren't anything else to destroy or to pick in the level. Assuming the bonus level is Obstacle Smash or Items Party that is.
 #1, #4 and #5 have high priority so even though there are still obstacles, items or enemies in level, level will end if any of the former occurs.

 Anyways, setting 'type' above is enough to make bonus level. You can spawn many obstacles in here for Obstacle Smash or spawn items for Items Party.
 When time runs out, level ends and next level will be played. Don't worry about it cause unlike normal level, players won't be killed.

 Issue: Actually the other 2 parameters in 'type' was meant to support bonus stage. 2nd parameter disables SPECIAL, SPECIAL2 and SPECIAL3 while the 3rd one gives invincibility to players. Previously they are working fine but both aren't working properly currently.
 Both are solvable with script though.

 Extra: Bonus level can be turned into Endless level where players could stay there endlessly or IOW stuck in that level. To make it, you have to avoid #1, #4 and #5 above. IOW:
 1. Set time to 0 (and 'notime 1' to hide it)
 2. Don't spawn enemy or at least don't set boss to any enemy at all
 3. Don't spawn endlevel or branch entity

 Also, you'll need to make dummy obstacle to prevent level from ending because of absence of obstacle. The obstacle could be like this:
Quote
name   Empty
health   10
type   obstacle
shadow   0

anim idle
   delay   100
   offset   1 1
   frame   data/chars/misc/empty.gif

anim fall
   delay   100
   offset   1 1
   frame   data/chars/misc/empty.gif

 Dont' forget to load it in models.txt!
 Spawn this entity in a bonus level with above settings and voila! the level becomes endless level.

 Oh in case you don't know how to get out from this level, just press start to quit the game.
« Last Edit: August 09, 2008, 12:41:28 pm by Bloodbane »
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline bone-project

  • Full Member
  • ***
  • Posts: 147
Re: OpenBoR Basic Tutorials
« Reply #1 on: August 08, 2008, 04:59:30 pm »
thanks man dis is going to help me alot :cheers!:
BONELEZZ PRODUCTIONS
CURRENT PROJECTS : BONE THUGS: WEED N DEMONS 90%
                             THUG LIFE 5% /ON HOLD/
                             SECRET PROJECT 8%

Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Re: OpenBoR Basic Tutorials
« Reply #2 on: August 08, 2008, 07:58:56 pm »
When I get around to it Bloodbane, I'll post these in the Wiki. Nice work.

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: OpenBoR Basic Tutorials
« Reply #3 on: August 09, 2008, 12:45:38 pm »
 Updated some stuffs to Setting Branch.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Follow and Shooting
« Reply #4 on: November 23, 2008, 01:15:47 pm »
 Now it's time for another basic tutorials. I haven't done with 'Shooting Projectile' yet. There's only one tutorial about shooting knife here.

 Followup

 Intro: Probably most newbies aren't familiar with the title so let me describe it. Followup is automatic animation change effect which is triggered by attackbox which hit other entity. Examples are Abadede's ramming attack (Streets of Rage 2) and J-11's ramming attack (Ghost Chaser Densei). Both bosses have attack in which they charge forward while attacking. If their attack hits, they follow it up with combo attack, Abadede perform uppercut while J-11 perform flip then double kick. If their attack misses, they won't perform the combo at all.
 Although above example is from enemies, followup can also be set for players too.

 Procedure: 1st of all we need 2 animations, one is the attack animation which is going to have followup set and the other is the followup animation. The former could be any animations but the latter requires special animation named FOLLOW#. # is the number of follow animation.
 Example:

Code: [Select]
anim grab
offset 40 121
bbox 39 20 21 102
delay 12
frame data/chars/joe/grab00.gif
frame data/chars/joe/grab03.gif
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

 This is Joe's grab animation. Say we want him to followup this attack with other grabattack. In order to do that, we need to use 2 commands: followanim and followcond.

Quote
followanim {value}
~Determines which FOLLOW animation played when followup condition is met or when counter condition is met.
~Accepted values are 1, 2, 3 and 4.
~Used together with 'followcond' or 'counterframe'.

followcond {value}
~This command is to make the entity performs FOLLOW{#} if an attackbox in the animation hits.
~value determines the condition requirements before FOLLOW{#} is played.
1 = this animation will followup as long as it hits an entity.
2 = this animation will followup as long as it hits an enemy (Or player if an enemy uses it).
3 = this animation will followup as long as it hits an enemy and the target does not get killed or block the attack.
4 = this animation will followup as long as it hits an enemy, and the target is not killed, does not block the attack, and is not set to be ungrabbable.
~Which FOLLOW animation played is determined by 'followanim'.

 Let's pick FOLLOW1 for followup animation and pick 3rd condition. So the grab animation becomes:

Code: [Select]
anim grab
        followanim 1
        followcond 3
offset 40 121
bbox 39 20 21 102
delay 12
frame data/chars/joe/grab00.gif
frame data/chars/joe/grab03.gif
attack 68 40 33 33 8 0 1   <--------
frame data/chars/joe/grab04.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

anim follow1
delay 12
offset 40 121
bbox 39 20 21 102
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
frame data/chars/joe/grab03.gif
frame data/chars/joe/grab00.gif
frame data/chars/joe/grab03.gif
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

 When attackbox pointed by arrow above hits player, GRAB animation is stopped and Joe playes FOLLOW1 immediately. Notice that FOLLOW1 is started from frame with attackbox pointed by arrow in GRAB. That's to make animation change smooth.

 Issue: As explained before, followup is activated if attackbox hits other entity and conditions are met. And above example starts FOLLOW animation in attacking frame. Now what if the attack animation has 2 or more attackboxes? at which frame FOLLOW animation should start for smooth animation change? That's the issue for using followup. It can be avoided by using only one attackbox in attack animation.
 Still, script can solve this issue.

 Extra: Followups can be set cascading meaning FOLLOW animation can have 'followanim' and 'followcond' to accept follow. Example:

Code: [Select]
anim grab
        followanim 1
        followcond 3
offset 40 121
bbox 39 20 21 102
delay 12
frame data/chars/joe/grab00.gif
frame data/chars/joe/grab03.gif
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

anim follow1
delay 12
        followanim 2
        followcond 3
offset 40 121
bbox 39 20 21 102
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
frame data/chars/joe/grab03.gif
frame data/chars/joe/grab00.gif
frame data/chars/joe/grab03.gif
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

anim follow2
delay 12
        jumpframe 4 1 0
offset 40 121
bbox 39 20 21 102
attack 68 40 33 33 8 0 1
frame data/chars/joe/grab04.gif
attack 0
frame data/chars/joe/grab03.gif
frame data/chars/joe/grab00.gif
delay 20
frame data/chars/joe/grab07.gif
delay 13
bbox 44 13 28 110
attack 63 32 33 33 14 1 1
frame data/chars/joe/grab08.gif
frame data/chars/joe/grab09.gif
attack 0
delay 15
bbox 36 13 28 110
frame data/chars/joe/grab10.gif

 Another extra stuff is followup can also be trigger if entity is hit by other entity instead. To set this, 'counterframe' is used instead of 'followcond'. Details are explained in next section.

 Script section omitted!

 Counter Followup

 Intro: If you have read previous section, you should have understand meaning of followup and how to set one. This tutorial explains how to set followup which is triggered by getting hit instead of hitting other entity.

 Procedure: The requirements are same, attack animation and follow animation. Followanim is used to determine which FOLLOW animation to play but this time we used it together with 'counterframe' instead.

Quote
counterframe {frame} {cond} {damaged}
~This command is to make entity performs FOLLOW{#} if the entity is hit in set frame.
~frame determines at which frame if entity is hit, FOLLOW{#} would be played.
~cond determines the condition requirements before FOLLOW{#} is played.
1: The counter will always be used.
2: The counter will be used as long as the attacker was an enemy (Or a player if an enemy uses it).
3: The counter will be used as long as the attacker was an enemy, the attack was not unblockable, hits the user from the front, and was not a FREEZE attack.
~damaged determines whether the entity will receive damage from the hit or not.
0: the damage won't be taken
1: the damage will be taken

 Here's an example:

Code: [Select]
anim attack2
range 0 100
        rangez  -25 25
delay 100
        followanim 1
        counterframe 1 1 0
offset 30 115
bbox 20 10 30 105
frame data/chars/enemy/decoy1.gif
frame data/chars/enemy/decoy2.gif
frame data/chars/enemy/decoy1.gif

anim follow1
delay 5
offset 30 115
frame data/chars/enemy/counter1.gif
delay 50
attack 30 30 70 80 20 1 1
frame data/chars/enemy/counter2.gif
delay 5
frame data/chars/enemy/counter1.gif

 If enemy is hit while performing ATTACK2 and in 2nd frame (decoy2.gif), enemy will stop ATTACK2 animation and immediately play FOLLOW1. Enemy won't lose any health at all because of 'counterframe' setting.

 Limitation: As you can see, we can only set one frame to receive hit. That means we can't use more frames to make 'countering' animation smoother.

 Script: Like before, there's no direct function to replicate above effects. The best way to do it is by using 'takedamagescript' which is played when entity is hit by an attack. The script checks the conditions (could be more than just defined by 'counterframe'above), if they are sufficient, script changes entity's animation to other animation (could be FOLLOW or any animations).


 Shooting Projectile 1

 Intro: I'm sure all of you have seen characters who can shoot projectiles in brawler games. The projectiles varies from knives, grenades, stars, rocks, bullets to bombs and laser shots. They are also shot in various ways i.e thrown, shot, tossed etc. This tutorial will explain how to set projectile shooting. OpenBoR supports 3 ways of shooting projectile:
 1. Throwing knife (Projectile flies straight forward)
 2. Throwing stars (Projectile falls down)
 3. Tossing bombs (Projectile flies in arc)
 This section explains about 'Throwing knife'. Oh, despite of the name, you can use missiles, bullets or anything else aside of knife. Also, the knife can also be thrown on ground turning it into shot.
 Before I start, I must imply that character and projectile are 2 DIFFERENT entities. That means, you need to make another entity for the projectile.
 Also, this method is applicable for any kind of entities so no need to check character's type.

 Procedure: Like said before, projectile is another entity so let's make one like this example:

Code: [Select]
name      Bullet
speed        30
type      none
shadow      0

anim idle
delay 100
offset 5 3
attack 0 0 10 6 10 1
frame data/chars/misc/bullet.gif

 This text is for Bullet projectile. Speed determines how fast it flies forward, type is not important but let's choose 'none', shadow is set 0 so it won't cast shadow but it's optional.
 Bullet only has IDLE animation but it's enough cause it won't play other animation (except under special settings). In this animation, aside from common commands (frame,offset,delay), there's attackbox. This attackbox determines the attacking properties of this projectile. IOW when this projectile is fired or thrown, it's already attacking.
 Bullet can have animated IDLE animation, looping, multiple hits etc like normal attack animation. However, unlike normal entity, this projectile dies after it hits anything.

 Since it's an entity, it must be declared in models.txt:

Code: [Select]
know Bullet data/chars/misc/bullet.txt
 Actually, it can be declared with 'load' but let's choose 'know' cause this projectile will be 'loaded' by the character who's throwing it. To load it like that simply declare this command in respective character's text header.

Code: [Select]
load    Bullet
 When the character is loaded, Bullet will also be loaded together. After that, we need to set Bullet as this character's knife like this:

Code: [Select]
knife    Bullet
 To throw this Bullet, character must use 'throwframe'. The command must be declared in desired animation like this example:

Code: [Select]
anim attack1
range 60 200
delay 6
        offset 40 115
        [b]throwframe 3 82[/b]
bbox 20 9 36 102
frame data/chars/topan/shoot01.gif
        bbox 26 9 34 102
        frame data/chars/topan/shoot02.gif
delay 10
        bbox 31 9 34 102
        frame data/chars/topan/shoot03.gif
delay 15
        sound data/sounds/dor2.wav
        frame data/chars/topan/shoot04.gif
delay 6
        frame data/chars/topan/shoot03.gif
        bbox 26 9 34 102
        frame data/chars/topan/shoot02.gif
bbox 20 9 36 102
frame data/chars/topan/shoot01.gif

 'Throwframe 3 82' means Bullet is thrown at 4th frame at 82 pixels high from character's altitude. Yes, it's relative to character instead of to ground. That means if the character is jumping while throwing, thrown projectile will start high.
 You can declare 'throwframe' in other animations too but only one 'throwframe' per animation.

 Extra: There are extra commands that you can add to modify both projectile and shooting animation. For projectile some of them are:
 - hitenemy (to control which other entities this projectile can hit)
 - candamage (to control what type this projectile can hit)
 - remove (to set if this projectile dies on hit or continue flying after hit)
 - lifespan (to control how long this projectile lives)
 - nomove (to make static projectile)
 
 All of them are declared in projectile's text header if you use them.
 Although all mentioned above are optional, it's recommended to declare 'candamage' to ensure the projectile can hit desired entity.
 Aside from those, projectile can use SPAWN and FOLLOW (like explained above). SPAWN could be used if you want projectile to have special spawn effect. FOLLOW could be used if projectile changes animation after hitting something. You must use 'remove 0' together for this otherwise projectile would disappear before it could followup. Bear in mind that projectile is moving regardless of animation it's playing.

 For shooting animation, there is 'custknife' command which changes thrown knife just for respective animation. Use it together with 'throwframe' of course.

 Limitation: One big flaw of 'throwframe' command is it only allows throwing projectile once per animation. There's no other command for multiple projectile shooting OTOH. There's a trick to solve this but it's unstable, impractical and outdated by script.

 Script: Throwing is projectile with script is basicly similar with above except that it's more flexible. The required steps are same as above except 'throwframe' and 'knife' command aren't used anymore. Custknife also shouldn't be used with this script.
 This is the function for throwing projectile:

 projectile(char *name, float x, float z, float a, int direction, int type, int ptype, int map);

 - name is projectile's name. For above example, it's "Bullet" (with ").
 - x, z and a are starting coordinate for the projectile. x is relative to leftmost level edge, z is relative to 0 and a is relative to ground.
 - direction is facing direction of the projectile.
 - type is only used if no name is provided and NULL is used instead. 0 for knife or 1 for shot.
 - ptype specifies what kind of projectile is fired. 0 for knife or 1 for bomb.
 - map specifies if fired projectile copies thrower's remap or not. 0 means it use it's own map while 1 means it use thrower's remap.
 The function itself returns the projectile entity which can be used for many things such as altering speed.
« Last Edit: November 26, 2008, 10:14:04 am by Bloodbane »
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: OpenBoR Basic Tutorials
« Reply #5 on: November 23, 2008, 07:51:45 pm »
Bloodbane, this is a good tutorial, but once again I have to remind everyone not to post somthing unless you have carefully researched it yourself. As I have warned time and again, any attempt to directly change the caller's animations within a didhitscript will instantly crash the engine. There is a workaround (provided elsewhere), but please do not tell users to do something without mentioning the bugs involved. It is not fair to them.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Tossing Bomb
« Reply #6 on: November 26, 2008, 10:10:18 am »
As I have warned time and again, any attempt to directly change the caller's animations within a didhitscript will instantly crash the engine. There is a workaround (provided elsewhere), but please do not tell users to do something without mentioning the bugs involved. It is not fair to them.

 Argh, sorry. I must have missed your warnings. I'll remove that part from above.

 Anyways, continued from last post. I didn't make tutorial for Throwing Stars cause I never set start throwing myself. The only thing I did was copying old BoR's start throwing in my mod. I even haven't tried custom stars yet. Now, with scripts, I can replicate star throwing easily and I don't need to use 'stars' anymore.
 Speaking of scripts, recently I always use script to make Knife throwing and Bomb tossing, therefore I might make some mistake in these tutorials cause they are using old way.

 Tossing Bomb

 Intro: Just like last tutorial, this one is also about shooting projectile but it's for Tossing Bomb. Unlike knife, bomb is thrown in an arc so after it's 'released', it jumps then fall down.
 Although the name is bomb, you can use grenade, rock or anything.
 Just like throwing knife, character and bomb are 2 DIFFERENT entities. That means, you need to make another entity for the bomb. And, this method is applicable for any kind of entities so no need to check character's type.

 Procedure: Let's start with the bomb entity, here's an example:

Code: [Select]
name         Grenade
speed           13
jumpheight      3
type         none
shadow  1

anim idle
loop 1
delay 10
offset 12 13
        hitflash spark
burn 2 2 20 20 15 1
        hitfx   data/sounds/burnt.wav
frame data/chars/misc/gren04.gif
frame data/chars/misc/gren05.gif
frame data/chars/misc/gren06.gif
frame data/chars/misc/gren07.gif
frame data/chars/misc/gren08.gif
frame data/chars/misc/gren01.gif
frame data/chars/misc/gren02.gif
frame data/chars/misc/gren03.gif

anim attack1
delay 4
offset 60 68
        hitflash spark
        hitfx   data/sounds/burnt.wav
        sound   data/chars/ralf/xplosion.wav
frame data/chars/misc/sx01.gif
frame data/chars/misc/sx02.gif
frame data/chars/misc/sx03.gif
frame data/chars/misc/sx04.gif
burn 25 12 60 73 15 1
frame data/chars/misc/sx05.gif
frame data/chars/misc/sx06.gif
frame data/chars/misc/sx07.gif
frame data/chars/misc/sx08.gif
frame data/chars/misc/sx09.gif
frame data/chars/misc/sx10.gif
frame data/chars/misc/sx11.gif
frame data/chars/misc/sx12.gif
frame data/chars/misc/sx13.gif
frame data/chars/misc/sx14.gif
frame data/chars/misc/sx15.gif
        attack  0
frame data/chars/misc/sx16.gif
frame data/chars/misc/sx17.gif
frame data/chars/misc/sx18.gif
frame data/chars/misc/sx19.gif

anim attack2
delay 4
offset 40 48
        sound   data/chars/ralf/xplosion.wav
frame data/chars/misc/sx01.gif
frame data/chars/misc/sx02.gif
frame data/chars/misc/sx03.gif
frame data/chars/misc/sx04.gif
frame data/chars/misc/sx05.gif
frame data/chars/misc/sx06.gif
frame data/chars/misc/sx07.gif
frame data/chars/misc/sx08.gif
frame data/chars/misc/sx09.gif
frame data/chars/misc/sx10.gif
frame data/chars/misc/sx11.gif
frame data/chars/misc/sx12.gif
frame data/chars/misc/sx13.gif
frame data/chars/misc/sx14.gif
frame data/chars/misc/sx15.gif
frame data/chars/misc/sx16.gif
frame data/chars/misc/sx17.gif
frame data/chars/misc/sx18.gif
frame data/chars/misc/sx19.gif

 This text is for Grenade. Speed determines how fast it flies forward while jumpheight determines how high it jumps before falling down and type is 'none' although it's not important.
 Unlike knife, bomb (Grenade) uses 3 animations. IDLE is played when bomb is flying or jumping, ATTACK1 is played if bomb landed without hitting anything before and ATTACK2 is played if bomb hits opponent. As you can see, attackbox is declared in IDLE and ATTACK1. Attackbox in IDLE is for attacking opponent while flying, it can also be used as trigger to play ATTACK2. Attackbox in ATTACK1 is for attacking opponent after landing, normally in form of explosion.
 Grenade can have animated IDLE animation like normal attack animation. However, unlike normal entity, this bomb dies after it hits anything.

 Since it's an entity, it must be declared in models.txt:

Code: [Select]
know Grenade data/chars/misc/grenade.txt
 Actually, it can be declared with 'load' but let's choose 'know' cause this bomb will be 'loaded' by the character who's tossing it. To load it like that simply declare this command in respective character's text header.

Code: [Select]
load    Grenade
 When the character is loaded, Grenade will also be loaded together. After that, we need to set Grenade as this character's bomb like this:

Code: [Select]
bomb    Grenade
 To toss this grenade, character must use 'tossframe'. The command must be declared in desired animation like this example:

Code: [Select]
anim attack2
range 120 160
rangez -35 35
delay 15
        tossframe 1 50
offset 41 119
bbox 18 24 35 96
frame data/chars/lesus/toss01.gif
delay 8
frame data/chars/lesus/toss02.gif
delay 16
frame data/chars/lesus/toss03.gif
delay 8
frame data/chars/lesus/toss04.gif
frame data/chars/lesus/toss05.gif

 'Tossframe 1 50' means Grenade is tossed at 2nd frame at 50 pixels high from character's altitude. Yes, it's relative to character instead of to ground. That means if the character is jumping while tossing, tossed bomb will start high.
 You can declare 'tossframe' in other animations too but only one 'tossframe' per animation.

 Extra: There are extra commands that you can add to modify both bomb and tossing animation. For bomb, some of them are:
 - hitenemy (to control which other entities this bomb can hit)
 - candamage (to control what type this bomb can hit)
 - lifespan (to control how long this bomb lives)
 - nomove (to make static bomb)
 
 All of them are declared in bomb's text header if you use them.
 Although all mentioned above are optional, it's recommended to declare 'candamage' to ensure the bomb can hit desired entity.
 Aside from those, bomb can use SPAWN. SPAWN could be used if you want bomb to have special spawn effect.

 For tossing animation, there is 'custbomb' command which changes tossed bomb just for respective animation. Use it together with 'tossframe' of course.

 Limitation: One big flaw of 'tossframe' command is it only allows tossing bomb once per animation. There's no other command for multiple bomb tossing OTOH. There's a trick to solve this but it's unstable, impractical and outdated by script.

 Script: Tossing bomb with script is basicly similar with above except that it's more flexible. The required steps are same as above except 'tossframe' and 'bomb' command aren't used anymore. Same goes with 'custbomb'.
 This is the function for throwing projectile which can also be used for tossing bomb:

 projectile(char *name, float x, float z, float a, int direction, int type, int ptype, int map);

 - name is projectile's name. For above example, it's "Bullet" (with ").
 - x, z and a are starting coordinate for the projectile. x is relative to leftmost level edge, z is relative to 0 and a is relative to ground.
 - direction is facing direction of the projectile.
 - type is only used if no name is provided and NULL is used instead. 0 for knife or 1 for shot.
 - ptype specifies what kind of projectile is fired. 0 for knife or 1 for bomb.
 - map specifies if fired projectile copies thrower's remap or not. 0 means it use it's own map while 1 means it use thrower's remap.
 The function itself returns the projectile entity which can be used for many things such as altering speed.
« Last Edit: November 26, 2008, 10:16:52 am by Bloodbane »
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline onikage

  • Jr. Member
  • **
  • Posts: 25
Re: OpenBoR Basic Tutorials
« Reply #7 on: December 31, 2008, 04:08:31 am »
more more more =)
actually i want to make a cool mod,but i have a lot of questions i can't find answers for,where can i ask? who can i pm ?
what about we exchange our msn contacts? so we can talk when we're all online?

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: OpenBoR Basic Tutorials
« Reply #8 on: January 03, 2009, 12:11:54 pm »
 As I said before you can ask them in Help section outside this.

 I'm not online everyday though so I can't talk with you online.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: OpenBoR Basic Tutorials
« Reply #9 on: October 28, 2009, 11:53:22 pm »
 Cough, cough (dusting thread). OK, another tutorial. This one is missing pictures but should be good enough.

Platforms for 2D mods

 Intro: It's very common to see platforms in 2D scrolling games, almost all of them has these. Platforms are not only for eye candy but defines gameplay. OpenBoR is capable of supporting 2D mods and is supports platforms too. This tutorial explains how to set platforms for 2D levels.
 Before I start, there are 2 ways to set platforms in level. One is with Wall command (for levels) and the other is with platform command (for entities). Both are combinable but the one explained here is the latter.
 Procedure: There are 2 steps to set platforms: set the platform entities then declare them in levels.
 1. Setting platform entities
 Since we are using entities for the platforms, we need to make an entity text and declare it in models.txt.
 Example:
Quote
name      Plat5
type      none
shadow        0
facing        1
antigravity   100

anim idle
    delay   100
    offset   1 1
    platform   1 1 0 0 80 80 16 16
    frame   data/chars/misc/empty.gif

 In models.txt:
Quote
know   Plat5      data/chars/misc/platform/plat5.txt

 In this example, Plat5 is the platform entity. It's floating and doesn't fall so 'antigravity 100' is set. Plat5 is using empty.gif which is invisible. You can use other graphic to visualize the platform. I use invisible platform cause the platform is already shown by level panels.
 'platform' command is the essential command to set platform size, hence its name. The 1st 2 parameters matches its offset meaning the platform starts from the offset to the right. The '0 0 80 80' means that the platform's width is 80 pixels wide. The last parameter (16) means the platform's height is 16 pixels high.
 With this set, Plat5 is ready to use.

 2. Declaring platforms in level texts
 This part can be tough or easy depends on how the platforms look like. If the platform has visual, you can spawn it anywhere and it's easy. However if the platform is invisible and it's meant to 'platformize' background or panel, you need to spawn it in proper place so they matches.

 Nonetheless, the platforms must be spawned like this:
Quote
spawn   plat5
coords   359 320 161
at   0

 359 is the distance of platform from leftmost edge of level.
 The z coordinate is set with same value as z command set in levels.txt, in this example it's 320.
 161 is the altitude of platform from ground.

 If you are 'platformizing', you need to measure the distance and altitude properly. You can use Photoshop or other graphic editor for this.

 Repeat these steps until you got all platforms spawned or until all background plaformized.
 Issue: There shouldn't be any issue with this but you might encounter some issues like below.

 1. Entities aren't blocked properly. About half of their body can pass through platforms

 This is because platform only block entities by their offset, that's why half part can pass through. To solve this, simply enlarge platform width until all part can't pass through.

 2. Projectiles are blocked platforms while they are supposed to pass through

 This is not platform's fault, so to speak. The projectiles aren't set to ignore platforms that's why. Set this in their header to solve it:

Quote
subject_to_platform 0

 3. Platforms can be jumped through from below while they aren't supposed to

 Again, this is not platform's fault :). The entities don't have 'height' set which allows them to jump through from below. To solve this, simply set 'height' in their header like this:

Quote
height   30

 Any height value can be used though.

 4. Platforms can't be flipped, it will always go right even if platform is facing left

 If you notice, there's 'facing 1' set in Plat5's header above. It's set like that so this platform can't be flipped and always face right making it easier to set in levels. It's also to prevent this bug cause the platform is always facing right.
 However, if you want to make visible platform which can be flipped, you need to adjust platform settings like this:

Quote
name      Plat5
type      none
shadow        0
antigravity   100

anim idle
    delay   100
    offset   40 16
    platform   40 16 -40 -40 40 40 16 16
    frame   data/chars/platform/platform.gif

 This one is say using not invisible gif like before but use visible one instead (platform.gif). The platform size is same though i.e 80x16 pixels.
 Offset is moved to center of platform and below platform which is 40 pixels from left and 16 pixels from top to 40 16. This makes platform has same length to left and right allowing you to flip it in level.
 However, 'platform' settings must be adjusted too. Since the offset is moved 40 pixels to right, the previous settings are shifted 40 pixels to left for balance and it become:

platform 40 16 -40 -40 40 40 16 16

 Extra: Although its name is platform, you can make walls with it. Here's an example:

Quote
name      Wall5
type      none
shadow        0
facing        1
antigravity   100

anim idle
    delay   100
    offset   1 1
    platform   1 1 0 0 16 16 80 80
    frame   data/chars/misc/empty.gif

 It's similar to Plat5 mentioned above except that this one is 16 pixels wide and 80 pixels high.

 Combined with platforms, you can make complex room with walls and platforms.

 And last but not least, you can combine platforms to make longer platforms. Just spawn them in a row which form long platform.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline baritonomarchetto77

  • Hero Member
  • *****
  • Posts: 1144
Re: OpenBoR Basic Tutorials
« Reply #10 on: October 29, 2009, 04:16:55 am »
Very nice tutorials Bloody. Considering that are newbie-oriented, you shold include a sort of glossary just to explain some definition (for example: "attackbox" is a known concept in modders dictionary, but probably it's not true for newbies  ;))

Offline Fightn Words

  • Hero Member
  • *****
  • Posts: 3264
  • Confectionary Country of the Nin-Nin
Re: OpenBoR Basic Tutorials
« Reply #11 on: October 30, 2009, 01:53:06 am »
Great post Bloodbane-, it not only explains things extensively but it's also helpful for troubleshooting any problems.

Offline Vyck_St.Judas

  • Sr. Member
  • ****
  • Posts: 433
Re: OpenBoR Basic Tutorials
« Reply #12 on: November 01, 2009, 06:39:20 pm »
Sweet chocolate Christ yeeeeesss!!!!!!!!!!  :teary_eyed:
Christmas came on Halloween this year!

Offline wiequadrat

  • Jr. Member
  • **
  • Posts: 90
Re: OpenBoR Basic Tutorials
« Reply #13 on: November 05, 2009, 10:23:36 am »
wow great tut on 2d platform. i might even use it on my 2d projects although it's a very optional features for me. someday i might make a tutorial too but right now just focus in creating mod first.

i wonder if i can request for randomness effect script tutorial? such as a skill that can gives 50% chance stun or 30% freeze chance effects.
--------------------
"i'm the best because i work with the best", Bruce Willis, Armageddon

my openBOR RBO projects folder in boxnet

Offline Vyck_St.Judas

  • Sr. Member
  • ****
  • Posts: 433
Re: OpenBoR Basic Tutorials
« Reply #14 on: November 05, 2009, 01:59:25 pm »
i was actually wondering how to set pseudo RPG elements, like a standard level up system.
Also, a simple inventory system, or custom pause screen (press start to view the map kinda thing) I've heard these things can be done but i have yet to find out how.

 



 0%




SimplePortal 2.3.3 © 2008-2010, SimplePortal