branch options

jonsilva

New member
hello

is it possible to use some kind of branch command when a level ends
to go to a specific chossen level...?
i wanted to avoid creating and spawning a branch .txt file...
and maybe use a command "branch lvl**" in the level.txt where the enemies and obstacles are spwaned... to go to another place

i found this command "skiptoset" but i dont know it works
 
You need this:

spawn  delay
@script
void main()
{
    jumptobranch("Path1", 0);
}
@end_script
health 20
coords  160 185
at 0

The script is independent to entity therefore you can declare it in any entity, not just delay entity.

Path1 defined there means player will go to branch Path1 after level ends.

This script won't end level directly BTW :)
 
Path1 is a branch .txt file or just a path declared on levels.txt? I think jonsilva doesn't want to to create branch txts files, therefore looking for a more direct solution.
 
thanks
it was exacly what i was looking for...i was going to try to make one of this...
i was using this one since the script ghosthealth didint spwaned an item when killed...

spawn  ghost1
@script void main() { 
    void self = getlocalvar("self");
    changeentityproperty(self, "lifespancountdown", 5); //1000=1sec
} @end_script
item itmgo1
itemalias thepitt2
health  15
boss    1
coords 100 260
at      0

Path1 is a branch .txt file or just a path declared on levels.txt?
Path1 is just branch on levels.txt "branch path1"

but... there is still something i cant get find way to do...
how can a branch be used in a bonus stage ?
i have the openbor time set in the level...
the only solution i see is to use enemies as obstacles then group 1 1 at 0 (branch) level ends ?!? and remove the time...

iam using a map from there the player can replay the bonus stages / other stuff / get in the new level
 
You're welcome Nick, that script is really really efficient, that's why I use it often especially in local branchings and room branchings  8)

how can a branch be used in a bonus stage ?

I don't understand what exactly you're aiming here.
 
i just whanted to be able to use the openbor time...
making the bonus level end when the time reaches 0
and then branch to the map level

level scripts or end level scripts.c is something i still havent tried to do...
 
ive been looking into most bor games that use a map...
i cant seem to understand how the globalvar's work ? because i cant find their (name / original place) anywere in the games...

