![]() |
|
BG-Dependent actions - Printable Version +- Little Fighter Empire - Forums (https://lf-empire.de/forum) +-- Forum: Little Fighter 2 Zone (https://lf-empire.de/forum/forumdisplay.php?fid=7) +--- Forum: Data Changing (https://lf-empire.de/forum/forumdisplay.php?fid=11) +---- Forum: Advanced Data Changing (https://lf-empire.de/forum/forumdisplay.php?fid=13) +---- Thread: BG-Dependent actions (/showthread.php?tid=1703) |
BG-Dependent actions - Silverthorn - 12-13-2008 CAUTION, long essay! Not recommended for people that don't like texts over 1300 words! You might have seen my latest project called "Sky High". In there, I'm using a method to spawn certain objects. Well great, spawning objects in general is easy, just add a file in data.txt with an id between 100 and 199, and it'll drop from the sky. But now we get to the neat things: bg-dependent spawning. You must know about the characteristics of a bg. There are just a few things that make backgrounds totally different from each other, and these are:
CAUTION! This method is only recommended if your background is the largest in the game, otherwise the DC-code get a little nasty :P A weapon will drop, like regularly. But instead of being pickable, it'll act as a zero-placer. This means the following:
-----------------------------------------------------------------------
And here comes the "better" method ![]() Remember the other thing I was talking about? Yes, the zwidth. Each background has a unique zwidth. If you want to apply this method to your bg, use a characteristic zwidth. It's actually quite unimportant where the two boundaries are, what we need is the distance between them. For example: "zboundary: 393 502" has an effective area of 109. We're gonna abuse that ![]() By the way, the first one that I know of who has used this method was Jerry Hawk in his JW LF2-mod. But I think he never revealed it to public. Time to change this ![]() MH and I talked about this thing for quite a while - credits go to him for giving the final hint ![]() Implementing, testing, and tutorial-writing (which, according to its length, is quite a good job) is done by me^^ We still need our spawning-weapon, its sole purpose is to fall from the sky and opoint a type-3-object. Since I like type 2 because it has quite few default frames, I used it. The important frames are these: Code: <frame> 20 on_ground
pic: 999 state: 2004 wait: 2 next: 22 dvx: 0 dvy: 0 centerx: 29 centery: 56
<frame_end>
<frame> 22 on_ground
pic: 999 state: 2004 wait: 1 next: 1000 dvx: 0 dvy: 0 centerx: 29 centery: 56
opoint:
kind: 1 x: 29 y: 56 dvx: 0 action: 50 oid: 171 facing: 0
opoint_end:
<frame_end>Now, in the type-3-object, we're checking if we have the right background. How are we gonna do this? Easy, just do the following steps:
Basic knowledge: "hit_j" in type-3-objects works as a z-moving tag. numbers higher than 50 will move your object to the front, lower than 50 to the back. 50 = 0; no movement. Example: Code: <frame> 50 Start
pic: 999 state: 3005 wait: 0 next: 51 dvx: 0 dvy: 550 centerx: 29 centery: 56
<frame_end>
<frame> 51 Start
pic: 999 state: 3005 wait: 1 next: 52 dvx: 0 dvy: 550 centerx: 29 centery: 56
opoint:
kind: 1 x: 29 y: 56 action: 55 dvx: 0 dvy: 0 oid: 171 facing: 10
opoint_end:
<frame_end>
<frame> 52 front
pic: 999 state: 3005 wait: 4 next: 53 dvx: 0 dvy: 550 centerx: 29 centery: 56 hit_j: 99 # => 109
<frame_end>
<frame> 53 front-backwards
pic: 999 state: 3005 wait: 3 next: 54 dvx: 0 dvy: 550 centerx: 29 centery: 56 hit_j: 40 # => 69
<frame_end>
<frame> 54 front-backwards
pic: 999 state: 3005 wait: 30 next: 1000 dvx: 0 dvy: 550 dvz: 550 centerx: 29 centery: 56
itr:
kind: 9 x: 0 y: 4500 w: 59 h: 56 injury: 10 bdefend: 100 vrest: 10 zwidth: 3
itr_end:
<frame_end>
<frame> 55 back
pic: 999 state: 3005 wait: 4 next: 56 dvx: 0 dvy: 550 centerx: 29 centery: 56 hit_j: 1 # => 0
<frame_end>
<frame> 56 back-fowards
pic: 999 state: 3005 wait: 4 next: 57 dvx: 0 dvy: 550 centerx: 29 centery: 56 hit_j: 62 # => 60
<frame_end>
<frame> 57 back-fowards
pic: 999 state: 3005 wait: 0 next: 58 dvx: 0 dvy: 550 centerx: 29 centery: 56 hit_j: 61 # => 69
<frame_end>
<frame> 58 back-fowards
pic: 999 state: 3005 wait: 30 next: 1000 dvx: 0 dvy: 550 dvz: 550 centerx: 29 centery: 56
bdy:
kind: 0 x: 0 y: 4500 w: 59 h: 56
bdy_end:
<frame_end>When these two are overlapping, the bdy-object will be removed due to its next-value, the other one will go to frame 40: Code: <frame> 40 tadah
pic: 999 state: 3005 wait: 1 next: 41 dvx: 0 dvy: 550 centerx: 29 centery: 56
<frame_end>
<frame> 41 tadah
pic: 999 state: 3005 wait: 1 next: 1000 dvx: 0 dvy: 550 centerx: 29 centery: 56
opoint:
kind: 1 x: 29 y: 56 action: 60 dvx: 0 dvy: 0 oid: 171 facing: 10
opoint_end:
<frame_end>![]() So yea, basically, you can now do whatever you want. From frame 60 on, you can let out your creativity ![]() Advantages of this method: faster, random x-positions That's it! I apologize for getting so long but it was simply inevitable for me ![]() Finished, and so I just have to say: happy coding
RE: BG-Dependent actions - YinYin - 12-13-2008 (12-13-2008, 10:01 PM)Blue Phoenix Wrote: By the way, the first one that I know of who has used this method was Jerry Hawk in his JW LF2-mod. But I think he never revealed it to public. Time to change thishe released the meteor and ion storm bgs with a tuto in the chinese section of the official forum RE: BG-Dependent actions - snorsorbet - 12-14-2008 It was a good tutorial. Even if I can't code, I understand how it basicly works. A 5 out of 5! RE: BG-Dependent actions - sadbhav - 12-14-2008 Yeah I like it very much, 4 Thumbs up!!! (2 hands, 2 feet is all that I got) RE: BG-Dependent actions - MH-Razen - 12-14-2008 oh I just have to post this: while chating with him blue phoenix told he will eat a broom when this work - well, it worked and I gave him the broom, and he eat it
RE: BG-Dependent actions - Silverthorn - 12-14-2008 ... you forgot the most important part.....
|