忍者ブログ
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。


     for P in Players() do
--            P.items["knife"]                    = 0
            P.items["pistol"]                    = 0
            P.items["pistol ammo"]                = 0
            P.items["fusion pistol"]            = 0
            P.items["fusion pistol ammo"]        = 0
            P.items["assault rifle"]            = 0
            P.items["assault rifle ammo"]        = 0
            P.items["assault rifle grenades"]    = 0
            P.items["missile launcher"]            = 0
            P.items["missile launcher ammo"]    = 0
            P.items["alien weapon"]                = 0
            P.items["alien weapon ammo"]        = 0
            P.items["flamethrower"]                = 0
            P.items["flamethrower ammo"]        = 0
            P.items["shotgun"]                    = 0
            P.items["shotgun ammo"]                = 0
            P.items["smg"]                        = 0
            P.items["smg ammo"]                    = 0
     end

You can control how many each items players have. VERYVERY*10000 easy.
wishing to play with only Rockets? it is also so easy.

but be careful a little bit, "--" in "knife" line. this means whether you can choose fist.

Download(zip)
PR
Script by Kata.
with editing this script, you can put items or scenaries on/ above on a player, or polygons.

Kataさんのスクリプトです。
これを応用すると、プレイヤーの頭上にアイテムや背景を配置したりといったことも可能になります。


--[[ Mapにプレイヤーの位置を表示する ]]
--Showing whereabout of each players

Triggers = {}

function Triggers.init()
--in this section put annotations for each joined players.
--coodinates?? we will do it later ok?
--このセクションではアノテーション(マップ上の文字)を
--プレイヤー毎に行っています。座標は取り敢えず適当に。
    for p in Players() do
        p._annotation = Annotations.new(Polygons[1], " ",0 ,0)
    end
end

function Triggers.idle()
--with the function "annotation()", the annotations will keep moving.
--so they show
each players' name and whereabouts.
--ここでは常にアノテーションの位置を移動するfunctionを稼働させています


    annotation()
end

function annotation()

--this function works every tick in the game so annitation moves.
--アノテーションの位置を常に移動するためのfunction。

    for p in Players() do
        p._annotation.polygon = p.polygon
        p._annotation.text = "+ "..p.name.."" --プレイヤーの位置が分かりやすくなるよう、
        p._annotation.x = p.x --「+」記号とプレイヤー名を
        p._annotation.y = p.y --プレイヤーの座標に表示する。
    end
-- to show whereabouts,  annitation become "+" and "each player's name" and
--coodinate(x, y)  moves.
--example in game, "+ lilax"


end
対戦時にランク、得点差などを表示するスクリプトコードです。
要するにかたさんとDJさんのパクリです。


---------- listing up by rank internally. thx Kata, here based on your script.
function RANK()
    for P in Players() do
        P._rank = 1
        for i = 0, #Players - 1 do
            if Game.type ~= "tag" then
                if Players[i].points > P.points then
                    P._rank = P._rank + 1
                end
            else
                if Players[i].points < P.points then
                    P._rank = P._rank + 1
                end
            end
        end
    end
end
------------------------------------------------


