SphereCommunity
Ingame Script Issue (Event) - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Ingame Script Issue (Event) (/Thread-Ingame-Script-Issue-Event)



Ingame Script Issue (Event) - dagger4k - 10-08-2012 06:36 PM

Hey, I'll get straight to the issue. For some reason during the event the capture stone "red or blue team stone" becomes unreachable to some players. one or two of the players can use the stone and it gives them the flag. Can someone help me find a fix? thanks Smile

This is the script --
Code:
VAR.PAINTBALLSTONECONTROL=040065cfb
VAR.PAINTBALLSTONERED=040069512
VAR.PAINTBALLSTONEBLUE=040074bb0


[itemdef i_paintball_stone]
    id=i_grave_stone
    name=Paintball!
    type=t_normal

on=@create
    color=0
    more1=0
    more2=0
    tag.last=0
    timer=-1

on=@click
    message @88 <name>
    return 1

on=@dclick
if (<src.account.plevel> > 3)
    src.dialog d_paintball_stone_control
    return 1
endif

if (<src.flags>&statf_dead)
    src.message You can't use this while dead!
    return 1
endif

if  (<distance> > 4)
    src.message Move closer!
    return 1
endif

IF (<SRC.FINDLAYER(25)>)
    src.message Dismount first!
    return 1
ENDIF


if (<src.account.plevel> < 4) && (<src.tag.tourney> == 01) && (<more1> == 1)
    src.dialog d_paintball_stone_join
    return 1
endif

on=@timer
    region.allclients stone 0
    timer=15
//////

[dialog d_paintball_stone_control]
250,200
src.dialogclose d_paintball_stone_control
VAR.PAINTBALLSTONECONTROL=040065cfb
page 0
resizepic 0 0 5054 200 170
resizepic 5 5 3000 190 30
resizepic 5 60 3000 190 105

htmlgump 10 10 100 20 0 0 0
htmlgump 30 65 100 20 1 0 0
htmlgump 30 90 100 20 2 0 0
htmlgump 30 115 100 20 3 0 0
htmlgump 30 140 100 20 4 0 0
    
button 10 66 5601 5605 1 0 1
button 10 91 5601 5605 1 0 2
button 10 116 5601 5605 1 0 3
button 10 141 5601 5605 1 0 4

[dialog d_paintball_stone_control text]
Paintball Control
Activate Stone
Deactivate Stone
Start Paintball
Finish Paintball

[dialog d_paintball_stone_control button]
onbutton = 1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.say Stone activated!
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.more1=1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.color=07fc

onbutton = 2
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.say Stone deactivated!
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.more1=0
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.color=0
    
onbutton = 3
    serv.b The paintball tournament has begun!
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.more2=1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.timer=15
    region.allclients stone 0

onbutton = 4
    serv.b The paintball tournament has ended!
    VAR.PAINTBALLSTONERED=040069512
    VAR.PAINTBALLSTONEBLUE=040074bb0
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.timer=-1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONECONTROL>.MORE2=0
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONERED>.more1 = 1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONERED>.TAG.redpoints = 0
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONEBLUE>.more1 = 1
    TRYSRC <UID> UID.<VAR.PAINTBALLSTONEBLUE>.TAG.bluepoints = 0
    forchars 400
        if (<isevent.e_paintball_blue>)
            f_paintball_end_blue
        endif
        if (<isevent.e_paintball_red>)
            f_paintball_end_red
        endif
    endfor

    FORITEMS 500
        IF (<BASEID>==i_paintball_ammo_red)
            REMOVE
        ELSEIF (<BASEID>==i_paintball_ammo_blue)
            REMOVE
        ENDIF
    ENDFOR

