Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 06/27/09 13:06

Shade
Member
From: OH, USA
Registered: 06/08/08

Oni Scripting Question.

Hi, I'm just wondering what is all involved with Scripting Oni. Is Scripting Oni and making mods the same thing? And is there a Script Editor that I could use to script the game? I have my own copy of the game and I would like to get into scripting it and making my own mods. Is there any programs or tutorials that could help me out with this problem?  Sorry for the noobish question. One more question, If I wanted to spawn a character in the Dreamlab Level, and I wanted to spawn Griffin, Muro and Evil Konoko and adding a song to it. What would I need to do in order to make it happen? Again sorry if this question sounds a little newbie to everyone. I am a beginner at this and I am just seeking for some help. Thanks. BTW, Sorry if this is in the wrong thread.

Offline

#2 06/27/09 19:06

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Oni Scripting Question.

Shade wrote:

Is Scripting Oni and making mods the same thing?

Scripting is one kind of modding.  All other modding falls under the heading of "Binary hacking", which is harder, but a lot easier than it used to be with recent advances in our community tools.

And is there a Script Editor that I could use to script the game?

If you're on Windows, you can try this one: http://mods.oni2.net/index.php?q=node/61.  There is also a template for Notepad++ out there somewhere that someone can probably post for you.

Personally, I write BSL manually in TextEdit on my Mac and it is not too difficult as long as I keep a browser window open to the wiki docs on BSL.

Is there any programs or tutorials that could help me out with this problem?

You can learn from example, by reading Oni's scripts and experimenting with them, and you can learn from the OniGalore wiki (see the link in the header bar to the forum?), which has a pretty good section on scripting.

One more question, If I wanted to spawn a character in the Dreamlab Level, and I wanted to spawn Griffin, Muro and Evil Konoko and adding a song to it. What would I need to do in order to make it happen?

The ai2_spawn command is used to create a character in a level, but you can only spawn a character who is in the BINACJBOCharacter file for that level.  I will have to let someone else answer this part more fully, as I am rather short on time at the moment.

But don't hesitate to ask newbie questions, that's what we're here for smile


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#3 06/27/09 20:06

love_Oni
Member
From: Da Nang, Vietnam
Registered: 05/10/08

Re: Oni Scripting Question.

Here are some web pages that may help you:

Scripting Turtorial: It shows the basic way to make a script.

List of all functions that you may need to use in the script.

List of all moves' name.

Adding character to a level Tutorial.

I'm sorry that I can't say anything to help you mod but anyway I would like to help you if I can.

And welcome. Hope you will your time enjoying at the forum. smile

Last edited by love_Oni (06/27/09 20:06)


The Boy Who Knew Too Much tongue

Offline

#4 06/28/09 12:06

Mukade
Member
From: Ottawa, Ontario - Canada
Registered: 05/29/07

Re: Oni Scripting Question.

what your speaking of is a fairly simple mod to make, if you know how.

Basically, the only difficult part would be your flags, but once youget past that, all you would have to do is

ai2_spawn evilkonoko
ai2_spawn Griffen
ai2_spawn Muro_generic (im not sure if this is right for muro)
chr_teleport evilkonoko <flag>
chr_teleport Griffen <flag>
chr_teleport Muro_generic <flag>
** now for teams it would depend what u want, if you want all against u it would be
chr_set_team evilkonoko Syndicate
chr_set_team Griffen Syndicate
**i think muro is alreadsy set to syndicate?
**if you want them to fighteach other the simplest way to do this is to put on the cheat reservoirdogs

i know i havent been clear, and i dont know how to putthe music but....
at least udont have to modify BINACJBOCharacter file.. sicne the ones u want are already there


"He looks mean enough to tear my arm off and beat me to death with it. In fact, he looks mean enough to tear his OWN arm off and beat me to death with it."

Offline

#5 06/28/09 13:06

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Oni Scripting Question.

Music is controlled with BSL functions sound_music_start, sound_music_volume, and sound_music_stop.  For instance, to start playing the mus_asian track, then fade it out over two seconds:

sound_music_start mus_asian 0.8
#presumably some other code is running for a while, then...
sound_music_volume mus_asian 0.0 2.0
sound_music_stop mus_asian

All music track names seem to be listed here: http://wiki.oni2.net/Music/Ingame , and of course the specifics of how the above functions work are documented on the wiki.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#6 06/29/09 03:06

Shade
Member
From: OH, USA
Registered: 06/08/08

Re: Oni Scripting Question.

Wow nice!, Thanks for the help guys. smile

Offline

#7 07/21/09 17:07

Lil
Member
Registered: 07/20/09

Re: Oni Scripting Question.