-------- Showing texts Rank, Score, etc,. -------------
function HUDS()

    for P in Players() do
        if (P._rank == 1) then -- TOPSCORE
            TOPSCORE = P.points
            P.overlays[0].color = 3 --DEEP GREEN
        elseif (P._rank == #Players) then -- worst rank
            P.overlays[0].color = 2 --RED
            SPREAD = P.points - TOPSCORE
        elseif (P._rank == #Players - 1) then
            P.overlays[0].color = 5 --YELLOW
        else
            P.overlays[0].color = 1
        end
        -------- Caliculate time(minuites, seconds, ticks) remaining. -------------
        -------- 残り時間から、分、秒、カンマ以下を計算します

        local min, sec, tik, mzro, szro, tzro = 0, 0, 0, "", "", ""
        min = math.floor(Game.time_remaining / 1800)
        sec = math.floor(Game.time_remaining / 30) - min * 60
        tik = math.floor(((Game.time_remaining - sec * 30 - min * 1800) / 30) * 99)

        -------- keeping figures of min, sec, tik to 2. look better!
        -------- それぞれ分、秒、カンマ以下の単位の桁数を揃えています。見た目重視!↓
        if min < 10 then mzro = "0" else mzro = "" end--keep figure numbers of min
        if sec < 10 then szro = "0" else szro = "" end--sec
        if tik < 10 then tzro = "0" else tzro = "" end--tik

        -------- Showing caliculated time like "Remaining Time: 00min:00sec:00".
        -------- 以上の計算結果を、"Remaining Time: 00min:00sec:00"といった具合に表示します。
        P.overlays[2].text = "       Remaining Time: "..(mzro)..min..":"..(szro)..sec..":"..(tzro)..tik, 0

        -------- Showing each player's rank, points, and spread. -------------
        -------- スコアはP.pointsをそのまま表示、得点差はこの場で計算しています↓
P.overlays[1].text = "Score: "..P.points.."  Spread: "..math.floor(P.points - TOPSCORE)..""
        P.overlays[1].color = 4 -- Light Blue
        P.overlays[0].text = "Rank: "..P._rank.."\/"..#Players..""

        -------- wanna show messages for each players and different one to specified player? -------------
        -------- then seen right under here. --------
        if P == SAINT then
            P.overlays[4].text = "                    You're SAINT! Punish Resistance!"
            P.overlays[4].color = math.floor(Game.global_random(8))

        else
            P.overlays[4].text = "                    You're Resistance. Kill the SAINT!"
            P.overlays[4].color = 0
        end
    end

end

This source is for "function Triggers.idle()".
"function Triggers.idle()"向けです。

Example, see right under here.
例えば、
function Triggers.idle()
   SENSOR() --SENSOR()を呼び出す
   -- call SENSOR()
end
などと記述して活用して下さい。

by combining this script, Sensors can indicate direction to the specified item, polygon, enemy.
なお、これを応用すれば特定のアイテム、特定のポリゴン、特定の敵キャラに対して反応させることも可能です。

----------------------------------
function SENSOR()

    for P in Players() do  ---各々のプレイヤーに対して
        P.compass.lua = true --LUAによるコンパス(動体センサー)操作ON
        P.compass.beacon = true
        -- every players' Sensor turned on by LUA.
       
        -- The specified player's every directions in the sensor turned on.(ne,nw,se,sw)
        if P == SAINT then -- "特定のプレイヤー"のセンサーは
            P.compass:all_on() --北東、北西、南東、南西を全てON

        -- Every players except thespecified player, the sensors indicate directions to the player.
        else --"特定のプレイヤー"以外のセンサーは
            P.compass.x, P.compass.y = SAINT.x, SAINT.y --特定のプレイヤーの位置を反映・反応させる

        end
    end

end


セイントのプログラムからぱくったものです。
透明が切れる数秒前は可視・不可視間をループします。この時、一定の数式に該当するときだけ、透明状態に
移行しているようです。
つまり、例えばプレイヤーの「invisibility_duration」の数字が固定されていると、透明のままか不透明のままであるということです。
従って、以下のような文を書くと、点滅状態に移行することが出来ます。


なお、これは
function idle()
    for P in Players() do
        if P == SAINT then ---ここで特定のプレイヤーであるかどうかを判定しています。
            if P.invisibility_duration < 10 then
                P.invisibility_duration = 30
            end
        elseif P ~= SAINT then
            P.invisibility_duration = 0
        end
    end
end
ライブラリと言うよりもメモに近い記事です。
it is more likely memos than library.

[[
for P in Players() do
  P.overlays[0].color = 0
  P.overlays[1].color = 1
  P.overlays[2].color = 2
  P.overlays[3].color = 3
  P.overlays[4].color = 4
  P.overlays[5].color = 5
  P.overlays[0].text = "0"
  P.overlays[1].text = " 1"
  P.overlays[2].text = "  2"
  P.overlays[3].text = "   3"
  P.overlays[4].text = "    4"
  P.overlays[5].text = "     5"
end
]]

Scripting like above, the font colors are same to terminal message's.
wanna see the color? then refer the pic under here.
(picture from Miha)
などと書く場合、実はターミナルの文字色と一致しています。
以下は偉大なるMiha師のサイトから拝借。
http://homepage2.nifty.com/mihashimoto/Mapmakin/mapmake.html



But unfortunately, we cant use decorated charactors like bold.
ただ、俺が弄った限りでは太字などの修飾文字は使えないようです。

Written by Lilax
Luaに関係するサイトを張っておきます.参考にしてください.


どんどん更新されるAlephOneのLuaリファレンスです.
コードの中にはまだリリースされてないAlephOne用のものあるので,注意しましょう.
http://marathon.svn.sourceforge.net/viewvc/marathon/trunk/docs/Lua.html

WindowsならAlephOneと同じ階層にあるdocsフォルダに
Lua.html というリファレンスが同梱されていますので,それを参考にすると良いでしょう.

他のOSでは,,,知らない! ←ご存じの方,書き換えといてください.




Lua関係のソースファイルはこちら. 開発には直接関係ないけど,ちょっとたのしい.
http://marathon.svn.sourceforge.net/viewvc/marathon/trunk/Source_Files/Lua/



Lua 5.1のリファレンスマニュアル日本語版
http://sugarpot.sakura.ne.jp/yuno/html/lua51_manual_ja.html



他には
http://www.antun.net/tips/script/lua.html

など,ぐぐると少ないですが出てきます.
Kata

カレンダー

03 2024/04 05
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

 

最新コメント

[01/17 名無権兵衛]
[01/17 名無権兵衛]
[01/17 名無権兵衛]
[10/04 kata]
[10/04 RO-]

 

検索