Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can cast spells under map
Author Message
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #11
RE: Can cast spells under map
best way to fix this is on sphere source code. On sphere 56d this is already fixed by default, but on old 56b the only way to fix it is using workaround on scripts

maybe the script above will be able to fix it, you just need to replace TIMERF 1,Z=<SRC.Z> with TIMERF 1,FIX. But keep in mind that this is an workaround, it will create the field on wrong position and then after 1 second it will call an ".fix" on item adjusting Z to correct value
10-14-2017 08:20 AM
Find all posts by this user Like Post Quote this message in a reply
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #12
RE: Can cast spells under map
I've posted this some time ago:

Code:
[FUNCTION f_fix_z]
local.z = <z>
local.tz = <serv.map(<p.x>,<p.y>).terrain.z>

if (<abs <eval (<local.z> - <local.tz>)>> < 10)
    z <local.tz>
else
    local.z <local.tz>
    for x 1 <serv.map(<p.x>,<p.y>).statics>
        if (<abs <eval (<local.z> - <serv.map(<p.x>,<p.y>).statics.<local.x>.z>)>> < 10)
            local.z <serv.map(<p.x>,<p.y>).statics.<local.x>.z>
        endif
    endfor

    z <local.z>
endif

I don't really know if it's the best and accurate code to do this... loot it's simple, but you can have an idea Smile

Adding a tiny explanation:

This code checks the TERRAIN of the "actual item position" (ignoring its own Z), it the item is too "closer" to the terrain the fixed Z will be set as the TERRAIN Z point.

If the actual position is distant to the terrain the code will seek the closet STATIC item at the position to define the Z point...

There are a lot of code needed to make this work properly, need to check the item "height", floors and so...

And think now of the initial problem.... u can check if the spell is called "under" the TERRAIN...

Triggering it you can cancel the casting, or... use the code to fix the spell position Smile

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
(This post was last modified: 10-14-2017 08:53 AM by escribano.)
10-14-2017 08:45 AM
Find all posts by this user Like Post Quote this message in a reply
Russian
Journeyman
*

Posts: 75
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 0



Post: #13
RE: Can cast spells under map
It's a live!
Code:
IF (<ARGN>==24) || (<ARGN>==28) || (<ARGN>==39) || (<ARGN>==47) || (<ARGN>==50)
    //Если кастует на земле
    IF !(<SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).TERRAIN.Z>==<SRC.TARGP.Z>) && (<SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).STATICS.1.ID>==0)
    SERV.LOG [<SRC.NAME> <SRC.UID> Z:<SRC.TARGP.Z>] try to cast <SERV.SPELL.<ARGN>.NAME> [to Z: <SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).TERRAIN.Z>]
    SRC.SYSMESSAGE @0486 Вне поля видимости.
    RETURN 1
    ENDIF
    //Если кастует на статике
    IF !(<SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).STATICS.1.Z>==<SRC.TARGP.Z>) && !(<SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).STATICS.1.ID>==0)
    SERV.LOG [<SRC.NAME> <SRC.UID> Z:<SRC.TARGP.Z>] try to cast <SERV.SPELL.<ARGN>.NAME> [to Z: <SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).STATICS.1.Z>]
    SRC.SYSMESSAGE @0486 Вне поля видимости.
    RETURN 1
    ENDIF
ENDIF
Thanks to all! Big thanks to escribano, he said true: !(<SERV.MAP(<SRC.TARGP.X>,<SRC.TARGP.Y>).TERRAIN.Z>==<SRC.TARGP.Z>)


Attached File(s) Thumbnail(s)
   
(This post was last modified: 10-15-2017 05:03 AM by Russian.)
10-14-2017 05:23 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Russian's post
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #14
RE: Can cast spells under map
Glad I helped!

As I always said, there is nothing that can't be done in sphere Tongue

Also thanks for posting the solution to the community!
Don't forget to like the post I helped!

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
10-16-2017 11:01 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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