The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ethy's
Author Message
Criminal
Journeyman
*

Posts: 182
Likes Given: 38
Likes Received: 22 in 22 posts
Joined: Jun 2015
Reputation: 0

SantiagoUO.com

Post: #11
RE: ethy's
(05-24-2016 03:38 AM)miltonvo Wrote:  
(02-07-2014 07:47 PM)XuN Wrote:  I finally had to upload mines, take a look here: http://forum.spherecommunity.net/sshare....wnload=282 , they are much more simple and with only the needed checks.

hi for all,
i want to put a timer on ethereal horses that when reaches 1 month the ethereal dissappear, how can i do this?

make it linked to player, set a timer, and don't get removed when unmounted

[Image: mfqAZnj.png]
Discord: SantiagoUO
Skype:
criminaluo
05-24-2016 05:54 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Vaikin
Apprentice
*

Posts: 4
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: May 2016
Reputation: 0



Post: #12
RE: ethy's
Assuming you have something like a figure used to mount the ethy:

on=@create
TIMERF 2592000,remove
05-24-2016 06:09 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #13
RE: ethy's
You will need to store a tag on the eth item setting to it the serv time when created, transfer it to the mount when mounting and transfering it back to the item when dismounting.

The tag would store the <serv.time>, which uses tenths of second to handle the time, hence you will have to convert them to seconds to use the timerf functions.
Timerf gets destroyed when the item is deleted, and this happens each time you mount/dismount for both eth item and the mounted npc, so I would add a function and call it when the mount NPC is being dismounted:

Code:
[function f_eth_timeout]
//argn raw timer
if (<argn>==0) // no previous timer
tag.timeout = <eval 60*60*24*30>
else
tag.timeout = <argn1>
endif
if (<tag.timeout> < <serv.time>)
remove
return 1
endif
timerf remove,<eval <tag.timeout>/10>

Then you must call the function on the newly created item or npc (after serv.newitem=xx or serv.newnpc=xx) with this line: new.f_eth_timeout <tag0.timeout>
05-28-2016 06:06 PM
Find all posts by this user Like Post Quote this message in a reply
miltonvo
Apprentice
*

Posts: 9
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: May 2016
Reputation: 0



Post: #14
RE: ethy's
(05-28-2016 06:06 PM)XuN Wrote:  You will need to store a tag on the eth item setting to it the serv time when created, transfer it to the mount when mounting and transfering it back to the item when dismounting.

The tag would store the <serv.time>, which uses tenths of second to handle the time, hence you will have to convert them to seconds to use the timerf functions.
Timerf gets destroyed when the item is deleted, and this happens each time you mount/dismount for both eth item and the mounted npc, so I would add a function and call it when the mount NPC is being dismounted:

Code:
[function f_eth_timeout]
//argn raw timer
if (<argn>==0) // no previous timer
tag.timeout = <eval 60*60*24*30>
else
tag.timeout = <argn1>
endif
if (<tag.timeout> < <serv.time>)
remove
return 1
endif
timerf remove,<eval <tag.timeout>/10>

Then you must call the function on the newly created item or npc (after serv.newitem=xx or serv.newnpc=xx) with this line: new.f_eth_timeout <tag0.timeout>

so the player can buy more than one eth, so how can i implement this? i ll paste part of script:

This is when a player bought the eth:
Code:
src.newitem i_et_bear
    src.newitem
    src.act.bounce

some eths that player can buy:
Code:
[ITEMDEF i_et_llama]
ID=i_pet_llama
NAME=Ethereal llama
TYPE=t_eth
tdata1=c_llama

ON=@Create
color=078ff
ATTR=04

[ITEMDEF i_et_bear]
ID=i_pet_bear_polar
NAME=Polar Bear
TYPE=t_eth
tdata1=c_bear_polar

ON=@Create
ATTR=04

This is the function of eth system:
Code:
[function bodyhex]    //this function returns the body in hex format to be able to read the mount's defnames in sphere_defs.scp (mount_0x444 in example)
local.body=<hval <body> & 0ffff>
local.len=<eval STRLEN(<local.body>)>
return 0x<strsub 1 <dlocal.len> <local.body>>


[typedef t_eth]
//This typedef handles almost all of the Ethereal's behaviour
on=@Dclick
local.id=<qval <tdata1>?<tdata1>:<tag0.ethid>>    //check for the source, a normal ethereal or a mount cloner
if <local.id>    //If a id is received then the code proceed
    IF !((<SRC.Body>==c_man) || (<SRC.Body>==c_woman) || (<SRC.Body>==c_elf_male) || (<SRC.Body>==c_elf_female))    //Only humans and elfs can mount, if you have humanoids races add them here.
        SRC.SysMessage=<defmsg.msg_mount_unable>
        Return 1
    Else
        serv.newnpc=<local.id>    //When ridding it, a real NPC with this ID is created
        new.tag.eth=<baseid>
        new.color=<color>
        if (<tag0.ethid>)        //If it's a cloner it have this tag, we transfer it to the npc to retrieve it back later.
            new.tag.etglobal=<tag.ethid>
        endif
        new.tag.color=<color>
        ref1=<new>
        serv.newitem=i_memory    //A memory_ipet is given to the NPC, so the player can ride it.
        new.color=memory_ipet
        new.link=<src>
        new.cont=<ref1>
        ref1.mount=<src>        //this function does dismount you if needed, hence I didn't check it before.
        src.events +e_ridding_eth    //This event handle the @Dismount, the rest of the script
        remove
    Endif
else
    serv.log Problems with <uid> (<name>) [t_eth] no tdata1 nor tag.ethid.
    return 1
ENDIF
return 1

on=@DropOn_Ground    //A simple quick fix to avoid players to drop their Ethereals by accident.
cont=<src.findlayer.21>
if (<tag0.ethid>)
    dispid=<serv.chardef.<tag.ethid>.icon>
    update
endif
return 1

ON=@AfterClick        //A message when clicking the ethereal to avoid scam in trades
local.clickmsghue=0480
local.clickmsgtext=You see a real <name>

[events e_ridding_eth]
ON=@Dismount
events -e_ridding_eth    //The event is removed in first place, to avoid possible problems later
ref1=<argo>
if (<ref1.tag0.eth>)    //However a double check is done to ensure that the mount is a Ethereal one
    serv.newitem=<ref1.tag.eth>
    
    new.color=<ref1.color>
    if (<ref1.tag0.etglobal>)
        new.tag.ethid=<ref1.tag.etglobal>
        new.dispid=<ref1.icon>
    endif
    new.cont=<findlayer.21>
    findlayer.25.remove
    return 1
endif

[ITEMDEF i_et_global]
ID=i_pet_horse_brown_dk
NAME=Mount Cloner
TYPE=t_eth

ON=@Create
color=078ff
ATTR=04

on=@DropOn_Char
if (<def0.mount_<argo.bodyhex>>)
tag.ethid=<argo.baseid>
name=Mount Cloner (<argo.name>)
color=<argo.color>
dispid=<argo.icon>
update
else
src.sysmessage That cannot be mounted.
endif
return 1
06-03-2016 06:01 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)