Complete Example Scripts: Difference between revisions
Jump to navigation
Jump to search
m
→Script to make an item cast a spell: GetPlayer swapped for PlayerREF
imported>JustinOther m (→A helper script with functions to get the current moonphase, sync between the two moons and day of the week: Floats converted to Ints that they'll be in the format which they're returned) |
imported>JustinOther m (→Script to make an item cast a spell: GetPlayer swapped for PlayerREF) |
||
| Line 452: | Line 452: | ||
import Utility | import Utility | ||
Actor Property PlayerREF Auto | |||
Float Property xOffset Auto ; Relative X position for the target | Float Property xOffset Auto ; Relative X position for the target | ||
Float Property yOffset Auto ; Y Offset for Target | Float Property yOffset Auto ; Y Offset for Target | ||
| Line 481: | Line 482: | ||
Event OnUpdate() | Event OnUpdate() | ||
; find something nearby to shoot at if we're not making our own target. | ; find something nearby to shoot at if we're not making our own target. | ||
if !SpawnNode && !TargetTypeList && GetDistance( | if !SpawnNode && !TargetTypeList && GetDistance(PlayerREF) < SeekRange ; No list given, Default to the player if he is in range. | ||
CurrentTarget = | CurrentTarget = PlayerREF | ||
elseif TargetTypeList | elseif TargetTypeList | ||
CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList,Self,SeekRange) | CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList, Self, SeekRange) | ||
endif | endif | ||
if CurrentTarget ; it's possible that there is no target | if CurrentTarget ; it's possible that there is no target | ||