[function f_paintball_end_blue]
    if (<ISEVENT.e_paintball_blue>)
        findid.i_paintball_gun_blue.remove
        findid.i_paintball_robe_blue.remove
        findid.i_paintball_ammo_blue.remove
        findid.i_paintball_flag_red.remove
        findid.i_paintball_ammo_blue.remove
        findid.i_paintball_grenade_red.remove
        findid.i_paintball_grenade_blue.remove
        //FINDLAYER(21).REMOVE
        //TRYSRC <UID> UID.<TAG.BACKPACKUID>.CONT = <UID>
        //FINDLAYER(21).DCLICK
        //TRYSRC <UID> UID.<TAG.MBBAGUID>.CONT = <FINDLAYER(21).UID>
        //FINDID.i_bag_monsterbash.REMOVE
        //TAG.MBBAGUID =
        //TAG.BACKPACKUID =
        events -e_paintball_red
        events -e_paintball_blue
        newitem i_tourny_ticket
        act.cont = <findlayer(29).uid>
        findid.i_paintball_memory_blue.remove
        stone 1
        goname blue team spawn 987654321
        return 1
    else
        return 1
    endif

[function f_paintball_end_red]
    if (<ISEVENT.e_paintball_red>)
        findid.i_paintball_ammo_red.remove
        findid.i_paintball_gun_red.remove
        findid.i_paintball_robe_red.remove
        findid.i_paintball_ammo_blue.remove
        findid.i_paintball_flag_blue.remove
        //FINDLAYER(21).REMOVE
        //TRYSRC <UID> UID.<TAG.BACKPACKUID>.CONT = <UID>
        //FINDLAYER(21).DCLICK
        //TRYSRC <UID> UID.<TAG.MBBAGUID>.CONT = <FINDLAYER(21).UID>
        //FINDID.i_bag_monsterbash.REMOVE
        //TAG.MBBAGUID =
        //TAG.BACKPACKUID =
        events -e_paintball_red
        events -e_paintball_blue
        newitem i_tourny_ticket
        act.cont = <findlayer(29).uid>
        findid.i_paintball_memory_red.remove
        stone 1
        goname red team spawn 123456789
        return 1
    else
        return 1
    endif


////////

[dialog d_paintball_stone_join]
250,200
src.dialogclose d_paintball_stone_join
page 0
resizepic 0 0 5054 200 170
resizepic 5 5 3000 190 30
resizepic 5 60 3000 190 105
    
dtext 10 10 0 Coldfire Paintball/CTF
dtext 10 65 0 Click OK to join,
dtext 10 85 0 all your items will be
dtext 10 105 0 automatically banked.

button 10 140 247 248 1 0 1
button 125 140 241 242 1 0 0


[dialog d_paintball_stone_join button]
onbutton = 1
    if (<src.findlayer(31)>)
        src.say I'm trying to cheat and have <src.findlayer(31).amount> <src.findlayer(31).name> on my cursor!
        return 1
    endif

    if (<src.findlayer(25)>)
        src.message Unmount your ride first!
        return 1
    endif

    //LOCAL.BACKPACKUid=<SRC.FINDLAYER(21).UID>
    //SRC.TAG.BACKPACKUid=<LOCAL.BACKPACKUID>
    //SRC.f_monsterbash_unequip
    //SRC.NEWITEM i_bag_monsterbash
    //SRC.TAG.MBBAGUid=<SRC.ACT.UID>
    //SRC.ACT.NAME = <SRC.NAME>'s Items
    //SRC.ACT.CONT = 040054636
    //SRC.FINDLAYER(21).CONT = <SRC.ACT.UID>
    //SERV.LOG MB: Backpack UID for <SRC.NAME> (<SRC.ACCOUNT>) is <LOCAL.BACKPACKUID>
    //SRC.NEWITEM i_backpack
    //SRC.ACT.EQUIP


    src.pad_undress
    src.newitem i_bag
       src.act.cont = <src.findlayer(29).uid>
    src.act.color = 020
    src.bank_all <src.act.uid>
    src.findlayer(21).updatex

    //src.newitem i_bag
       //src.act.cont = <src.findlayer(29).uid>
    //src.act.color = 020
    //src.bank_all_newbbag <src.act.uid>
    //src.findlayer(15).updatex


    src.dispel_all
    src.hits = <src.str>
    src.sysmessage Any items you had are now in your bank!
    src.stone

    src.dispel_all
    src.hits = <src.str>

    if (<src.food> < 20)
        src.food = 20
    endif

    OBJ = 040065cfb
