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:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Removing Summoned NPC
Author Message
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #1
Removing Summoned NPC
I'm having trouble figuring this out. I have everything else working fine but I just cant seem to have the animal that is summoned be removed when the timer hits 0.


[FUNCTION frostelf_avatarofice]
IF ((<src.tag.frost_elf>)=0)
SRC.SYSMESSAGE You are not of that race
RETURN 1
ELSEIF (<SRC.FINDID.i_avatarofice_timer>==0)
src.newitem=i_avatarofice_timer
SRC.new.TIMER=1
src.act.equip
SRC.ACT.CONT=<SRC.UID>
serv.newnpc c_horse_tan
new.MakeMyPet
return 1
else
src.sysmessage You must gather your strength...
endif
endif

[function MakeMyPet]
serv.newitem=i_memory
new.color=memory_ipet
new.link=<src>
new.cont=<uid>


I've tried setting a timer on i_memory and using on=@timer to remove it but it gives me nothing so im sure I'm missing something here.
02-03-2015 06:41 PM
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: #2
RE: Removing Summoned NPC
In the timer you must use CONT.Remove, where CONT is who/what holds the item (in this case the pet with the memory, if you use it in one item inside your backpack then CONT will be the backpack ...).

IF ((<src.tag.frost_elf>)=0) <-- you are using so much () and missing one = and tag0:
-It makes no sense to use ((<src.tag.frost_elf)==0), I bet you remember maths in school using them to group numbers, ie: 3 + (4/2), there's no reason to do (3) + (4/2), right?
-NAME=MyName, one = means set. <str>==100, two = means comparison.
-<src.tag.frost_elf> returns '' if it does not exist, which means NULL or nothing ... no value at all and it throws error at console because sphere will read this: if ( == 0)'. So this is where the magic of tag0 which adds automatically one 0 if there is no value.

So this line should be like this: IF (<src.tag0.frost_elf>==0)
02-03-2015 11:38 PM
Find all posts by this user Like Post Quote this message in a reply
Leonidas
Master
**

Posts: 277
Likes Given: 3
Likes Received: 13 in 12 posts
Joined: May 2013
Reputation: 1



Post: #3
RE: Removing Summoned NPC
Okay thanks man, I'm trying to remember all of this, it's been a while since I've actually scripted anything. I appreciate your help! Thank you
(This post was last modified: 02-04-2015 09:06 AM by Leonidas.)
02-04-2015 09:06 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Leonidas's post
Post Reply 


Forum Jump:


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