i'm gradually getting to grips with script-talk and i've jus read the basics of scripting on the wiki page provided in this thread- i feel inspired to for once get involved in a mod of my own - don't know how successful it will be hmm so thanks smile

Offline

#8 07/22/09 11:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

Hey if you have a function fork itself at its end to loop, is there any way you can disable the function with a certain condition so that it no longer executes?


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

#9 07/22/09 12:07

Gumby
Member
From: Seattle, WA, USA
Registered: 08/30/07

Re: Oni Scripting Question.

func forked_func(void) {

if (random_condition eq whatever_number) fork forked_func
}


Iritscen: roll
Iritscen: it's amazing this program even works
Gumby: i know
Iritscen: and that statement applies to my code, not just yours

Offline

#10 07/22/09 13:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

So...  How much of that is filler and how much is actually needed?  Lol.

Like, okay, let's say my forked func is called "health," because technically it is in the script I'm writing.  So the way I see what you're telling me is this:



func void main(void)
{
*whatever*
fork health
}

func health
{
*whatever*
fork health
}

func health(void)
{
*a certain amount of time passes*
}



Something like that?


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

#11 07/22/09 13:07

Phydur
Member
Registered: 01/13/07

Re: Oni Scripting Question.

no, thats not quite right.

func void main(void)
{
*whatever*
fork health
}

func health(void)
{
*whatever*
if (*condition* eq *whatever_number*) fork health
}

the key is the if condition.
if the condition is met, it will fork the function and repeat it.
if the condition is not met. it will skip the fork and just end.

alternately you can make it not equal, and then when it dosent equal that number it will loop and if it dose equal that number it will just end.
dose that help?

Last edited by Phydur (07/22/09 13:07)


I intentionally spell dang, dange, FYI.

Offline

#12 07/22/09 14:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

Ah yeah.  So how do you say not equal or if not or whatever?

Like...  Okay, here's what it is right now.

func health(void)
{
chr_wait_health 0 199
chr_set_health 0 200
sleep 60
fork health
}

Let's say I wanted to make it loop until Muro was spawned.  (I do...  Lol, I'm not very imaginative apparently.)  It'd be like...  Actually, I have no idea.  Is that a legitimate condition?  If not I could probably get creative and make something else arbitrary happen as a condition.


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

#13 07/22/09 15:07

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Oni Scripting Question.

I guess my question would be, What causes Muro to spawn?  If you have code to do that somewhere else, then set a variable to mark it when it happens.  You would declare the variable at the very top of the BSL, e.g. "var bool muro_spawned = 0;", then put the line "muro_spawned = 1" where he gets spawned in the script.

You would then say:

if (muro_spawned eq 0)
   fork health

at the end of the self-forking function to stop forking when muro_spawned is no longer zero.  "ne" = "not equal to" and "eq" = "equal to".


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#14 07/22/09 16:07

Gumby
Member
From: Seattle, WA, USA
Registered: 08/30/07

Re: Oni Scripting Question.

Always use ints. Bools are pure evil. smile


Iritscen: roll
Iritscen: it's amazing this program even works
Gumby: i know
Iritscen: and that statement applies to my code, not just yours

Offline

#15 07/22/09 19:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

Thanks.  smile  I'll give that a try.


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

#16 07/22/09 20:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

Okay, I tried a bunch of different things and it always spawns me at the beginning of the level (which is not what's supposed to happen) and gives some weird error message; right now it's

Func "(null)", File "Management.bsl", Line 1: Illegal token, got "func" expected ";"
Func "main", File "(called from engine)", Line 0: Semantic error, function "main" does not exist

That comes from me having var int Muro_Spawned = 0 right at the top before func void main(void).  The main function forks manage and health, and in manage I have a line that says Muro_Spawned = 1 after a certain point.  Finally, health looks like this now:

func health(void)
{
chr_wait_health 0 199
chr_set_health 0 200
sleep 60
if (Muro_Spawned eq 0)
fork health
}

Sup?  Lol.  Also I tried making the top line var bool Muro_Spawned = 0 just in case, but it still didn't work.


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

#17 07/22/09 21:07

Iritscen
Moderator
From: NC, USA
Registered: 10/22/07

Re: Oni Scripting Question.

You need to end lines with semicolons when they're outside of a function, like your muro_spawned declaration is.  Don't ask me why, but weak syntax isn't allowed in the global space.


Check out the Anniversary Edition Seven at ae.oni2.net!

Offline

#18 07/23/09 09:07

Leus
Member
From: Boone, NC
Registered: 05/28/09
Website

Re: Oni Scripting Question.

Aahh, thanks.  It seems to be working.  smile


If we don't change the direction we're going, we'll likely end up where we're headed.

Offline

Board footer

Powered by FluxBB