//(<UID> UID.<VAR.PAINTBALLSTONECONTROL>)
    IF (<OBJ.TAG.last> == 1)
             obj.tag.last=0
             src.sysmessage You are on the team red team!
             src.events -e_paintball_blue
             src.events +e_paintball_red
             src.goname red team spawn 123456789
        src.newitem i_paintball_gun_red
        src.act.equip
        src.act.attr 08010
        src.act.tag.tourney=1
        src.newitem i_paintball_ammo_red
        src.act.amount 1000
        src.act.bounce
        src.act.attr 08010
        src.act.tag.tourney=1
        src.newitem i_paintball_robe_red
        src.act.equip
        src.act.attr 08010
        src.newitem i_paintball_memory_red
        src.act.equip
        //src.newitem i_paintball_grenade_red
        //src.act.amount 5
        //src.act.tag.tourney=1
        //src.act.bounce
        src.stone 1
        return 1
    elseif (<OBJ.TAG.last> == 0)
              obj.tag.last=1
             src.sysmessage You are on the blue team!
             src.events -e_paintball_red
             src.events +e_paintball_blue
             src.goname blue team spawn 987654321
        src.newitem i_paintball_gun_blue
        src.act.equip
        src.act.attr 08010
        src.act.tag.tourney=1
        src.newitem i_paintball_ammo_blue
        src.act.amount 1000
        src.act.bounce
        src.act.attr 08010
        src.act.tag.tourney=1
        src.newitem i_paintball_robe_blue
        src.act.equip
        src.act.attr 08010
        src.newitem i_paintball_memory_blue
        src.act.equip
        //src.newitem i_paintball_grenade_blue
        //src.act.amount 5
        //src.act.tag.tourney=1
        //src.act.bounce
        src.stone 1
        return 1
    endif

//////////////////////red team event

[events e_paintball_red]
on=@click
    message @033 (Red Team)

on=@hit
    OBJ=040069512
    if (<SRC.ISEVENT.e_paintball_blue>)
        if (<src.findid.i_paintball_flag_red>)
            src.findid.i_paintball_flag_red.remove
            src.goname blue team spawn 987654321
            src.message You have been hit, wait to respawn in the next wave.
            src.stone 1
            sayu +5
            OBJ.TAG.redpoints = (<OBJ.TAG.redpoints> + 5 )
            obj.more1=1
            REGION.ALLCLIENTS SYSMESSAGE @33 <src.name> lost the flag to <name>, it has been returned to red base.
            return 1
        else
            src.message You have been hit, wait to respawn in the next wave.
            src.stone 1
            src.goname blue team spawn 987654321
            sayu +1
            OBJ.TAG.redpoints = (<OBJ.TAG.redpoints> + 1 )
            return 1
        endif
    endif

on=@hittry
    if (<SRC.ISEVENT.e_paintball_red>)
        sysmessage You cannot shoot a teammate!
        action = -1
        flags = <flags> & ~statf_war
        return 1
    else
        return 0
    endif

on=@gethit
    src.newitem i_paintball_paint_blue
    src.act.p = <src.p>
    src.act.update

on=@itemdclick
    IF (<ACT.BASEID> == i_runebook)
        SYSMESSAGE @35 You cannot use that!
        RETURN 1
    ENDIF
    IF (<ACT.CONT> == <FINDLAYER(15).UID>) && (<ACT.BASEID> != i_spellbook)
        SYSMESSAGE You cannot reach that.
        RETURN 1
    ENDIF
    IF (<ACT.BASEID> == i_et_eh) || (<ACT.BASEID> == i_et_el) || (<ACT.BASEID> == i_et_eo)  && (0<OBJ.TAG.ALLOWMOUNTS> == 0)
        SYSMESSAGE @35 You cannot use that!
        RETURN 1
    ENDIF
    
