SphereCommunity
Duel system - Printable Version

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



Duel system - an0n!m0use - 03-21-2016 12:46 AM

Hi guys Bye

I have problem with my duel system ...

1)
PHP Code:
[ITEMDEF i_arena_first]
DEFNAME=i_arena_first
NAME
=Arena 1
ID
=0ed4
TYPE
=t_normal

On
=@Create
    ATTR
=attr_move_never|attr_static|attr_newbie
    
On
=@DClick
    
IF .....
    ELSE
        
SRC.SYSMESSAGE @38 Choose your opponent!
        
SRC.TARGETF f_select_opponent
        SERV
.NEWITEM i_duel_wait
        
NEW.EQUIP <SRC>
        NEW.
TIMER=5
    
ENDIF
    RETURN 
1

[ITEMDEF i_arena_second]
DEFNAME=i_arena_second
NAME
=Arena 1
ID
=0ed4
TYPE
=t_normal

On
=@Create
    ATTR
=attr_move_never|attr_static|attr_newbie
    

On
=@DClick
    
IF ......
    ELSE
        
SRC.SYSMESSAGE @38 Choose your opponent!
        
SRC.TARGETF f_select_opponent
        SERV
.NEWITEM i_duel_wait
        
NEW.EQUIP <SRC>
        NEW.
TIMER=5
    
ENDIF
    RETURN 
1


 
[FUNCTION f_select_opponent]
IF .....
ELSE
    
SERV.NEWITEM i_duel_memory
    
NEW.LINK <UID>
    
ARGO.EQUIP <NEW.UID// 15:47:ERROR: Undefined keyword 'ARGO.EQUIP'
    
NEW.TIMER=15
    SYSMESSAGE 
@55 You have choose <ARGO.NAMEto duel
ENDIF
RETURN 


ERROR:Its working, but sphere dont like that Rolleyes

2) About SERV.NEWITEM i_duel_memory
I have 5 stones and 5 different coordinates ... and i wonna make 1 func for all them
PHP Code:
[ITEMDEF i_duel_memory]
NAME=Duel Memory
ID
=i_memory
TYPE
=t_eq_script

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

On
=@Timer
    REMOVE
    
RETURN 1

[DIALOG d_duel_arena_challenge]
DTEXT BLA BLA 
BUTTON 210 210 1153 1154 1 0 2
BUTTON 250 210 1150 1151 1 0 1

[DIALOG d_duel_arena_challengee BUTTON]
On=0 1
 
.....
    
On=2
    SRC
.GO <DEF0.ARENA_1_1// 1st player
    
LINK.GO <DEF0.ARENA_1_2// 2nd player

[DEFNAME DEF_DUEL_CONFIG]
ARENA_1_1        1234,1234 // its coordinates for i_arena_first
ARENA_1_2     4321,4321

ARENA_2_1        5678
,5678 // its for i_arena_second
ARENA_2_2     8765,8765 



RE: Duel system - rastrero - 03-21-2016 03:34 AM

not enought info for helping you.

anyway.


ARGO.EQUIP <NEW> // 15:47:ERROR: Undefined keyword 'ARGO.EQUIP'
This error prob happens cos a invaed target. just an npc or an item.
U dont need to put <new.uid>, <new> is enought


RE: Duel system - an0n!m0use - 03-21-2016 05:36 AM

(03-21-2016 03:34 AM)rastrero Wrote:  not enought info for helping you.
Example: You have 2 stones - i_arena_first and i_arena_second
and one function for two stones: [FUNCTION f_select_opponent] and one [ITEMDEF i_duel_memory]
If [ITEMDEF i_arena_first] - first stone, first player go to ARENA_1_1 coordinates, and second to other ARENA_1_2 coordinates ...

If this [ITEMDEF i_arena_second] frst player go to ARENA_2_1 and second player go to ARENA_2_2

PHP Code:
[DEFNAME DEF_DUEL_CONFIG]
ARENA_1_1       1234,1234 // its coordinates for i_arena_first
ARENA_1_2         4321,4321

ARENA_2_1       5678
,5678 // its for i_arena_second
ARENA_2_2        8765,8765 


I wanna know, it's real using one function for a lot of duel stones ... or i need write for every stone individual function ....

Quote:ARGO.EQUIP <NEW> // 15:47:ERROR: Undefined keyword 'ARGO.EQUIP'
Thx, but problem not solved Sad


RE: Duel system - rastrero - 03-23-2016 09:45 PM

(03-21-2016 03:34 AM)rastrero Wrote:  ARGO.EQUIP <NEW> // 15:47:ERROR: Undefined keyword 'ARGO.EQUIP'
This error prob happens cos a invaed target. just an npc or an item.
U dont need to put <new.uid>, <new> is enought
This wasnt a fix. Just a note, dont put uid if it is not neccesary.

about your problem... Try to change to this

TRYSRC <argo> NEW.equip


About the other thing... hmm

You can make a for though all DUELSTONES using this.
"FORINSTANCES"
U need to check which stone is not in use. When find one, u got to use that stone for the duel and stop the loop.


RE: Duel system - an0n!m0use - 03-24-2016 08:11 AM

(03-23-2016 09:45 PM)rastrero Wrote:  TRYSRC <argo> NEW.equip
Perfect ! Thx !

Quote:You can make a for though all DUELSTONES using this.
"FORINSTANCES"
U need to check which stone is not in use. When find one, u got to use that stone for the duel and stop the loop.
I can not understand how it works Sad
Maybe some example or hint ? Rolleyes


RE: Duel system - rastrero - 03-24-2016 12:44 PM

This is the example you are looking for.

Code:
[FUNCTION f_myfunction]
ref14=<seconduelist.uid>  //put here the uid pathof the second player,
FORINSTANCES i_duelstone
    if !<tag0.inuse>
       tag.inuse 1
       src.go <p>
       src.move 0 5
       ref14.go <p>
       ref14.move 0 -5
       return 1
    else
       local.stones +=1
       serv.log <uid> this stone is in use. <SRC.UID> player looking for a duelpit.
    endif
ENDFOR
src.sysmessage All rooms are in use.
serv.log  <SRC.UID> search done allduelpits in use TOTALSTONESsearched:<eval <local.stones>>