SphereCommunity
Duel Pit - Printable Version

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



Duel Pit - Accept - 11-19-2015 08:44 PM

Hi guys Bye
I wanna make some duel system ... But have some problem, can you help me ... I need update this script with your help Smile
Maybe some change, i need your advice Veryhappy

PHP Code:
//<------------------------------------------------------------------------------------->
//<-------------------------------------- Arena #1 ------------------------------------->
//<------------------------------------------------------------------------------------->
[ITEMDEF i_dueling_arena_1]
DEFNAME=i_dueling_arena_1
NAME
=Arena #1 (Old Style)
ID=0ed4
TYPE
=t_normal

On
=@Create
    COLOR
=0876
    ATTR
=attr_move_never|attr_static|attr_newbie
    
On
=@Click
    MESSAGE 
@38 <NAME>
    RETURN 
1

On
=@DClick
    
IF (<DISTANCE>>3)||(!<CanSeeLos>)
        
SRC.SYSMESSAGE You can't reach that
    ELIF (!<SRC.FINDLAYER.13>)
        SRC.SYSMESSAGE @55 Get your equipment first! 
    ELIF (<SRC.FINDLAYER.25.UID>)
        SRC.SYSMESSAGE @55 You are mounted and may not go to duel!
    ELIF (<TAG0.busy>)
        SRC.SYSMESSAGE @55 Dueling Pit is busy at this moment..
    ELSE
        SERV.NEWITEM=i_duel_memory
        NEW.EQUIP <SRC>
        NEW.TIMER 5
        VAR.arena0=<UID>
    ENDIF
    RETURN 1
    
//<------------------------------------------------------------------------------------->
//<------------------------------------- Winner Pad ------------------------------------>
//<------------------------------------------------------------------------------------->
[ITEMDEF i_go_winner_pad]
DEFNAME=i_go_winner_pad
NAME=For Winner
ID=i_rune_alchem_6

On=@Create 
    COLOR=0423
    
On=@Click
    MESSAGE @0ADE <NAME>
    RETURN 1

On=@Step
    IF !<SRC.IsPlayer>
        RETURN 1
    ENDIF
    TRY UID.<VAR.arena0>.TAG.busy  
    TRY UID.<VAR.arena0>.COLOR=0876   
    VAR.first0                   
    VAR.second0                  
    VAR.arena0    
    SRC.GO 3756,1294
    SRC.EVENTS -e_duel_arena_1
    REMOVE


//<------------------------------------------------------------------------------------->
//<--------------------------------------- Events -------------------------------------->
//<------------------------------------------------------------------------------------->
[EVENTS e_duel_arena_1]
On=@Death
    SRC.GO 4471,1165,20
    SRC.SYSMESSAGE You are Looser!
    SRC.ACT.SYSMESSAGE You are Winer!
    SRC.EVENTS -e_duel_arena_1
    SRC.NEWITEM=i_go_winner_pad
    SRC.ACT.P=730,1104,20
    
On=@SpellEffect
    IF ((<ARGN> == 24)||(<ARGN> == 32)||(<ARGN> == 45)||(<ARGN> == 52))
        SRC.SYSMESSAGE @55 This spell is forbidden here!
        RETURN 1
    ENDIF

On=@LogOut
    SERV.NEWITEM=i_duel_leaving
    NEW.EQUIP <SRC>

On=@Login
    TRY SRC.FINDID.i_duel_leaving.REMOVE

[ITEMDEF i_duel_leaving]
NAME=Duel Leaving
ID=i_memory
TYPE=t_eq_script
    
On=@Equip
    TIMER=15

On=@Timer
    TRY UID.<VAR.second0>.HITS=0
    TRY UID.<VAR.second0>.EVENTS -e_duel_arena_1
    TRY UID.<VAR.first0>.GO 3756,1294
    TRY UID.<VAR.first0>.EVENTS -e_duel_arena_1
    TRY UID.<VAR.arena0>.TAG.busy  
    TRY UID.<VAR.arena0>.COLOR=0876   
    VAR.first0                   
    VAR.second0                  
    VAR.arena0
    REMOVE
    RETURN 1


[DIALOG d_duel_arena_1]
200,200
GUMPPIC 0 0 2500
DTEXT 45 30 55 Do you accept duel
DTEXT 45 50 55 with <SRC.TARG.NAME>?
DTEXT 70 75 55 Yes
DTEXT 150 75 55 No
BUTTON 50 80 2224 2224 1 0 1
BUTTON 130 80 2224 2224 1 0 2

[DIALOG d_duel_arena_1 BUTTON]
On=0
    TRY UID.<VAR.second0>.TAG.duel_wait
    TRY UID.<VAR.first0>.SYSMESSAGE <SRC.NAME> didn'
t respond to challenge.
    TRY 
UID.<VAR.arena0>.TAG.busy
    
TRY UID.<VAR.arena0>.COLOR=0876
    
TRY UID.<VAR.second0>.FINDID.i_duel_welcome.REMOVE
    
TRY UID.<VAR.first0>.FINDID.i_duel_welcome.REMOVE
    
VAR.first0
    
VAR.second0
    
VAR.arena0

On
=1
    
TRY UID.<VAR.arena0>.COLOR=0486
    
TRY UID.<VAR.first0>.EVENTS +e_duel_arena_1
    
TRY UID.<VAR.first0>.GO 734,1106,20
    
