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

There aren't any users online.



Author Topic: scripts made easy: your cut/paste script database  (Read 2868 times)

0 Members and 1 Guest are viewing this topic.

Offline Vyck_St.Judas

  • Sr. Member
  • ****
  • Posts: 433
scripts made easy: your cut/paste script database
« on: October 20, 2009, 06:49:28 am »
I wont pretend to know how to script things myself, as i dont.
there are a great many useful examples scattered throughout the forum though. as i come across them, i'll post them here for ease of use. anyone is free to add what they've found or coded themselves. As this compilation is meant to be as NOOB friendly as possible, i would ask that you follow the below guideline.
             How do i make my characters flash when they get hit
this first one was originally posted by BLOODBANE with added input from BARITONOMARCHETTA, in response to a question from Nicky:P

NickyP asks-how do i go about Switching an enemy's remap with nopain?

BLOODBANE replies- "I usually use this takedamagescript:

void main()
{// Blink effect script
   void self = getlocalvar("self"); //Get calling entity.
   changeentityproperty(self, "colourmap", 1); //Set the remap here
   changeentityproperty(self, "maptime", 20 + openborvariant("elapsed_time")); //  Set how long the remap change would be
}

 Of course the blink remap must be ready and set as 1st remap to use this."
------------------------------------------------------------------------------------------
MY 2 CENTS: the lines highlighted in red are the ones that require your personal input.
i could be wrong but...
The first smiley requires the PATH to your entities 1ST remap.
The second is the amount of time (in centi-seconds) you want that remap to play.
------------------------------------------------------------------------------------------

NickyP then asks-So, uh, where would I put this?

Baritonnomarchetta replies:
"That's a takedamagescript, so you must declare the path in your ENTITY HEADER

takedamagescript data/scripts/yourscriptnamehere.c
------------------------------------------------------------------------------------------
if you're really new to this, the entity header is the .TXT file that goes in with your entity's .GIF files. it basically tells the engine how your entity interacts with the world around it.
if you did'nt know that, you should really read this: http://www.senileteam.com/bormanual.html
thanks for giving this thread a squeeze, hopefully this is helpful.
i'll try and add more scripts as i find them.
------------------------------------------------------------------------------------------
« Last Edit: October 20, 2009, 08:22:35 am by Vyck_St.Judas »

Offline Vyck_St.Judas

  • Sr. Member
  • ****
  • Posts: 433
Re: scripts made easy: your cut/paste script database
« Reply #1 on: October 20, 2009, 08:13:35 am »
                How to set a start point anywhere on your level
hey look at that!!!
we've got another hot one from BLOODBANE, in response to a question from BURNKING

Burnking asks-is there a max value of how far down you can spawn a char at level start?

Bloodbane's response is this-
"I used this entity to shift player's starting point to anyplace:

Quote
name   1spawn
type   none
shadow   0

anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int P1 = getplayerproperty(0, "entity");

    changeentityproperty(P1, "position", x, z, a);
    killentity(self); //Suicide!
@end_script
   loop   1
   delay   5
   offset   1 1
   frame   data/chars/misc/empty.gif

 This entity changes 1st player's starting point to its position. For instance, if this entity is placed at:

coords 800 300 100

 1st player will start the game at that coordinate (800, 300 and 100 pixels above the ground).
 This entity removes itself after moving player.
------------------------------------------------------------------------------------------
Baritonnomarchetto had another solution that resolves start points in multiplayer...hell yeah!!!
------------------------------------------------------------------------------------------

I also faced a problem like this. I used "levelscript" (path defined in the level text header) with this code:

Code:

