Post by vyckstjudas on Dec 19, 2012 23:56:00 GMT -5
Courtesy of Bloodbane -
Intro: Normally levels in OpenBoR are ended by defeating every enemy in the level or by defeating boss. Alternatively, touching endlevel entity also ends level. With script, level can be ended in various ways. This tutorial describes how to make entity which ends current level after it is spawned. In addition to ending level, this entity also brings player to defined branch.
Procedure: Let's name this entity as LevelEnd. Here's an example of its text:
name LevelEnd
type none
antigravity 100
anim idle
@script
void self = getlocalvar("self");
char Name = getentityproperty(self,"name");
if(frame == 1){
jumptobranch(Name, 1);
}
@end_script
delay 300 #<--- defines how long it takes before level ends
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
LevelEnd uses 'antigravity 100' to prevent it from falling to holes. Its type doesn't matter, let's just use 'type none'.
In its IDLE, it has script which works like this: entity's alias is acquired then at 2nd frame, level is ended and jumps to branch with same name as that alias. If there's no such branch, the level only ends without jumping to any branch.
'delay 300' means after LevelEnd is spawned, it will wait 300 centiseconds or 3 seconds before ending the level. Change the value to suit your need.
It is using blank image (empty.gif) cause it's meant to be invisible.
To use LevelEnd, either spawn it directly like this:
spawn LevelEnd
alias BranchName
coords 160 200
at 0
or set it as other entity's dropped item like this:
spawn Enemy
item LevelEnd
itemalias BranchName
coords -100 200
at 0
Alias is only added if you want LevelEnd to jump to defined branchbame after ending the level.
Limitation: Since this entity uses its name as branch destination, it will try to jump to branch named 'LevelEnd' if no alias is given to it. That means, you can't use 'LevelEnd' as name of your branches to avoid conflict with LevelEnd (why would you anyways ?).
Intro: Normally levels in OpenBoR are ended by defeating every enemy in the level or by defeating boss. Alternatively, touching endlevel entity also ends level. With script, level can be ended in various ways. This tutorial describes how to make entity which ends current level after it is spawned. In addition to ending level, this entity also brings player to defined branch.
Procedure: Let's name this entity as LevelEnd. Here's an example of its text:
name LevelEnd
type none
antigravity 100
anim idle
@script
void self = getlocalvar("self");
char Name = getentityproperty(self,"name");
if(frame == 1){
jumptobranch(Name, 1);
}
@end_script
delay 300 #<--- defines how long it takes before level ends
offset 1 1
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
LevelEnd uses 'antigravity 100' to prevent it from falling to holes. Its type doesn't matter, let's just use 'type none'.
In its IDLE, it has script which works like this: entity's alias is acquired then at 2nd frame, level is ended and jumps to branch with same name as that alias. If there's no such branch, the level only ends without jumping to any branch.
'delay 300' means after LevelEnd is spawned, it will wait 300 centiseconds or 3 seconds before ending the level. Change the value to suit your need.
It is using blank image (empty.gif) cause it's meant to be invisible.
To use LevelEnd, either spawn it directly like this:
spawn LevelEnd
alias BranchName
coords 160 200
at 0
or set it as other entity's dropped item like this:
spawn Enemy
item LevelEnd
itemalias BranchName
coords -100 200
at 0
Alias is only added if you want LevelEnd to jump to defined branchbame after ending the level.
Limitation: Since this entity uses its name as branch destination, it will try to jump to branch named 'LevelEnd' if no alias is given to it. That means, you can't use 'LevelEnd' as name of your branches to avoid conflict with LevelEnd (why would you anyways ?).