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
type in function
Author Message
seafish
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0



Post: #1
type in function
Hello!
How can I put type in function? Example:
Code:
[function f_ohoh]
newnpc=c_dragon
act.p=<p>  
act.m=0,1,-20
type=t_haha
act.attr=010
...

I have an error in console - Undefined keyword 'type'
10-28-2013 11:44 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: type in function
Type is ONLY for items, you can't assign types to NPCs, you have to create [EVENTS ] for them, also the ATTR is an item value,you want the dragon to be 'static' and never move? use tag.nomovetill 99999999999

Also if you are running newer versions use this code instead
serv.newnpc=c_dragon
new.p=<p>
new.m=0,0,-20
new.events +e_yournewevent //you have to create it
new.tag.nomovetill=99999999999

The serv.newnpc/newitem will create for you this npc or item and will make it the default object for NEW, so you don't have to use ACT: wich may conflict with other systems.
10-29-2013 12:10 AM
Find all posts by this user Like Post Quote this message in a reply
seafish
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0



Post: #3
RE: type in function
Thank you! But how to add function after On=@create (for npc's) I would like to make event, example:
[events e_hoho]
ON=@create
new. f_ohoh

right?
10-29-2013 12:28 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: #4
RE: type in function
ON=@Create does NOT work in events because events are added after the npc is created... BUT you are already creating this npc when you call it from this first function, so you dont need to use @Create, you simply use new.f_ohoh and it's done.
10-29-2013 12:37 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #5
RE: type in function
Perhaps if you explained what exactly the function is supposed to do, a better solution can be offered.

[Image: 2nis46r.jpg]
10-29-2013 12:38 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
seafish
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0



Post: #6
RE: type in function
okay, its not a problem.
1. its typedef:
Code:
[typedef t_wall]
on=@timer
if (<p.z> < <morez>)
m=0,0,1
timerd={1 3}
endif
return 1

2.
Code:
[function f_test]
newnpc=c_dragon
new.p=<p>  
new.m=0,1,-20
new.events +
new.timerd=1

It's for npc's - they growing from the earth more slowly (from the one of the topic's from spherecommunity.net)
Give me some second hand please, tell me how to create from typedef t_wall event for the npc's ?
(This post was last modified: 10-29-2013 12:48 AM by seafish.)
10-29-2013 12:48 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: #7
RE: type in function
Code:
[function f_Test]
serv.newnpc=c_dragon
new.p=<p>
new.f_ztimerfix -20

[function f_ztimerfix]
if (<args>)
tag.real_z=<p.z>
move 0 0 <args>
timerf 0,f_ztimerfix
else
if (<p.z><<tag.real_z>)
  p.z +=1
  timerf 0,f_ztimerfix
else
  tag.real_z
endif
endif

Decimals are not available in timerf, but you can check this out,
10-29-2013 12:55 AM
Find all posts by this user Like Post Quote this message in a reply
seafish
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0



Post: #8
RE: type in function
thanx! but when creates c_Dragon - he appears under the ground, not on surface! And there is some error
Code:
Undefined symbol '' Line 41
Line 41 - if (<args>)
10-29-2013 01:26 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: #9
RE: type in function
if !(<isempty <args>>)
10-29-2013 03:13 AM
Find all posts by this user Like Post Quote this message in a reply
seafish
Apprentice
*

Posts: 21
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Oct 2013
Reputation: 0



Post: #10
RE: type in function
Thank you senior, there are no errors now! But npc still sits underground
10-29-2013 04:53 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)