![]() |
onWall3()
1 Attachment(s)
Just a make shift version of the onWall2() function that checks the tilelayers on serverside, which currently isn't implemented in-game yet.
Use : onWall3( x, y, w, h, level, layerscount);
Installation : Simply add the following code to a class, then join that class to whatever you need it for serverside. Also upload the 'tiledata.nw' file to your levels/ folder and I guess make sure the NPC server has read rights to the levels/ folder PHP Code:
Make a weapon, add this code to it, and then add it to yourself. It will then check a 2x2 square if the tiles are blocking. PHP Code:
Also figured I should attach this for getting the actual level name and not gmap name serverside, credit goes to cbk1994 for the code. -Thank you. =] PHP Code:
|
very nice, I would have loved this a year ago when I tried to convince Thor to use tilelayers on Classic.
|
What is tiledata.nw supposed to be?
|
Quote:
|
You would be better off determining all the blocking areas, caching the blocking data, and then referencing your cache (perhaps in a level var) instead of reloading and parsing the direct level data every time.
|
Quote:
|
Bit modified version that is taking lot less CPU. Changed it so a 'block map' of a level is created and I reference that instead of loading the level each time and looking at it. Probably be better to use level.vars instead of a db_npc, but I can't get level vars to work for me properly. :/ Also haven't added gmap support for building block maps. Feel free to modify/add to the script if you want.
Now with this method you personally have to build the block map by saying a command on RC RC Command /npc blockmap <level_name.nw> <# of layers> Use onWall3( x, y, w, h); Installation In your Control-NPC add this : PHP Code:
PHP Code:
I know this is more efficient due the /stats telling me, my baddie class CPU usage went from 1.784367163 % to 0.651127497 %. Although it does seem to spike from time to time. :/ e. May of had to do with other parts of the script for the high cpu usage, after rewriting a good portion to be cleaner and more efficient, the time is down to 0.063054958 %, but that is showing how efficient it is still. |
All times are GMT +2. The time now is 01:54 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.