Page 56 of 60 FirstFirst ... 6 46 54 55 56 57 58 ... LastLast
Results 551 to 560 of 599

Thread: SAPP

  1. #551

    Code Gephyrophobia Dogfight

    Because I've written this three times now, I'm pasting this here so I don't lose it again. It's a banshee dogfight game script, best played on gephyrophobia with reverse tag.

    events.txt:
    Code:
    event_start $mode:Dogfight $map:Gephyrophobia 'cheat_jetpack 1'event_spawn $mode:Dogfight 't $n spawn$rand;w8 1;spawn vehi vehicles\banshee\banshee_mp $n;venter $n'
    event_die $mode:Dogfight 'w8 3;vdel $n'
    event_alive $mode:Dogfight $z<=-32 'say $n "Out of Bounds, penalized 50% health";m $n 0 0 10;hp $n /2;spawn vehi vehicles\banshee\banshee_mp $n;venter $n'
    locations.txt:
    Code:
    gephyrophobia:spawn1:58 -120 -6
    gephyrophobia:spawn2:58 -90 -6
    gephyrophobia:spawn3:58 -60 -6
    gephyrophobia:spawn4:58 -30 -6
    gephyrophobia:spawn5:58 -120 -5
    gephyrophobia:spawn6:58 -90 -5
    gephyrophobia:spawn7:58 -60 -5
    gephyrophobia:spawn8:58 -30 -5
    gephyrophobia:spawn9:-5 -120 -6
    gephyrophobia:spawn10:-5 -90 -6
    gephyrophobia:spawn11:-5 -60 -6
    gephyrophobia:spawn12:-5 -30 -6
    gephyrophobia:spawn13:-5 -120 -5
    gephyrophobia:spawn14:-5 -90 -5
    gephyrophobia:spawn15:-5 -60 -5
    gephyrophobia:spawn16:-5 -30 -5
    Edit:
    Also, pleeaase look into custom variables so I don't have to do things with opensauce like this
    Code:
    event_spawn $team:red 'if (not (and (!= (runtime_integer_get 20) 0) (!= (runtime_integer_get 21) 0) (!= (runtime_integer_get 22) 0) true)) (begin (runtime_integer_set 20 (* (object_data_get_real (unit (list_get (players) (- $n 1))) "position" "x") 100)) (runtime_integer_set 21 (* (object_data_get_real (unit (list_get (players) (- $n 1))) "position" "y") 100)) (runtime_integer_set 22 (* (object_data_get_real (unit (list_get (players) (- $n 1))) "position" "z") 100)));object_data_set_real (unit (list_get (players) (- $n 1))) "position" "x" (/ (runtime_integer_get 20) 100);object_data_set_real (unit (list_get (players) (- $n 1))) "position" "y" (/ (runtime_integer_get 21) 100);object_data_set_real (unit (list_get (players) (- $n 1))) "position" "z" (/ (runtime_integer_get 22) 100)'
    Didn't actually work, but certain operations do, as long as they take integers. I tried at one point to use players' shields as temporary storage, which actually almost worked, but the runtime_integer commands don't like receiving floats back. Also opensauce breaks the start event, so it renders most things useless anyways.
    Last edited by SonicXP; May 8th, 2014 at 07:47 PM.

  2. #552
    Kid in the Hall Kornman00's Avatar
    Join Date
    Sep 2006
    Location
    ◕‿◕, ┌( ಠ_ಠ)┘
    Posts
    3,130

    Re: SAPP

    If you need float support, Halo has 7 unused "f0" to "f6" globals. However, they're literally global. Their values will persist from one game to the next. OS's runtime values are based entirely within the game state, which means they're reset on a new map (but they're also saved when the game is saved, unlike "f0" etc).

    You also use the runtime_vector stuff, which operates on floats

  3. #553
    suum cuique sehe's Avatar
    Join Date
    Aug 2011
    Location
    Hungary
    Posts
    217

    Re: SAPP

    I tried to add "custom variables" like two times, but including it to the event system isn't that easy as it seems for the first time, so it ended up as "commented out" code as I cba'd to mess with this, and also because I tough I (or Btcc22) will rather add Lua, but it would be again lot of work. I think I wanted it to work like for ex. you could add variables like v1, v2, ... v16, and then using them as event_die v$n<3 '...'
    Guess I can give it a try again.

  4. #554

    Re: SAPP

    Quote Originally Posted by Kornman00 View Post
    If you need float support, Halo has 7 unused "f0" to "f6" globals. However, they're literally global. Their values will persist from one game to the next. OS's runtime values are based entirely within the game state, which means they're reset on a new map (but they're also saved when the game is saved, unlike "f0" etc).

    You also use the runtime_vector stuff, which operates on floats

    i love you

    I think I tried to use vectors at one point, but I also didn't quite understand blam at the time. Maybe I can get it to work now.

    Quote Originally Posted by sehe View Post
    I tried to add "custom variables" like two times, but including it to the event system isn't that easy as it seems for the first time, so it ended up as "commented out" code as I cba'd to mess with this, and also because I tough I (or Btcc22) will rather add Lua, but it would be again lot of work. I think I wanted it to work like for ex. you could add variables like v1, v2, ... v16, and then using them as event_die v$n<3 '...'
    Guess I can give it a try again.
    even having something like $v1-16 and commands like setv1-16 would help

    edit:
    Now I remember why I didn't use f0-6, it won't set on the server console.

    edit 2:
    Is it possible to make commands like assists accept a float? Not that I want to display a decimal in the scoreboard, but if I were insane enough to try and show somebody's health * 100 and rounded for instance
    Last edited by SonicXP; May 9th, 2014 at 06:02 PM.

  5. #555
    Kid in the Hall Kornman00's Avatar
    Join Date
    Sep 2006
    Location
    ◕‿◕, ┌( ಠ_ಠ)┘
    Posts
    3,130

    Re: SAPP

    Were you doing "(set f0 <value>)"?

    Doing "f0 <value>" only works when it is the only expression being entered. IE, "halo(f0 <value>". If you were evaluating a (begin) expression in the server console, you'd have to use (set)

  6. #556
    suum cuique sehe's Avatar
    Join Date
    Aug 2011
    Location
    Hungary
    Posts
    217

    Re: SAPP

    Well yesterday I was working on this till 3am but I think it worth it in the end... You will be able to add 2*3 types of variables, string, int, float both for global and player. They are working just like the generic sapp variables.
    var_add <name> <type>, where type 0 - global string, 1 - global int, 2 - global float, 3 - player string, 4 - player int, 5 - player float

    Some bad examples for usage for globals:
    var_add time 1
    var_add min 1
    var_add sec 1

    events.txt:
    event_start 'var_set time 0'
    commands.txt:
    timeloop 'w8 1;var_set time +1;timeloop'
    time 'var_set min $time;var_set min /60;var_set sec $time; var_set sec `;say $n "Current game is running since $min minutes and $sec seconds!"' -1
    init.txt:
    timeloop


    and for player:
    var_add warnings 4
    events.txt:
    event_tk 'var_set warnings +1 $n;cevent warn'
    event_custom $ename:warn $warnings=3 'say $n "One more warn and you will be kicked, $name!"'
    event_custom $ename:warn $warnings=4 'k $n "Too many warnings."'
    commands.txt:
    warn #n 'var_set warnings +1 #n;say #n "You got a warning from admin $name!";cevent warn #n' 3

    A bit hacky but works fine, the rest is up to your fantasy... :P


    edit 2:
    Is it possible to make commands like assists accept a float? Not that I want to display a decimal in the scoreboard, but if I were insane enough to try and show somebody's health * 100 and rounded for instanc
    Crazy and cool idea, but it's not possible atm, I will might add a converting function tho for custom variables.
    Last edited by sehe; May 10th, 2014 at 08:47 AM.

  7. #557

    Re: SAPP

    Quote Originally Posted by Kornman00 View Post
    Were you doing "(set f0 <value>)"?

    Doing "f0 <value>" only works when it is the only expression being entered. IE, "halo(f0 <value>". If you were evaluating a (begin) expression in the server console, you'd have to use (set)
    I had some wildly different results with that
    I could not set f0 doing 'f0 <value>' in any case, but I could use 'set f0 <value>' on the client console. Neither method worked on the server.
    I also just tried wrapping it in a begin, no luck. It's like something on the server is preventing me from changing the value through the console.

  8. #558

    Re: SAPP

    Quote Originally Posted by sehe View Post
    Well yesterday I was working on this till 3am but I think it worth it in the end... You will be able to add 2*3 types of variables, string, int, float both for global and player. They are working just like the generic sapp variables.

    <magic>
    This is amazing, I can write a fully featured drop-in-able and configurable script to buy vehicles

    In regards to the custom events, I haven't had any success using variables like $assists or $hp there, but $n (and supposedly the new variables) work. Is this intentional or a bug? With the custom variables, I can actually work around it now, but still.

  9. #559
    Kid in the Hall Kornman00's Avatar
    Join Date
    Sep 2006
    Location
    ◕‿◕, ┌( ಠ_ಠ)┘
    Posts
    3,130

    Re: SAPP

    It sounds as if the server you're using isn't properly modified to allow any hs function execute from the console. If you were using OS in a client, then you'd be able to as we kill any code that inhibits hs function access.

  10. #560
    Amit's Avatar
    Join Date
    Dec 2006
    Location
    Malden
    Posts
    8,505

    Re: SAPP

    Bascially: use OpenSauce. It taste good. Nice program. You like.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •