SphereCommunity
MountItem/MountNPC - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Submissions (/Forum-Script-Submissions)
+--- Thread: MountItem/MountNPC (/Thread-MountItem-MountNPC)



MountItem/MountNPC - Khaos - 03-20-2016 10:10 PM

After a short discussion with Xun this AM, this was going to be released just as a Quick way (Which does no checks), but Xun banks on people not understanding the code (and I should too) so his function is provided (and I reworked it a bit to make it more logical).

My way will also be shown as well; but since we always have to bank on people not understanding how the code works and what should and should NOT be allowed... Xun's way is safer for people.

This is like Item= ItemNewbie= etc. Set it in your @Create or call it as a normal function in game if you'd like. It only takes the parameter for the Mount Creature.

E.g. MountNpc=c_Reptalon
Code:
[Function MountNPC]
If !(<Serv.CharDef.<ArgS>>)
Serv.Log <UID>:<UID.Name> mount <ArgS> failed. Invalid CharDef.
Return
EndIf
Serv.NewNpc=<ArgS>
New.P=<P>
Mount=<New>
Ref1=<New>
If !(<FindLayer.25>) || (<IsGargoyle>)
Serv.Log <UID>:<UID.Name> mount <New.Name> failed. Invalid mount.
Ref1.Remove
EndIf

Now, if you actually do understand mounts and what should and should not be done. This is the fastest method for your servers without using a function call and can be used directly in @Create on an NPC (my way).

Code:
[ItemDef iMountItemHorse1]
ID=03E9F
Type=t_Eq_Horse

Category=Server
Subsection=Mount Items
Description=Horse 1

On=@Create
More1=0C8

Which can be used like this in @Create:
Code:
On=@Create
// Your code here
ItemNewbie=iMountItemHorse1

Even on dismount this SHOULD create a horse mount for you of BaseID=0C8