changeentityproperty(getplayerproperty(0, "entity"), "position", 40, openborconstant("PLAYER_MIN_Z")+600, 0);
changeentityproperty(getplayerproperty(1, "entity"), "position", 40, openborconstant(""PLAYER_MIN_Z")+620, 0);
changeentityproperty(getplayerproperty(2, "entity"), "position", 40, openborconstant("PLAYER_MIN_Z")+640, 0);
changeentityproperty(getplayerproperty(3, "entity"), "position", 40, openborconstant("PLAYER_MIN_Z")+660, 0);

Just modify the numbers with your desired starting positions. Notice that "z" is defined with respect to the level minz
------------------------------------------------------------------------------------------
 :remember: remember the red highlighted areas are the ones that require your input.
if anyone has more info on this feel free to elaborate. in the meantime i'll get back to diggin' in the crates for your sweet script fix.
------------------------------------------------------------------------------------------

Offline Saint Antuan

  • Sr. Member
  • ****
  • Posts: 320
    • Streets of Seiya Mod
Re: scripts made easy: your cut/paste script database
« Reply #2 on: November 12, 2009, 05:04:49 pm »
This post is really interesting, have a lot of interesting scripts in one post is great :)

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: scripts made easy: your cut/paste script database
« Reply #3 on: December 10, 2009, 12:21:33 am »
 After Nick asked for blink effect when taking damage, I figure I should share this script for others too. This script changes entity's remap to certain remap (blink remap) briefly then revert to previous remap. See attached file below. It can be placed in any folder but let's put it in data\scripts\ folder.

 To use this script, declare it in entity's text header like this:

takedamagescript data/scripts/blink.c

 Then prepare a blink remap and set it as 1ST remap.

 The script is ready to use.
 For those who wants to edit the script, here's a rundown:

void main()
{// Blink effect script
    void self = getlocalvar("self"); //Get calling entity.
    void Health = getentityproperty(self,"health");

    if (Health > 0){ // Health check to prevent blinking when entity is hit by final blow
   changeentityproperty(self, "colourmap", 1); // Blink remap uses 1st remap
   changeentityproperty(self, "maptime", 20 + openborvariant("elapsed_time")); // Defines how long the blinking would occur
    }
}

 As for blinking time, I'm not sure of the time units but one thing for sure is if the blinking is too quick, change '20' above to bigger value and if it's too long, change to smaller value.
 You can change Blink remap to other number. I just use 1st one for standard so I don't have to make various blink.c like this.

 Last, if you're using this for players, don't forget to hide the blinking remap with 'hmap' command to prevent players from choosing it in select screen.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline bWWd

  • Hero Member
  • *****
  • Posts: 1870
Re: scripts made easy: your cut/paste script database
« Reply #4 on: September 18, 2010, 04:22:07 am »
Changing to folow1 anim (just replace the name to change to any other anim)when pressed up and attack ,script goes to attack1 anim or whatever is your first attack in chain combo:

Code: [Select]
@script
                void self = getlocalvar("self");
                int iPIndex = getentityproperty(self,"playerindex");
                 if ((playerkeys(iPIndex, 0, "moveup"))&&(frame == 0)){
                changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}
@end_script


could be edited ,"moveup" replaced with "movedown" ,for left and right you would need to check facing of character.
---------------
Simple script  for moving entity up ,can go before any frame :
Code: [Select]
@cmd changeentityproperty getlocalvar("self") "velocity" 0,7you need to stop it tho (with values "velocity" 0,0) at the last frame cause it could make some unusual effects in anims after this one.
--------------
This script is similar but makes checks for facing and moves entity forward on second frame , you want different frame then change "frame==2" to different number(first frame is 0) ,it stops entity at frame 5 but you can also change that,you can also change velocity values but they should be opposite in facing 0 and facing 1 (+/- ) to get proper effect like moving forward in running attacks no matter which side your character is facing :

Code: [Select]
@script
                 void self = getlocalvar("self");
  if ((getentityproperty(self, "direction")==1)&&(frame == 2)){
changeentityproperty(self, "velocity", 3.5, 0, 0);
}
if ((getentityproperty(self, "direction")==0)&&(frame == 2)){
changeentityproperty(self, "velocity", -3.5, 0, 0);
}
if(frame == 5){
void self = getlocalvar("self");
changeentityproperty(self, "velocity", 0, 0, 0);
}
@end_script
--------
This one kills entity when placed in animation and its played by entity
Code: [Select]
@cmd killentity getlocalvar("self")
« Last Edit: September 18, 2010, 04:24:56 am by bWWd »

Offline Fish

  • Jr. Member
  • **
  • Posts: 83
Re: scripts made easy: your cut/paste script database
« Reply #5 on: October 03, 2010, 10:03:18 am »
This post is really interesting, have a lot of interesting scripts in one post is great :)

