SphereCommunity
calling typedef problem - Printable Version

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



calling typedef problem - ograso - 06-13-2014 07:25 AM

Hey all,

I am trying to use chest system but I have a problem on chest spawn. Basicly I am using a pickaxe item for digging and I give a message "gratz. You pullout". Working perfectly till this line. after that script must be call this trigger "NEW.TYPE=T_L1MAP_CHEST" but nothing happened.

I dont understand Where is the problem

Code:
[ITEMDEF 0e85]
DEFNAME=i_pickaxe
TYPE=t_weapon_mace_pick
ReqStr=50
TEVENTS=t_equipitem
DUPELIST=0e86
ON=@Create
   HITPOINTS={36 48}

ON=@Targon_item
if ((<src.targ.baseid>==i_plant_rushes) || (<src.targ.baseid> == i_plant_fern) || (<src.targ.baseid> == i_plant_fern_5))
    src.anim 12
    src.sound 0126    
    VAR.PERCENT=<EVAL RAND(100)>
    if (<EVAL <VAR.PERCENT>>>80)
        src.sysmessage @60 gratz. You pullout
        NEW.TYPE=T_L1MAP_CHEST
        elseif (<EVAL <VAR.PERCENT>><20)
            src.sysmessage @38 bla bla bla
        endif
endif    
Return 1

ON=@Targon_ground



[ITEMDEF i_ttm_l1]
ID=i_map
NAME=Define haritasi [Level-1]
CATEGORY=Maps - Treasure
SUBSECTION=Level 1
DESCRIPTION=Map

ON=@Create
    color=1153
    TYPE=T_L1MAP
    DORAND 2
        MOREP=2354,3447,0
        MOREP=1133,3403,0
    ENDDO

[TYPEDEF T_L1MAP]
//LEVEL1MAP Deciphering
ON=@DCLICK
    IF (!<SRC.RESTEST 1 i_pickaxe>)
        SRC.MESSAGE <def.msg_no_pickaxe>
        RETURN 1
    endif
    IF (<SRC.CARTOGRAPHY><50.0)
        SRC.MESSAGE <def.msg_no_cartography>
        RETURN 1
    endif
    IF (<MORE><0FFFF)
        NAME=Acilmis Harita
        TYPE=T_MAP
        MORE1=((<MOREX> -180)*010000)+(<MOREY> -180)
        MORE2=((<MOREX> +180)*010000)+(<MOREY> +180)
        PIN=105,105   // dead center.
        NEWITEM <DEF.TMTILES> //Place trigger random tile
        NEW.TYPE=T_L1MAP_CHEST
        NEW.TIMER=-1
        NEW.ATTR=attr_static|attr_move_never
        NEW.LINK=<UID>
        NEW.P=<MOREP>
        RETURN 0
    ENDIF

[TYPEDEF T_L1MAP_CHEST]
//LEVEL1MAP Treasure map Chest Spawn
ON=@DCLICK
    IF (<DISTANCE>>3)
        src.MESSAGE="sdfdflkjkl"
        RETURN 1
    endif
    IF (<LINK.TOPOBJ.UID> != <SRC.UID>)
        RETURN 1
    endif
    IF ((<SRC.FINDLAYER(layer_hand1).BASEID>==i_PICKAXE) && (<SRC.MINING>>50.0))
        SRC.ANIM 0B
        SOUND 0126
        NEWITEM TM_LOOT_1 // poor loot
        NEW.P=<P>
        SRC.MESSAGE=<def.msg_dig_treasure>
        LINK.REMOVE         //remove linked deciphered map
        NEWITEM=i_Treas_Spawn_VEasy
        NEW.P=<P>
        REMOVE            //remove trigger plant
        RETURN 1
    endif
    RETURN 1

[TEMPLATE TM_LOOT_1]
CONTAINER=i_chest_treasure //Metal Chest
MORE2=1
ITEM=POOR_MAGIC_GOODIE



RE: calling typedef problem - darksun84 - 06-13-2014 09:02 AM

serv.newitem is missing?


RE: calling typedef problem - ograso - 06-13-2014 09:58 AM

(06-13-2014 09:02 AM)darksun84 Wrote:  serv.newitem is missing?

If loop is working When I use the pickaxe and trying to dig on the tile. I can see the "gratz. You pullout" message but should be trig NEW.TYPE=T_L1MAP line but nothing happened. Thats mean, the treasure show up when I dig to tile but nothing happened..

Code:
ON=@Targon_item
if ((<src.targ.baseid>==i_plant_rushes) || (<src.targ.baseid> == i_plant_fern) || (<src.targ.baseid> == i_plant_fern_5))
    src.anim 12
    src.sound 0126    
    VAR.PERCENT=<EVAL RAND(100)>
    if (<EVAL <VAR.PERCENT>>>80)
        src.sysmessage @60 gratz. You pullout
        NEW.TYPE=T_L1MAP
        elseif (<EVAL <VAR.PERCENT>><20)
            src.sysmessage @38 bla bla bla
        endif
endif    
Return 1



RE: calling typedef problem - darksun84 - 06-13-2014 05:31 PM

it does nothing because new is not referencing anything


RE: calling typedef problem - ograso - 06-13-2014 09:09 PM

(06-13-2014 05:31 PM)darksun84 Wrote:  it does nothing because new is not referencing anything

Problem solved by me. You all very helpful