Jump to content

Mount script help needed


Elbethien

Recommended Posts

I have some boat mounts (published) and I think it is very annoying when they fast travel with the player.

The boats are big and don't belong on mountains. That is stupid.

 

I thought I could put a simple script on my boats like this:

---------

scriptname boatstopFASTtravelSCRIPT

Begin OnActivate

if ( player.getdistance Boatref >= 100 ) && ( Boat.isPlayersLastRiddenHorse == 1)

set BoatDummy.isPlayersLastRiddenHorse to 1

endif
end

---------

BoatDummy is an invisible mini mount.

I had some more ideas, but nothing worked. Any sugestions?

Edited by Elbethien
Link to comment
Share on other sites

Here's an idea - if I am missing the point, please don't waste time discussing it. ^_^

There is a boat 'quest'. When 'mounting' the boat, onActivate disables fast travel. When leaving the boat, a quest marker appears at that spot, and fast travel is enabled again (if it was so in the first place). Summoning the boat removes the quest marker (or puts it at the current position, and it gets removed when the player enters the boat).

Happy sailing!

Link to comment
Share on other sites

All right, I think I found something that works:

 

scriptname BOATstopFASTtravelSCRIPT


Begin gamemode

if ( player.getdistance Boatref >= 50 ) && ( Boatref.isPlayersLastRiddenHorse == 1)

ClearPlayersLastRiddenHorse

endif
end

 

Mount will stop to follow on fast travel. It needs more testing, but it works.

Edited by Elbethien
Link to comment
Share on other sites

If the script is attached to a base... thingy (the one created in the Object Windows of the Construction Set), it will run separately on each instance of that object in the game world. Like if that is attached to the boat in the CS, it will run separately on every instance of that boat in the world. And if a script runs on a reference, it will automatically target that reference, like a magic effect script will automatically target the thing the effect is cast on. So if a command has a syntax defined (in the Construction Set Wiki, for example) like this:

<target>.IsPlayersLastRiddenHorse

It will, if run on the target reference, automatically target it, in which case (if the target is BoatRef)

BoatRef.IsPlayersLastRiddenHorse

Is equal to

IsPlayersLastRiddenHorse

If the script runs on BoatRef, which it does, if you have selected that script as the script for the base boat created in the Construction Set. It will then also work with an unlimited number of boats, as there is no need to target a specific reference in the script, as every instance of that script (on every boat placed in the game world) automatically uses the boat it runs on as the target. So you can place a hundred boats in the world and every one of them will just check itself if the script is written so that no specific reference is defined as the target.

scriptname BOATstopFASTtravelSCRIPT

Begin GameMode

    If ( IsPlayersLastRiddenHorse == 0 )
        Return  ; Stop here, to prevent doing a GetDistance check
    EndIf

    If ( GetDistance Player >= 50 ) ; This is only done if the boat is the last ridden one
        ClearPlayersLastRiddenHorse
    EndIf

End

The script will, if the boat is an actor, run on the boat every time its AI updates (as it is GameMode block). And if written that way, it will work on each and every boat separately, which allows for an unlimited amount of boats.

 

Some have said the GetDistance function is performance-heavy, but others have said it is not. That is why I put below the check for last ridden horse. Not sure if it makes any difference, but as the CS wiki says AI for actors in high-level AI processing is updated every frame - in which case that script, if the boat mount is in high-level AI processing, is updated every frame - it probably does not hurt to limit the distance check to only the case if the boat actually is player's last ridden one.

 

Just my thoughts on the matter. In case they happen to be useful. I am not an expert, though, so if someone better with scripting happens to read this, feel free to correct me. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...