how can i create a globalvar ? and where do i put it ?
my idea was to create a globalvar in the map stage... and make all the (B's1/2/3/4/5...) return to map when complete... and then remove the (B*)

the home/train the player could go in and out anytime...
once the player selects the playing level... he goes for about 3/4 stages until returning to the map again...
for this i have to create 11 maps.txt in levels because he only enters the map 11 times until the games reaches the end... and he unlocks (B's) a new level and other stuff has the game progress...
but i whanted to avoid have to create clone levels for (B's*) / (Home) for the 11 times he goes into map...because the level branch changes...

is there a way to spawn an entity on the map with an ("alias")
and use a globalvar on a (jumptobranch("alias", 0)  to make the (B's* / HOME)
go to current map...

MAP.png


 
i just whanted to be able to use the openbor time...
making the bonus level end when the time reaches 0
and then branch to the map level

Oh just declare I posted above and set branch name which brings to map then

ive been looking into most bor games that use a map...
i cant seem to understand how the globalvar's work ? because i cant find their (name / original place) anywere in the games...

Hmmm.... I seem to remember posting about making world map but can't remember what it was
Anyways, global variable is required if you're making world map mode to return to correct location in that mode.

Previously, when declaring script directly into level texts wasn't available, I use entity to set return coordinates for each player
Now, with script, I can set those coordinates directly and more stable.

About example, download Classic Fantasy by NickyP, there's world map mode + script to return from town/dungeon to world map close to previous marker's location
Don't forget to unpack that mod to see the scripts in player's text too

i whanted to avoid have to create clone levels for (B's*) / (Home) for the 11 times he goes into map...because the level branch changes...

Oh that one, what you need is global variable to lock markers or I should say remove branches which has been cleared before.

Hmmm.... if that sounds too complex to imagine, maybe I should make small demo to show world map mode. My, I never thought this mode is getting famous :)
 
bWWd said:
Its on my moonstone mod, you can unpack it and check ,its easy  to figure out  https://www.dropbox.com/s/seuzhvjc0ej951w/mstone.pak

Theres 2 versions of map, one is normal and other is with clearning global variables.
Dragon in his death has variable that makes the location point disappear, all location points have checks in spawn anim to make them disappear when dragon is defeated(level is cleared).
It doesnt remember your offset on map when you beat the level yet.

Check this topic -
http://www.chronocrash.com/forum/index.php?topic=952.msg9653#msg9653
 
look....

in igjoe / moonstone / knights and dragons...
i think ?!?!? the globalvar is used to kill the marker when the level is complete...

i have to make the opposite... give access to a new level when previous level is complete...

for bonus stuff / home needs to go to current mapNº...(map1/map2/map3/map4/map5/map6/map7/map8/map9/map10/map11)


now i know when posts get big no one reads them... but ill put the txt files anyway,.,,,
map2.txt
music data/music/crasmap.bor

background data/bgs/0map/back.gif
bglayer        data/bgs/0map/wtr1.gif 0 0 -30 -10 0 0 1 1 1 0 1 2 3 1
panel data/bgs/0map/panel.gif
fglayer data/bgs/0map/sun.gif 1500 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0
layer data/bgs/0map/cloud.gif 1000 0 0 0 0 0 0 -1 1 1 1 0 0 0 0 -0.5


spawn1  75 140 a
spawn2  125 70
spawn3  125 50
order         a
settime        0
notime          1
#nopause 1
type 2

bgspeed  2
setweap  9

#---------------------------
#clearglobalvar(); //Reset all cleared status
#------///---levelscript----///-----
@script
void main()
{
setglobalvar("gomap", map2);
}
@end_script

#at      0

#--------------------------//---------------

spawn  lvlstar
alias  mountain
coords  235 90
at      0

spawn  lvlmisc
alias  home2
coords  212 188
at      0

spawn  lvlbns
alias  bonus1
coords  350 190
at      0

spawn  ghosttest
coords  30 240
at      0

#------------------------//---------------

homexit.txt
anim follow1
@script
    void self = getlocalvar("self"); //Get calling entity
    char exit = getglobalvar("gomap");

    if(frame==15){
jumptobranch(exit, 1);
    }
@end_script

loop 0
delay 6
offset 115 190
bbox 0 0 0 0
frame data/chars/misc/branch/fplace20.gif
frame data/chars/misc/branch/fplace21.gif
frame data/chars/misc/branch/fplace20.gif
frame data/chars/misc/branch/fplace21.gif
frame data/chars/misc/branch/fplace20.gif

i just need to put the globalvar name or value ?!?!? (map2) in a char or string
then use it on the homexit.txt jumptobranch(********, 1);

i know on one  likes people who come here with questions about script...
but on the contrary of other people here i dont a college teacher in my pocket telling me everything what i need to know ok.

Oh just declare I posted above and set branch name which brings to map then
?!?!?!? and then ?!?!?
you mean
jumptobranch("Path1", 0); ---- 0 when all enemies are defated (normal end lvl)
1 jumptobranch right away (ghost1 at 1500 for example)
 
i have to make the opposite... give access to a new level when previous level is complete...

On endless quest, when you beat about 3 easy levels, normal difficulty levels are unlocked. When you beat normal levels, hard levels are unlocked.
 
Be careful, you cant use clearglobalvar command when youre using maps, it will mess up the map system, you should not clear global vars just set them to 0.
 
when you beat about 3 easy levels, normal difficulty levels are unlocked. When you beat normal levels, hard levels are unlocked

yes i can see 3 maps in levels "map00/map0x/map0y" map0x and map0y look almost the same they must add new levels and keep easy level in map... but to unlock a new level after previous level is complete... i think they would need a lot branch.txt files multiply the number of times you go into map for number of branch levels...

it will mess up the map system, you should not clear global vars just set them to 0

i really could use a costum value in 0 or 1... so i wouldnt had to create a new clonelvl.txt just to change the branch...
but globalvar doesnt seem work in any way it always comes out with a cant compile script.

About example, download Classic Fantasy by NickyP, there's world map mode + script to return from town/dungeon to world map close to previous marker's location

i cant find out how it stores the coordinates the players.txt spawn anim are normal theres also no scripts doing it all i can find are the respaw.txt's and spawn.txt's in /misc but they dont seem to spawn on the map level.

 
Ugh, I was going to make that demo but I just figured out that I lost old version of ClaFan that I was going to edit
Oh well, I'll use other demo then

in igjoe / moonstone / knights and dragons...
i think ?!?!? the globalvar is used to kill the marker when the level is complete...

Yes, but there are other uses. One of it is to unlock marker when global variable is set
The other use is to be used in NPC dialogue. For instance, an NPC won't say something until player has cleared a level.
Well, those are just a few uses. There are whole lot more if you use your imagination ;)

i think they would need a lot branch.txt files multiply the number of times you go into map for number of branch levels...

If you use scripts, you only need one map.txt and one marker for each location ;)
BTW the examples I shown in GI Joe and Endless Quest uses multiple spawnscripts WHICH is not supported anymore in latest builds. So you need to use scripts typed directly to map.txt, I'll show you after I get a small demo to show

i cant find out how it stores the coordinates the players.txt spawn anim are normal theres also no scripts doing it

global variables are used to store the coords. You should find the script using those variables in map mode's SPAWN animation
 
Im using one entity for every location in he-man, then i juist check whats the name and change to branch its pain animation.
I dont like to enter areas on map when touching them, i prefere to attack so its possible to add something that pops up when you walk over it on map, name of location or somethin.
Using multiple entities , one for each location mark on map have small advantages but they arent needed for me.I prefere to keep everything compact, the same with projectiles, im using one entity as projectile for most characters and change their look with spawn animation that detects colour map changed by cmd@ projectile command.
By the way i remember there was one guy on lavalit who created some heavily RPG influenced mod but didnt released it, he was using txt files to save some stuff like skills, level etc.
 
Yes, but there are other uses. One of it is to unlock marker when global variable is set
The other use is to be used in NPC dialogue.

i may be hard to understand or to were to look for.
it could be that you left the same comment in all scripts and changed only the code
but the "killentity(self);" is equal in all globalvar scripts.
// Script to remove entity if global variable named "Cobra" is filled with 1 or more

i prefere to attack so its possible to add something that pops up when you walk over it on map, name of location or somethin.

ive also made it this way. but when i tried to make a pop up text to show the level name i couldnt do it. ???
ive tried anim idle2 range / rangez but the anim would only change to idle after pain anim. ive also tried with @cmd attack but it left an leak of 1 pixel or more maybe in vertical movement when returning to previous anim again.
how did you manadge to do it ?


 
i may be hard to understand or to were to look for.
it could be that you left the same comment in all scripts and changed only the code

Well, if you're referring to GI Joe mod, I just realized that it's not good reference if you want to learn about global variable use
Anyways, I'll guide you with a mod after I'm done uploading

i prefere to attack so its possible to add something that pops up when you walk over it on map, name of location or somethin.

That's easy to make. Use type obstacle as markers then use alias to define branch to go to. In world map mode, have follow animation to be played when attack connects. In this follow animation, check the alias of the marker then jump to that branch.

You can use same trick to show name of the marker but that would involve using other entity.

[some time later]

Alright, here you go:

http://www.mediafire.com/download/l6ndj9d7h699spf/Map%282%29.rar

This small demo demonstrates the use of global variables to lock and unlock marker in world map

Enjoy! :)
 
yeah i will use similar method but i was also thinking about overall number of areas cleared so for example clearing 4 random areas would make secret area appear.
I think i solved problem of having 2 versions of map, i just set clearglobalvar in select animation of characters, so all variables are cleared in select screen, it works fine as long as you dont go from map to select screen cause it resets all locations.
 
Back
Top Bottom