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-nmm6 (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-nmm6 (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-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 786 - File: showthread.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/showthread.php 786 errorHandler->error






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turn lights ON/OFF
Author Message
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #1
Turn lights ON/OFF
I willing to make something to lights on the torchs on whole map when the sectors turns dark and off when turns lights...

Need some ideas, thats my idea... when the npc near the torchs lights on or off, it will run these functions to lights on/off near torchs.

Here is it:

PHP Code:
[FUNCTION F_LIGHTSON]
FORITEMS 8
 
IF STRMATCH(*T_LIGHT_OUT*,<TYPE>)
  IF <
SECTOR.ISDARK>
   
MOREY 20
   DCLICK
  
ENDIF
 ENDIF
ENDFOR
RETURN 
1

[FUNCTION F_LIGHTSOFF]
FORITEMS 8
 
IF STRMATCH(*T_LIGHT_LIT*,<TYPE>)
  IF !<
SECTOR.ISDARK>
   
MOREY 20
   DCLICK
  
ENDIF
 ENDIF
ENDFOR
RETURN 

PHP Code:
[EVENTS e_Human_Environ]

ON=@EnvironChange
    
if <flags>&statf_war 
        
return 0
    
endif
    if !<
sector.isdark> || (<flags>&statf_nightsight)
        if <
findlayer(layer_hand2)>
            if <
findlayer(layer_hand2).type> == t_light_lit
                F_LIGHTSOFF
                findlayer
(layer_hand2).bounce
            
endif
        endif
        return 
0
    
endif
    
// already have a lit light ?
    
if <findlayer(layer_hand2)>
        if <
findlayer(layer_hand2).type> == t_light_lit
            
return 0
        
endif
    endif
    
// try to use a torch or light source if i have one. (and it's dark)
    
if <findtype.t_light_out>
        
F_LIGHTSON
        findtype
.t_light_out.equip
        findtype
.t_light_out.use
    endif
    return 


STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
04-20-2013 05:52 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Turn lights ON/OFF - Extreme - 04-20-2013 05:52 AM

Forum Jump:


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