post

RealmCrafter Standard Tutorial – Mount up your horses

Hi guy’s someone asked me for a mount script in RealmCrafter engine.
So… Here it is.
Keep in mind TYPING OVER IS BETTER THEN COPY PASTE IT!
Any problem’s or upgrades you can post here πŸ™‚

First start a new script you will see something similar to this:

Using "RC_Core.rcm"
; TestEnvironment
; Date/Time: 1:57:37 on 20-6-2010
; By Nigel on PC_VAN_NIGEL

Function Main()

End Function

First we need to think of what we want.
This is what im think off.

  • Get the player
  • Get the players coordinates
  • Get the zone of the Player
  • Get the mount model from the library
  • Spawn the mount near the player
  • Make the mount your, pet so only u can use it
  • Hop on the mount when u click it
  • Hop off when u click away from it
  • Mount runs away and dissappear when it is unmounted

First we need the first 2 lines of the list:

Using "RC_Core.rcm"
; TestEnvironment
; Date/Time: 1:57:37 on 20-6-2010
; By Nigel on PC_VAN_NIGEL

Function Main()
Player = Actor()

pX# = ActorX(Player)
pY# = ActorY(Player)
pZ# = ActorZ(Player)
End Function

With this we have the Player stored in the variable Player and the location of the player.
Now we want to get the zone the player is in and the mount id and spawn it near the player.

Using "RC_Core.rcm"
; TestEnvironment
; Date/Time: 1:57:37 on 20-6-2010
; By Nigel on PC_VAN_NIGEL

Function Main()
Player = Actor()
Zone$ = ActorZone(Player)
Mount = ActorID("Horse","Mount")

rd = Rand(25,50)
pX# = ActorX(Player)
pY# = ActorY(Player)
pZ# = ActorZ(Player)
spawnMount = Spawn(Mount,Zone,pX+rd,pY+10,pZ+rd)
End Function

Ok now we have created something that will be visible! Hoorray!
Save the script call it SummonMount or something u like.
And go to your editor.
Open your ability’s and assign this script to one of your ability’s
After your did that you could give it to a shop dealer or your ingame commands to quick try it.

(Ingame Command’s way)

Function GiveMount()
Player = Actor()
If PlayerIsGM(Player) = 1
AddAbility(Player, "YourAbilityNameWithTheQuotes")
output( Player, "Gained the Mount ability.", 255, 0, 0 )
EndIf
End Function

Save all your work and start your game.
When you are ingame just type /GiveMount and you will notice in the chat it say’s “Gained the Mount Ability”.
This is a good sign!
Open your Ability’s Window and learn it.
Put it in your QuickSlots and press it to use.
If all go good you will now see your horse or any other mount you wrote down!
If not check your server log’s if there is any error.

Lets go to the next lines:

Using "RC_Core.rcm"
; TestEnvironment
; Date/Time: 1:57:37 on 20-6-2010
; By Nigel on PC_VAN_NIGEL

Function Main()
Player = Actor()
Zone$ = ActorZone(Player)
Mount = ActorID("Horse","Mount")

rd = Rand(1,3)
pX# = ActorX(Player)
pY# = ActorY(Player)
pZ# = ActorZ(Player)
spawnMount = Spawn(Mount,Zone,pX+rd,pY+10,pZ+rd)
SetLeader(spawnMount ,Player)
SetActorAIState(spawnMount ,7)

End Function

With this you it is now bound to you as player so only you can ride it
Now lets do the last point to let the mount walk away when you dismount

Open your Mount.rsl
You will see something similar to this in it:

Using "RC_Core.rcm"
; Default mounting change script for player characters
; You may alter this script however you like, but DO NOT RENAME OR DELETE IT

; This function is called when a player mounts an actor
; The actor is the player, the context actor is the mount
Function Mount()
; Done
Return
End Function

; This function is called when a player dismounts from an actor
; The actor is the player, the context actor is the ex-mount
Function Dismount()
Return
End Function

Lets alter the script so it will walk away and dissappear.

Using "RC_Core.rcm"
; Default mounting change script for player characters
; You may alter this script however you like, but DO NOT RENAME OR DELETE IT

; This function is called when a player mounts an actor
; The actor is the player, the context actor is the mount
Function Mount()
; Done
Return
End Function

; This function is called when a player dismounts from an actor
; The actor is the player, the context actor is the ex-mount
Function Dismount()
DoEvents(50)
C = ContextActor()
Player = Actor()
pX = ActorX(Player)
pZ = ActorZ(Player)
rd = Rand(25,50)
SetActorDestination(C, pX+rd, pZ+rd)
DoEvents(5000)
KillActor(C)
End Function

Now with this all inserted try it out! save your work and have fun πŸ™‚
You could offcourse upgrade it with more options like only spawn 1 time.
Or on spawn it runs to you etc, etc.