TRY UID.<VAR.first0>.TAG.duel_wait
    
TRY UID.<VAR.first0>.FINDLAYER.25.REMOVE
    
TRY UID.<VAR.second0>.FINDLAYER.25.REMOVE
    
TRY UID.<VAR.second0>.GO 730,1106,20
    
TRY UID.<VAR.second0>.TAG.duel_wait
    
TRY UID.<VAR.second0>.EVENTS +e_duel_arena_1
    
TRY UID.<VAR.second0>.FINDID.i_duel_welcome.REMOVE
    
TRY UID.<VAR.first0>.FINDID.i_duel_welcome.REMOVE

On
=2
    
TRY UID.<var.second0>.TAG.duel_wait
    
TRY UID.<var.first0>.SYSMESSAGE <SRC.NAMEhas declined the challenge
    
TRY UID.<var.arena0>.TAG.busy
    
TRY UID.<var.arena0>.COLOR=0876
    
TRY UID.<var.second0>.FINDID.i_duel_welcome.REMOVE
    
TRY UID.<var.first0>.FINDID.i_duel_welcome.REMOVE
    
VAR.FIRST0
    
VAR.SECOND0
    
VAR.ARENA0

[ITEMDEF i_duel_welcome]
NAME=Duel Memory Welcome
ID
=i_memory
TYPE
=t_eq_script

On
=@Create 
    ATTR
=attr_newbie|attr_decay
    
On
=@Equip
    SDIALOG d_duel_arena_1
    
RETURN 1

On
=@Timer
    CONT
.SYSMESSAGE Your enemy is not accepted the duel
    
TRY UID.<VAR.second0>.TAG.duel_wait
    
TRY UID.<VAR.arena0>.TAG.busy
    
TRY UID.<VAR.arena0>.COLOR=0876
    REMOVE
    
RETURN 1

[ITEMDEF i_duel_memory]
NAME=Duel Memory
ID
=i_memory
TYPE
=t_eq_script

On
=@Equip
    TARGET
    SRC
.SYSMESSAGE @38 Choose your opponent!
    RETURN 
1

On
=@TargOn_Char
    
IF (<ARGO.DISTANCE> > 3)
        
SRC.SYSMESSAGE You can't reach that
    ELIF (<ARGO.TAG0.duel_wait>==1)
        SRC.SYSMESSAGE Please wait...
    ELIF (<ARGO.UID>==<SRC.UID>)
        SRC.SYSMESSAGE @55 You can choose yourself!
    ELIF (<ARGO.FLAGS> & statf_dead)
        SRC.SYSMESSAGE You can'
t reach that
    
ELSE
        VAR.
first0=<SRC.UID>
        
ARGO.TAG.duel_wait=1
        SRC
.NEWITEM=i_duel_welcome
        
NEW.EQUIP <SRC.ACT.UID>
        NEW.
TIMER 15
        
VAR.second0=<SRC.TARG.UID>
        TRY 
UID.<VAR.arena0>.TAG.busy=1
        
TRY UID.<VAR.arena0>.COLOR=0A39
        REMOVE
    
ENDIF
    RETURN 
1
    
On
=@TargOn_Ground
    SRC
.SYSMESSAGE You can't reach that
    RETURN 1

On=@TargOn_Item
    SRC.SYSMESSAGE You can'
t reach that
    
RETURN 1
    
On
=@Timer
    REMOVE
    
RETURN 



RE: Duel Pit - azmanomer - 11-19-2015 09:05 PM

what kind of updates? Do you get any errors? At least say your wishes Smile


RE: Duel Pit - an0n!m0use - 11-20-2015 02:21 AM

(11-19-2015 09:05 PM)azmanomer Wrote:  Do you get any errors?
This script very interesly working ... Dont ask enemy about accept the duel ...)
When you choose the enemy this script ask you fight or not Big Grin
About update: Meybe change VAR.first0 & VAR.second0 to REF1 and REF2 ?


RE: Duel Pit - azmanomer - 11-20-2015 04:23 AM

SRC.NEWITEM=i_duel_welcome
NEW.EQUIP <SRC.ACT.UID> ----> change this one to NEW.EQUIP <argo>

then it will ask to your target there are lots of nonsense things but i think you can figure them out Smile check this page it will help you a lot http://wiki.sphere.torfo.org/index.php/Category:Triggers


RE: Duel Pit - Accept - 11-24-2015 05:23 PM

(11-20-2015 04:23 AM)azmanomer Wrote:  SRC.NEWITEM=i_duel_welcome
NEW.EQUIP <SRC.ACT.UID> ----> change this one to NEW.EQUIP <argo
Thx! Little upgrade i have Big Grin
(11-20-2015 02:21 AM)an0n!m0use Wrote:  Dont ask enemy about accept the duel ...) When you choose the enemy this script ask you fight or not Big Grin
How to fix that ? Confused
Quote:About update: Meybe change VAR.first0 & VAR.second0 to REF1 and REF2 ?
I have tried, did not work Cry


RE: Duel Pit - Accept - 11-26-2015 05:11 PM

Guys ? Cry


RE: Duel Pit - XuN - 11-26-2015 05:48 PM

You should look at your vars, vars are global for the server so if you set var.first0 and then another guy set it too, both will have the same value. Change them to tags so they are stored on that memory, or in the player, or where you might like more.