Oni Central Forum

A forum for the Oni community

You are not logged in.

#1 07/19/11 15:07

Tarik
Banned

My Modification.

func main {

    #Creating Starting Script

        chr_set_health 0 400
        chr_teleport 0 7010
        
        chr_changeteam char 0 syndicate
        chr_set_class 1 konoko_generic

        chr_set_health char_0 500
        chr_teleport char_0 7008

        fade_out 0 0 0 120
        sleep 100
    
        fade_in 0 0 0 120
        sleep 300
    
        cinematic_start (TR_WP_UPPER_1, 360, 360, 15, 1, 20, false)
        sleep 300
        
        cinematic_stop (TR_WP_UPPER_1, 15, 20)
        sleep 300
        
        dmsg "[Hello!]"
    

}

func void you_lose(string ai_name)

{

    sleep 400
    fade_out 0 0 0 200
    
    sleep 200
    lose

}

func void you_win(int char_index)

{
    all_music_counters
    win

}

My Sage Piece, what would i be doing wrong?

This Script is a credit to the education system.

Last edited by Tarik (07/19/11 15:07)

#2 07/19/11 15:07

geyser
Member
From: beyond the veil
Registered: 01/14/07
Website

Re: My Modification.

The functions you_win and you_lose, at the end of the file, should both work OK. The only problem with them is that in you_win you are calling another function, all_music_counters, which may not exist. (That's a user-defined function, which the developers typically use to stop any music that may be playing at the time of winning (or losing).

Will comment on the main function later, unless somebody else wants to have a try.

Last edited by geyser (07/19/11 15:07)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

#3 07/19/11 17:07

geyser
Member
From: beyond the veil
Registered: 01/14/07
Website

Re: My Modification.

There are two lines in the main function that can make it not work. What's worse, Oni may crash.

1) chr_changeteam char 0 syndicate
That one is wrong for two reasons. First, it should be Syndicate and not syndicate. Almost everything in scripts is case-sensitive, and team names should be capitalized.
Second, it should be char_0 and not char 0. The name of Konoko's character in level 1 is "char_0". In some other levels it's "konoko", or "A_player". If you want to change Konoko's team regardless of what her name is, you can identify her with a "script ID", which is 0. The command would then be this: chr_changeteam 0 Syndicate
Actually, you are already addressing Konoko by her script ID in the first two commands, that is, chr_set_health 0 400 and chr_teleport 0 7010

2) chr_set_class 1 konoko_generic
The problem here is that you are trying to change the class of character number 1. Characters are numbered in the order that they appear in the level: Konoko is 0, the first AI to be spawned is 1, the next is 2, etc. At that time, Konoko is the only character, so there is no character that has the number 1, at all. You just can't use that line unless you spawn another character, first.

I think that what you are trying to do is this:

func main {
#Setting up player (health, position)
        chr_set_health 0 400
        chr_teleport 0 7010
        
#Setting up opponent (spawn, team, appearance)
#This is the first spawned AI, so its ID will be 1 
        ai2_spawn demo3
        chr_changeteam demo3 Syndicate
        chr_set_class 1 konoko_generic
#Setting up opponent (health, position)
        chr_set_health demo3 500
        chr_teleport demo3 7008

        fade_out 0 0 0 120
        sleep 100
        fade_in 0 0 0 120

        sleep 300
        cinematic_start (TR_WP_UPPER_1, 128, 128, 15, 1, 20, false)
        sleep 300
        cinematic_stop (TR_WP_UPPER_1, 15, 20)

        sleep 300
        dmsg "Hello!"
}

func you_lose {
    sleep 400
    fade_out 0 0 0 200
    sleep 200
    lose
}

func you_win {
    win
}

Apparently you thought that "char_0" was the name of an AI character, and you tried to set up that character as an opponent for the playable Konoko. That won't work because "char_0" is just another way to refer to the playable Konoko. Her "number" (by order of spawning) is 0, her "script ID" (which is accepted by many commands instead of the name) is also 0, and her name (in this level) is "char_0".
So, what I did was, I spawned the female cop character (her name is "demo3"), and adapted the rest of your script. Now the first two commands set up Konoko, and the next five set up "Evil Konoko".

And, congratulations, it's a fine little script! The next step can be to force-spawn a lot of copies of "demo3", shapeshift them all to konoko_generic, and try to put them all in the same room smile

Last edited by geyser (07/19/11 17:07)


Behold the power of that which is yet unborn! For the swirling images that flow forth from the Chrysalis are only a shadow of the sleeper's true power.

Offline

Board footer

Powered by FluxBB