Yes! Really true,It's a useful help  ;) Some mod can block this post up of the bottom with the other like manual. 

Offline maxman

  • Hero Member
  • *****
  • Posts: 2763
  • I'm a slowpoke in speed.
Re: scripts made easy: your cut/paste script database
« Reply #6 on: October 07, 2010, 04:56:13 pm »
How about if I change the remap to 2 like this?

Quote
changeentityproperty(self, "colourmap", 2);

EDIT: Sorry Bloodbane. I know how to quote, but the reason I did that was to give an example instead of formatting in code. :P :bored:

EDIT2: Bloodbane was wrong. :P
« Last Edit: October 13, 2010, 10:18:54 pm by maxman »
Dragon Duo (W.I.P./Outdated demo (2010 version)) (in progress)
Captain Commando (in progress)
Unelmia: Dreamers' Fate (collaborating with contress/taskmaster) (in progress)

Best OpenBOR mods:Spoiler
1. World Heroes Supreme Justice
2. Golden Axe Myth
3. Art of Fighting: Beats of Rage Remix III
4. A Tale of Vengeance
5. Valdivia Ransom City (demo)
6. Sega Brawlers Megamix
7. Super Fightin Spirit
8. Angel-0

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: scripts made easy: your cut/paste script database
« Reply #7 on: October 07, 2010, 07:46:30 pm »
 Oh maxman, please quote properly. Took some time to figure out that you are actually referring to blink script posted above.
 Anyways, the answer is yes. Engine won't care which remap you are using. I used 1st remap for consistency and efficiency (using same blink script for all entities that is).

 While I'm here, I'd like to post script example to make entity floats for couple time. Here it is:

Quote
anim follow4
@script
    void vSelf = getlocalvar("self");   

    if(frame==1){
      int  iTime = openborvariant("elapsed_time");

      changeentityproperty(vSelf, "tosstime", iTime + 140);
    }
@end_script
    delay    10
    fastattack 1
    offset    170 302
    bbox    125 63 97 130
        frame   data/chars/kenshiro/rjkick1.png
        frame   data/chars/kenshiro/rjkick2.png
    delay    6
    attack    223 103 167 64 8
        frame   data/chars/kenshiro/rjkick3.png
    attack    0
        frame   data/chars/kenshiro/rjkick4.png
    attack    205 137 180 49 8
        frame   data/chars/kenshiro/rjkick5.png
    attack    0
        frame   data/chars/kenshiro/rjkick6.png
    attack    208 153 148 86 9
        frame   data/chars/kenshiro/rjkick7.png
    delay    10
    attack    0
        frame   data/chars/kenshiro/rjkick8.png
        frame   data/chars/kenshiro/rjkick9.png

 With this script, Kenshiro is not falling down starting from 1st frame to end. He falls normally after this animation ends. I set 140 above to make Kenshiro floats for about 70 centiseconds.

 In case anyone wonders, this is alternate jumpkick for Kenshiro.
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: scripts made easy: your cut/paste script database
« Reply #8 on: February 08, 2012, 10:49:52 pm »
 I just realized that I should share this one as well. Attached below is spawnscript which nullifies scroll position so spawned entity will always be spawned in certain spot regardless of current scroll position.

 It is useful mostly in levels with direction both since player can scroll back and forth. For example: In a level with direction both with doors on background, players must defeat wave of enemies. Some enemies including the boss come from those door. The level has group setting to control enemy number. While fighting, it is possible for scroll position or screen to be in wrong place causing next enemy spawns especially the ones coming from doors spawned in wrong place. This spawnscript will solve the problem.

 Sorry, I don't have anything to show how this script works ATM.

 EDIT: This spawnscript only works for direction both or right level.