ON=@ItemPickup_Pack
    IF (<ACT.CONT> == <FINDLAYER(15).UID>)
        SYSMESSAGE You cannot reach that.
        RETURN 1
    ENDIF

ON=@SpellCast
    message You can't cast in paintball!
    ACTION = -1
    return 1
//////////////////////blue team event

[events e_paintball_blue]

on=@click
    message @03 (Blue Team)

on=@hit
    OBJ=040074bb0
    if (<SRC.ISEVENT.e_paintball_red>)
        if (<src.findid.i_paintball_flag_blue>)
            src.findid.i_paintball_flag_blue.remove
            src.goname red team spawn 123456789
            src.message You have been hit, wait to respawn in the next wave.
            src.stone 1
            sayu +5
            OBJ.TAG.bluepoints = (<OBJ.TAG.bluepoints> + 5 )
            obj.more1=1
            REGION.ALLCLIENTS SYSMESSAGE @03 <src.name> lost the flag to <name>, it has been returned to blue base.
            return 1
        else
            src.goname red team spawn 123456789
            src.message You have been hit, wait to respawn in the next wave.
            src.stone 1
            sayu +1
            OBJ.TAG.bluepoints = (<OBJ.TAG.bluepoints> + 1 )
            return 1
        endif
    endif


on=@hittry
    if (<SRC.ISEVENT.e_paintball_blue>)
        sysmessage You cannot shoot a teammate!
        action = -1
        flags = <flags> & ~statf_war
        return 1
    else
        return 0
    endif

on=@gethit
    src.newitem i_paintball_paint_red
    src.act.p = <src.p>
    src.act.update

on=@itemdclick
    IF (<ACT.BASEID> == i_runebook)
        SYSMESSAGE @35 You cannot use that!
        RETURN 1
    ENDIF
    IF (<ACT.CONT> == <FINDLAYER(15).UID>) && (<ACT.BASEID> != i_spellbook)
        SYSMESSAGE You cannot reach that.
        RETURN 1
    ENDIF
    IF (<ACT.BASEID> == i_et_eh) || (<ACT.BASEID> == i_et_el) || (<ACT.BASEID> == i_et_eo)  && (0<OBJ.TAG.ALLOWMOUNTS> == 0)
        SYSMESSAGE @35 You cannot use that!
        RETURN 1
    ENDIF
    
ON=@ItemPickup_Pack
    IF (<ACT.CONT> == <FINDLAYER(15).UID>)
        SYSMESSAGE You cannot reach that.
        RETURN 1
    ENDIF

ON=@SpellCast
    message You can't cast in paintball!
    ACTION = -1
    return 1

//////////////////////red team stone/flag

[itemdef i_paintball_stone_red]
    id=i_grave_stone
    name=Red Team Stone
    type=t_normal

on=@create
    color=020
    more1=1
    more2=1
    tag.redpoints=0

on=@click
    message [<eval <tag.redpoints>> points]
    message @033 <name>
    return 1

on=@dclick
    OBJ = 040069512
    if (<SRC.ISEVENT.e_paintball_blue>)
        if (<more1>==1)
            src.newitem i_paintball_flag_red
            src.act.equip
            src.act.attr 08010    
            more1=0    
            src.message You have their flag! Take it to your team stone!
            REGION.ALLCLIENTS SYSMESSAGE @33 <src.name> has taken the red team's flag!
            return 1
        else
            src.message Someone already has the flag!
            return 1
        endif
    elseif (<SRC.ISEVENT.e_paintball_red>) && (<src.findid.i_paintball_flag_blue>)
        if (<more1>==1)
            say Flag captured!
            src.sayu +50 points!
            src.findid.i_paintball_flag_blue.remove
            tag.redpoints = <EVAL <TAG.redpoints> + 50>
            TRYSRC <UID> UID.<OBJ>.more1=1
            REGION.ALLCLIENTS SYSMESSAGE @33 <src.name> has captured the blue team's flag!
            return 1
        elseif (<more1> == 0)
            say Your team must retrieve your flag first!
            return 1
        endif
    else
        src.message You can't do anything with this!
        return 1
    endif

[itemdef i_paintball_flag_red]
    ID=03564
    name=Red Flag
    TYPE=t_armor
    LAYER=3

on=@create
    color=020

on=@click
    message @033 <name>
    return 1

//////////////////////blue team stone

[itemdef i_paintball_stone_blue]
    id=i_grave_stone
    name=Blue Team Stone
    type=t_normal

on=@create
    color=03
    more1=1
    more2=1
    tag.bluepoints=0

on=@click
    message [<eval <tag.bluepoints>> points]
    message @03 <name>
    return 1

on=@dclick
    OBJ = 040074bb0
    if (<SRC.ISEVENT.e_paintball_red>)
        if (<more1>==1)
            src.newitem i_paintball_flag_blue
            src.act.equip
            src.act.attr 08010    
            more1=0        
            src.message You have their flag! Take it to your team stone!
            REGION.ALLCLIENTS SYSMESSAGE @03 <src.name> has taken the blue team's flag!
            return 1
        else
            src.message Someone already has the flag!
            return 1
        endif
    elseif (<SRC.ISEVENT.e_paintball_blue>) && (<src.findid.i_paintball_flag_red>)
        if (<more1>==1)
            src.findid.i_paintball_flag_red.remove
            src.say Flag captured!
            src.sayu +50 points!
            tag.bluepoints = <EVAL <TAG.bluepoints> + 50>
            TRYSRC <UID> UID.<OBJ>.more1=1
            REGION.ALLCLIENTS SYSMESSAGE @03 <src.name> has captured the blue team's flag!
            return 1
        elseif (<more1> == 0)
            src.message Your team must retrieve your flag first!
            return 1
        endif
    else
        src.message You can't do anything with this!
        return 1
    endif

[itemdef i_paintball_flag_blue]
    ID=03564
    name=Blue Flag
    TYPE=t_armor
    LAYER=3

on=@create
    color=03

on=@click
    message @03 <name>
    return 1

/////////////////////////

[itemdef i_paintball_memory_red]
id=i_worldgem_bit
type=t_eq_script
weight=0
layer=layer_special
name=Red Team Paintball Memory

on=@create
    attr=00090
    timer=8000

on=@timer
    remove

[itemdef i_paintball_memory_blue]
id=i_worldgem_bit
type=t_eq_script
weight=0
layer=layer_special
name=Blue Team Paintball Memory

on=@create
    attr=00090
    timer=8000

on=@timer
    remove


[eof]

Thanks.. I removed some unnecessary parts to the script but you should be able to get an idea from what i've left.


RE: Ingame Script Issue (Event) - Barnabus - 10-12-2012 02:08 AM

If unreachable means invisible, maybe an UPDATE or an UPDATEX on the stone after each use might help?
If unreachable means literally out of reach. Im thinking what size are the players ?

Some Ideas ....
Is the stone flipping?
Does it need updating after use?
Is the stone moving?
Are the players moving while clicking the stone?
Have the character sizes been reduced?
The attributes all set by value make them hard to read and there is none set on i_paintball_stone stone so how about adding ATTR_NEWBIE|ATTR_MOVE_NEVER on its create trigger and seeing what happens ?


RE: Ingame Script Issue (Event) - Skul - 10-12-2012 05:16 PM

Player's can not use anything except t_sign_gump if they're dead, maybe that's the reason? Set TYPE=t_sign_gump on your stones.