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
NEWNPC?
Author Message
Reflex
Journeyman
*

Posts: 130
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Apr 2012
Reputation: 1



Post: #1
NEWNPC?
Kinda confused here.. I need this timer to add a new npc where the item was originally placed. Also im not sure if there is a better way to specify my if statements other than adding MOREY=# to the item..

Code:
[itemdef i_green_thorn]
ID=i_arrow_x
NAME=Green Thorn
TYPE=t_normal

on=@create
color=042

on=@dclick
if (<attr>&attr_move_never)
src.sysmessage You can't touch this.
return 1
endif

if !(<topobj.uid>==<src.uid>)
src.sysmessage It must be in your pack.
return 1
endif
targetg @042 Choose a spot to push the thorn.
return 1

on=@targon_ground
// Dirt
if (<src.targp.terrain>==03ff9) || (<src.targp.terrain>==077) || (<src.targp.terrain>==03ffa)  || (<src.targp.terrain>==078) || (<src.targp.terrain>==071) || (<src.targp.terrain>==03ff) || (<src.targp.terrain>==037a) || (<src.targp.terrain>==085) || (<src.targp.terrain>==074) || (<src.targp.terrain>==03ff8) || (<src.targp.terrain>==087) || (<src.targp.terrain>==088) || (<src.targp.terrain>==072) || (<src.targp.terrain>==03ffb) || (<src.targp.terrain>==075) || (<src.targp.terrain>=076)

serv.newitem i_green_thorn
new.cont=<src.uid>
new.dispid=0a13
new.p=<src.targp>
new.attr |= attr_move_never
new.morex=1
new.morez=5
new.morey=1
new.timer=1
new.z += 2
src.consume 1 i_green_thorn
src.emote You push the strange thorn into the ground
return 1
endif

if (<src.targp.terrain>==010c) || (<src.targp.terrain>==010d) || (<src.targp.terrain>==010e) || (<src.targp.terrain>==010f) || (<src.targp.terrain>==011) || (<src.targp.terrain>==011a) || (<src.targp.terrain>==011b) || (<src.targp.terrain>==011c) || (<src.targp.terrain>==011d) || (<src.targp.terrain>==0385) || (<src.targp.terrain>==0386) || (<src.targp.terrain>==0387) || (<src.targp.terrain>==0388) || (<src.targp.terrain>==0745) || (<src.targp.terrain>==0746) || (<src.targp.terrain>==0747) //snow

serv.newitem i_green_thorn
new.cont=<src.uid>
new.dispid=0a13
new.p=<src.targp>
new.attr |= attr_move_never
new.morex=1
new.morez=5
new.morey=2
new.timer=1
new.z += 2
src.consume 1 i_green_thorn
src.emote You push the strange thorn into the ground
return 1
endif

if (<src.targp.terrain>==09) || (<src.targp.terrain>==0d) || (<src.targp.terrain>==0a) || (<src.targp.terrain>==0b) || (<src.targp.terrain>==0c) || (<src.targp.terrain>==0d) //Field
serv.newitem i_green_thorn
new.cont=<src.uid>
new.dispid=0a13
new.p=<src.targp>
new.attr |= attr_move_never
new.morex=1
new.morez=5
new.morey=3
new.timer=1
new.z += 2
src.consume 1 i_green_thorn
src.emote You push the strange thorn into the ground
return 1
endif

if (<src.targp.terrain>==0) || (<src.targp.terrain>==0) // Swamp
src.sysmessage Swamp
return 1
endif

src.sysmessage @color_text_red You fail to push the <name> into this type of land.
return 1
on=@timer
if (<moreX>==1)
    if (<morez> > 0)
        if (<morey>==1)
    serv.newitem random_reagent,{20 30}
    new.moveto=<eval <p.x>-(rand(3)-rand(3))>,<eval <p.y>-(rand(3)-rand(3))>,<p.z>
    new.updatex

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move n
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move e
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move s
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move w
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move nw
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move ne
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move se
    new.updatex
    new.timer=2

    serv.newitem 0914
    new.attr attr_decay
    new.moveto=<p>
    new.move sw
    new.updatex
    new.timer=2

    serv.newitem 031f5
    new.attr attr_decay
    new.moveto=<p>
    new.updatex
    new.timer=2

    sound 319
    morez -= 1
    timer 2
    return 1

elif (<morey>==2)
    TRYSRV SERV.NEWNPC c_giant_ice_worm
    sound 319
    remove
    return 1

elif (<morey>==3)
    TRYSRV SERV.NEWNPC c_vorpal_bunny
    sound 319
    remove
    return 1
else
remove
return 1
endif
endif
endif
(This post was last modified: 05-21-2012 06:06 AM by Reflex.)
05-21-2012 06:05 AM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #2
RE: NEWNPC?
When I want a script to create a new "summoned" NPC on top of an item, I do this:

Code:
SERV.NEWNPC c_vorpal_bunny
NEW.FLAGS |= (statf_war|statf_conjured)
NEW.P=<SRC.P>
NEW.f_NPCRemovalTimer 1200
//NEW.ATTACK <SRC> //If I know the source, I use this to make the new creature attack

[FUNCTION f_NPCRemovalTimer]
SERV.NEWITEM i_removetimer_mem
EQUIP <NEW>
NEW.TIMER=<ARGN1>

[ITEMDEF i_removetimer_mem]
ID=i_memory
NAME=remove timer
TYPE=t_eq_script
ON=@Timer
   CONT.REMOVE
   RETURN 1
05-21-2012 08:26 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)