« Last Edit: February 09, 2012, 12:06:44 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 Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: scripts made easy: your cut/paste script database
« Reply #9 on: February 10, 2012, 10:07:49 pm »
 Pierwolf asked how to modify 1spawn item above to suit other players. It's simple actually but I'll post all 4 of them here to make it easy:

For player 1:
Code: [Select]
name 1spawn
type none
antigravity 100

anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction
    int P1 = getplayerproperty(0, "entity");

    changeentityproperty(P1, "position", x, z, a);
    changeentityproperty(P1, "direction", dir);

    killentity(self); //Suicide!
@end_script
loop 1
delay 5
offset 1 1
frame data/chars/misc/empty.gif

For player 2:
Code: [Select]
name 2spawn
type none
antigravity 100

anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction
    int P2 = getplayerproperty(1, "entity");

    changeentityproperty(P2, "position", x, z, a);
    changeentityproperty(P2, "direction", dir);

    killentity(self); //Suicide!
@end_script
loop 1
delay 5
offset 1 1
frame data/chars/misc/empty.gif

For player 3:
Code: [Select]
name 3spawn
type none
antigravity 100

anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction
    int P3 = getplayerproperty(2, "entity");

    changeentityproperty(P3, "position", x, z, a);
    changeentityproperty(P3, "direction", dir);

    killentity(self); //Suicide!
@end_script
loop 1
delay 5
offset 1 1
frame data/chars/misc/empty.gif

For player 4:
Code: [Select]
name 4spawn
type none
antigravity 100

anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction
    int P4 = getplayerproperty(3, "entity");

    changeentityproperty(P4, "position", x, z, a);
    changeentityproperty(P4, "direction", dir);

    killentity(self); //Suicide!
@end_script
loop 1
delay 5
offset 1 1
frame data/chars/misc/empty.gif
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline Itsuchi KS

  • Full Member
  • ***
  • Posts: 218
  • Pain Gives Birth To Weakness-Compelling Strength
Re: scripts made easy: your cut/paste script database
« Reply #10 on: February 11, 2012, 12:10:59 am »
Ok, now I'm gonna ask how would I get the same zoom effect as I'm Rocket Viper 2? Here lately I was able to use the part of the update.c that I wanted but I can't seem to get the zoom effect without the unwanted parts of the script. I just need it for when the big super arts connect. Ummm...like for example, in sf3 3rd strike when ryu connects with the final hit in the shin shoryuken the screen zooms in. How would I do that? I think thhis is the right thread to ask this question

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: scripts made easy: your cut/paste script database
« Reply #11 on: July 29, 2012, 09:02:39 am »
 Good news! Remember noscpos.c above, when I tried to make another version for direction left and leftright, it turned out (after some trial n error), that spawnscript is sufficient for direction left and leftright. So there's no need for direction left version :).

 Alright, here's an example on how to use that spawnscript:
Code: [Select]
spawn Exit
spawnscript data/scripts/noscpos.c
alias Hallway
flip 1
coords 465 155
at 0

 Exit will be spawned exactly at 465 pixels measured from leftmost edge of playing field NO MATTER where the screen is.
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

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

Offline Die_In_Fire

  • Hero Member
  • *****
  • Posts: 1140
  • Where eagles dare!
Re: scripts made easy: your cut/paste script database
« Reply #12 on: July 29, 2012, 10:10:43 am »
that will come in handy  :cheers!:

very good work as usual BB!!  :cheers!:

 



 0%




SimplePortal 2.3.3 © 2008-2010, SimplePortal