Jump to content

[LE] Need help with Trophy Script


wilwhitt56

Recommended Posts

Needing hrlp with a script ive been trying to use for several days. What im trying to do is make a Script for trophy mounts, like wolves and sabrecats. Ive been following Darkfox's tutorial for it, but ive run into a snag. His tutorial uses only 2 bases, mine has 21. When I follow his and try to compensate for mine, only the first 2 work right. What do I need to do have the script work for all 21? Keep in mind, I've ONLY JUST started messing with scripts, so go easy on me.

 

Here's the edited script that i tried to use. I figured a simple copy/paste did the trick since i didn't get an error when saving, but apparently not.

This is the activator:
Scriptname CGTestScriptTrophyActivator02 extends ObjectReference
{This script deletes the trophy being activated and sets it's global back to 0.}
;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.
GlobalVariable Property Global_Trophy_Placed_01 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_02 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_03 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_04 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_05 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_06 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_07 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_08 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_09 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_10 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_11 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_12 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_13 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_14 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_15 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_16 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_17 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_18 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_19 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_20 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_21 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
Int Property XPos_TrophyMarker_01 Auto
{The X axis position of the X-Marker used for the first trophy base.}
Int Property XPos_TrophyMarker_02 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_03 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_04 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_05 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_06 Auto
{The X axis position of the X-Marker used for the first trophy base.}
Int Property XPos_TrophyMarker_07 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_08 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_09 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_10 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_11 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_12 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_13 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_14 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_15 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_16 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_17 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_18 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_19 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_20 Auto
{The X axis position of the X-Marker used for the second trophy base.}
Int Property XPos_TrophyMarker_21 Auto
{The X axis position of the X-Marker used for the second trophy base.}
LeveledItem Property Trophy_Craft_Items Auto
{A leveled list containing all of the items used for creating the trophy.}
ObjectReference Property PlayerREF Auto
{The default reference for the game to point toward the player.}
String Property ReturnMSG Auto
{The notification to show when the craft items have been returned to the player.}
Event OnActivate(ObjectReference akActionRef)
If (Self.GetPositionX() == XPos_TrophyMarker_01)
Global_Trophy_Placed_01.SetValue(0) ;Set the trophy global to 0 to allow the base to know a new trophy can be placed
ElseIf (Self.GetPositionX() == XPos_TrophyMarker_02)
Global_Trophy_Placed_02.SetValue(0) ;Set the trophy global to 0 to allow the base to know a new trophy can be placed
EndIf
PlayerREF.AddItem(Trophy_Craft_Items, 1, True) ;Silently give the player all of the items back which were used in this trophy's creation
debug.notification(ReturnMSG) ;Show a notification to inform the player their items have been returned to them
Self.delete() ;The trophy now deletes itself and is no longer visible on the trophy base, allowing for a new trophy to be put down
EndEvent
This is the Misc:
Scriptname CGTestTrophyScriptMisc02 extends ObjectReference
{This script creates a trophy and places it on the trophy base currently being activated.}
;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.
Activator Property Trophy_To_Place Auto
{The trophy to create and place on the base.}
GlobalVariable Property Global_Trophy_Active Auto
{This will check to see which trophy base is currently set to active so that this craft menu knows where to place the trophy.}
GlobalVariable Property Global_Trophy_InUse Auto
{A global which is set after crafting an item to prevent the player from creating more than one trophy on the same stand.}
GlobalVariable Property Global_Trophy_Placed_01 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_02 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_03 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_04 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_05 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_06 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_07 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_08 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_09 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_10 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_11 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_12 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_13 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_14 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_15 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_16 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_17 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_18 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_19 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_20 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_21 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
MiscObject Property Trophy_Item Auto
{This is the item created by the crafting menu which triggers these events. This is the item this script is attached to.}
ObjectReference Property TrophyMarker_01 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_02 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_03 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_04 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_05 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_06 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_07 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_08 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_09 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_10 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_11 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_12 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_13 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_14 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_15 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_16 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_17 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_18 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_19 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_20 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_21 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property PlayerREF Auto
{The default reference for the game to point toward the player.}
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If (Global_Trophy_Active.GetValue() == 0) ;Is the current base tagged as 0?
debug.notification("Global Set Wrong")
ElseIf (Global_Trophy_Active.GetValue() == 1) ;Is the current base tagged as 1?
TrophyMarker_01.PlaceAtMe(Trophy_To_Place) ;Place the trophy at the relevant marker
Global_Trophy_Placed_01.Setvalue(1) ;Set base one as trophy placed
PlayerREF.RemoveItem(Trophy_Item,1,True) ; Removes the trophy misc item from the player's inventory silently
ElseIf (Global_Trophy_Active.GetValue() == 2) ;Is the current base tagged as 1?
TrophyMarker_02.PlaceAtMe(Trophy_To_Place) ;Place the trophy at the relevant marker
Global_Trophy_Placed_02.Setvalue(1) ;Set base two as trophy placed
PlayerREF.RemoveItem(Trophy_Item,1,True) ; Removes the trophy misc item from the player's inventory silently
EndIf
Global_Trophy_InUse.SetValue(1)
Utility.Wait(0.1)
Global_Trophy_InUse.SetValue(0)
EndEvent
Link to comment
Share on other sites

Im looking at it now and... am i suppose to copy/paste these lines as well?

 

Activator:

ElseIf (Self.GetPositionX() == XPos_TrophyMarker_02)
Global_Trophy_Placed_02.SetValue(0) ;Set the trophy global to 0 to allow the base to know a new trophy can be placed
Misc:
ElseIf (Global_Trophy_Active.GetValue() == 2) ;Is the current base tagged as 1?
TrophyMarker_02.PlaceAtMe(Trophy_To_Place) ;Place the trophy at the relevant marker
Global_Trophy_Placed_02.Setvalue(1) ;Set base two as trophy placed
PlayerREF.RemoveItem(Trophy_Item,1,True) ; Removes the trophy misc item from the player's inventory silently
Link to comment
Share on other sites

The question is

a) one baseobject "Trophy_Item" or

b) 21 different baseobjects

with 21 markers to place a single trophy?

 

MiscObject Property Trophy_Item Auto
{This is the item created by the crafting menu which triggers these events. This is the item this script is attached to.}
And are the GlobalVariables used within these two scripts only?
GlobalVariable Property Global_Trophy_Placed_0x Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
Link to comment
Share on other sites

 

The question is

a) one baseobject "Trophy_Item" or

b) 21 different baseobjects

with 21 markers to place a single trophy?

 

MiscObject Property Trophy_Item Auto
{This is the item created by the crafting menu which triggers these events. This is the item this script is attached to.}
And are the GlobalVariables used within these two scripts only?
GlobalVariable Property Global_Trophy_Placed_0x Auto
{The trophy global for the trophy base to know if a trophy is already in place.}

 

It's suppose to be 21 trophy bases in total, with roughly 22 trophies in total. 18 of them are suppose to have the small to mid size one (falmer, sabrecat, bears) while 19 and 20 have mammoths. 21 will have a dragon trophy on it for 3 different dragons (bronze, swamp, and frost)

Link to comment
Share on other sites

Im pretty sure it's just those two, but here's the one for the trophy base JIC

 

Base:

{Checks if a trophy is in place. If there is no trophy in place, this allows the player to add one.}
;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.
GlobalVariable Property Global_Trophy_Placed Auto
{DEFAULT: 0 This will be set to 1 once a trophy is placed to allow this base to know if a trophy is in place.}
GlobalVariable Property Global_Trophy_Active Auto
{This will allow the crafting menu to know which base to place the trophy on.}
Int Property Int_Trophy_Tag Auto
{Which trophy stand you want this trophy base to control.}
String Property FailMSG Auto
{The message you want to display if the player activates this base and a trophy is already in place.}
Event OnActivate(ObjectReference akActionRef)
If (Global_Trophy_Placed.GetValue() == 1) ;Is a trophy already in place?
debug.notification(FailMSG) ;Inform the player they cannot add a trophy is one is already in place
Else
Global_Trophy_Active.SetValue(Int_Trophy_Tag) ;The trophy base you are going to be adding a trophy to
Utility.Wait(0.1) ;Short delay to allow global changes to take effect
Self.GetLinkedRef().Activate(Game.GetPlayer()) ;Activates the craft system that your linked ref should point to
EndIf
EndEvent
Edited by wilwhitt56
Link to comment
Share on other sites

Sometimes its a good idea to use spoiler tags and its always fine to post a link where to find the original scripts. Keep it in mind!

 

mod: "Ressource Pack" made by Darkfox127 https://www.nexusmods.com/skyrim/mods/79519?tab=files
video: "Creation Kit (Custom Trophy Stands)", How to create multiple trophies? https://www.youtube.com/watch?v=-4igxAUcJ3A

 

The trophy creation is using next three scripts.

  1 - DF_Script_Trophy_Base.psc
  2 - DF_Script_Trophy_Misc.psc
  3 - DF_Script_Trophy_Activator.psc

At first do not use the scriptnames (from above) provided by ressource pack. Make it unique enough like next:

  wilw_Trophy_Base.psc
  wilw_Trophy_Misc.psc
  wilw_Trophy_Activator.psc

Now I changed the original scripts in some code parts to make it easier to handle. You have to use an array and also to create a formlist.

 

DF_Script_Trophy_Base

 

Scriptname DF_Script_Trophy_Base extends ObjectReference
{Checks if a trophy is in place. If there is no trophy in place, this allows the player to add one.}


;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.


GlobalVariable Property Global_Trophy_Placed Auto
{DEFAULT: 0 This will be set to 1 once a trophy is placed to allow this base to know if a trophy is in place.}

GlobalVariable Property Global_Trophy_Active Auto
{This will allow the crafting menu to know which base to place the trophy on.}

Int Property Int_Trophy_Tag Auto
{Which trophy stand you want this trophy base to control.}

String Property FailMSG Auto
{The message you want to display if the player activates this base and a trophy is already in place.}



Event OnActivate(ObjectReference akActionRef)

        If (Global_Trophy_Placed.GetValue() == 1) ;Is a trophy already in place?
            debug.notification(FailMSG) ;Inform the player they cannot add a trophy is one is already in place
        Else
            Global_Trophy_Active.SetValue(Int_Trophy_Tag) ;The trophy base you are going to be adding a trophy to
            Utility.Wait(0.1) ;Short delay to allow global changes to take effect
            Self.GetLinkedRef().Activate(Game.GetPlayer()) ;Activates the craft system that your linked ref should point to
        EndIf

EndEvent

 

wilw_Trophy_Base

 

Scriptname wilw_Trophy_Base extends ObjectReference
{v1.0 ReD 2022-01-21}  ; check if a trophy is in place. If there is no trophy in place, this allows the player to add one.

; https://www.nexusmods.com/skyrim/mods/79519?tab=files
; "Ressource Pack" made by Darkfox127

; https://www.youtube.com/watch?v=-4igxAUcJ3A
; "Creation Kit (Custom Trophy Stands)", How to create multiple trophies?

; 1 "DF_Script_Trophy_Base.psc"
; 2 "DF_Script_Trophy_Misc.psc"
; 3 "DF_Script_Trophy_Activator.psc"

; Original created by Darkfox127
; Any potential problems which may arise from this script being changed from the
; original are the sole responsibility of the mod author making the changes.
;-------------------------------------------------------------------------------

  GlobalVariable PROPERTY Global_Trophy_Active auto          ; global.GetValue() is 0.0 by default
  ; This will be set to a value of Trophy_Tag, which allows the "crafting menu" to know the base to place the trophy on.

  Int PROPERTY Int_Trophy_Tag auto                           ; [default=0], {Which trophy stand you want this trophy base to control.}
  ; 1
  ; 2
  ; ..
  ; 21

  GlobalVariable PROPERTY Global_Trophy_Placed auto          ; This globalVar will be set by "DF_Script_Trophy_Activator.psc" to a value of 1.0
  ; Global_Trophy_Placed_01                                  ; once a trophy is placed to allow this base to know if the trophy is in place.
  ; Global_Trophy_Placed_02
  ; ..
  ; Global_Trophy_Placed_21

  String PROPERTY FailMSG = "Trophy already placed!" auto    ; {The message you want to display if the player activates this base and a trophy is already in place.}


; -- EVENTs -- (1 of 3)

EVENT OnActivate(ObjectReference akActionRef)
    myF_Action(akActionRef)
ENDEVENT


; -- FUNCTION --

;-----------------------------------------------
FUNCTION myF_Action(ObjectReference akActionRef)
;-----------------------------------------------
IF (akActionRef == Game.GetPlayer() as ObjectReference)
ELSE
    RETURN    ; - STOP - /1    not player activated!
ENDIF
;---------------------
IF (Global_Trophy_Placed.GetValueInt() == 1)
    Debug.Notification(FailMSG)
    RETURN    ; - STOP - /2    you cannot add another trophy here, its already in place.
ENDIF
;---------------------
IF (Int_Trophy_Tag <= 0)
    Debug.Notification("Illegal trophy tag.. " +Int_Trophy_Tag)
    RETURN    ; - STOP - /3
ENDIF
;---------------------
    Global_Trophy_Active.SetValueInt( Int_Trophy_Tag )        ; The trophy base you are going to be adding a trophy to
    Utility.Wait(0.1)                                         ; Short delay to allow global changes to take effect

; at least we have to activate the craft system that your linkedRef should point to
    self.GetLinkedRef().Activate(akActionRef)
ENDFUNCTION

 

 

 

DF_Script_Trophy_Misc

 

Scriptname DF_Script_Trophy_Misc extends ObjectReference
{This script creates a trophy and places it on the trophy base currently being activated.}


;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.


Activator Property Trophy_To_Place Auto
{The trophy to create and place on the base.}

GlobalVariable Property Global_Trophy_Active Auto
{This will check to see which trophy base is currently set to active so that this craft menu knows where to place the trophy.}
GlobalVariable Property Global_Trophy_InUse Auto
{A global which is set after crafting an item to prevent the player from creating more than one trophy on the same stand.}
GlobalVariable Property Global_Trophy_Placed_01 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_02 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}

MiscObject Property Trophy_Item Auto
{This is the item created by the crafting menu which triggers these events. This is the item this script is attached to.}

ObjectReference Property TrophyMarker_01 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property TrophyMarker_02 Auto
{This will be one of the X-Marker Headings that your trophy is placed on.}
ObjectReference Property PlayerREF Auto
{The default reference for the game to point toward the player.}



Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

    If (Global_Trophy_Active.GetValue() == 0) ;Is the current base tagged as 0?

        debug.notification("Global Set Wrong")

    ElseIf (Global_Trophy_Active.GetValue() == 1) ;Is the current base tagged as 1?

        TrophyMarker_01.PlaceAtMe(Trophy_To_Place) ;Place the trophy at the relevant marker
        Global_Trophy_Placed_01.Setvalue(1) ;Set base one as trophy placed
        PlayerREF.RemoveItem(Trophy_Item,1,True) ; Removes the trophy misc item from the players inventory silently

    ElseIf (Global_Trophy_Active.GetValue() == 2) ;Is the current base tagged as 1?

        TrophyMarker_02.PlaceAtMe(Trophy_To_Place) ;Place the trophy at the relevant marker
        Global_Trophy_Placed_02.Setvalue(1) ;Set base two as trophy placed
        PlayerREF.RemoveItem(Trophy_Item,1,True) ; Removes the trophy misc item from the players inventory silently

    EndIf

    Global_Trophy_InUse.SetValue(1)
    Utility.Wait(0.1)
    Global_Trophy_InUse.SetValue(0)

EndEvent

 

wilw_Trophy_Misc

 

Scriptname wilw_Trophy_Misc extends ObjectReference
{v1.0 ReD 2022-01-21}  ; This script creates a trophy and places it on the trophy base currently being activated.

; https://www.nexusmods.com/skyrim/mods/79519?tab=files
; "Ressource Pack" made by Darkfox127

; Original created by Darkfox127
; Any potential problems which may arise from this script being changed from the
; original are the sole responsibility of the mod author making the changes.
;-------------------------------------------------------------------------------

  GlobalVariable PROPERTY Global_Trophy_InUse  auto        ; global.GetValue() is 0.0 by default
  ; after crafting an item, prevent the player from creating more than one trophy on the same stand.

  GlobalVariable PROPERTY Global_Trophy_Active auto        ; value was already set by "DF_Script_Trophy_Base.psc"
  ; This will check to see which trophy base is currently set to active so that this craft menu knows where to place the trophy.
 
  Activator PROPERTY Trophy_To_Place auto                  ; to create a new object which has attached "DF_Script_Trophy_Activator.psc"
  ; The trophy to create and place at right position.

  MiscObject PROPERTY Trophy_Item auto                     ; I am the item created by the crafting menu which triggers these events.
  {This is the baseObject this script is attached to.}

; -----------------------------------------------------
 ;;GlobalVariable PROPERTY Global_Trophy_Placed_01 auto    ; {The trophy global for the trophy base to know if a trophy is already in place.}
 ;;GlobalVariable PROPERTY Global_Trophy_Placed_02 auto    ; {The trophy global for the trophy base to know if a trophy is already in place.}

; v1
 ;;ObjectReference PROPERTY TrophyMarker_01 auto        ; {This will be one of the X-Marker Headings that your trophy is placed on.}
 ;;ObjectReference PROPERTY TrophyMarker_02 auto        ; {This will be one of the X-Marker Headings that your trophy is placed on.}
 ;; ..
 ;;ObjectReference PROPERTY TrophyMarker_21 auto        ; {This will be one of the X-Marker Headings that your trophy is placed on.}

; v2a
 ;;ObjectReference[] PROPERTY Array_TrophyMarkers auto       ; array of TrophyMarkers pre-placed by CreationKit
  ; Array_TrophyMarkers[0] = TrophyMarker_01
  ; ..
  ; Array_TrophyMarkers[20] = TrophyMarker_21

; v2b
  FormList PROPERTY TrophyMarkerList auto                    ; you have to create the formlist by CreationKit and assign to this property as well
  ; TrophyMarkerList.GetAt(0) = TrophyMarker_01
  ; ..
  ; TrophyMarkerList.GetAt(20) = TrophyMarker_21


; -- EVENTs -- (2 of 3)

EVENT OnInit()
;;    Debug.Trace(" OnInit() - has been reached.. " +self)        ; for debugging only
ENDEVENT


EVENT OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    IF myF_IsOK(akNewContainer)
        Global_Trophy_InUse.SetValue(1.0)
        Utility.Wait(0.1)
        Global_Trophy_InUse.SetValue(0.0)
    ENDIF
ENDEVENT


; -- FUNCTIONs -- 2

;-----------------------------------------------------
Bool FUNCTION myF_IsOK(ObjectReference akNewContainer)
;-----------------------------------------------------
IF (akNewContainer == Game.GetPlayer() as ObjectReference)
ELSE
    Return False    ; /1    its not the players inventory
ENDIF
;---------
    int i = Global_Trophy_Active.GetValueInt()

IF (i == 0)
    Debug.Notification("Trophy is not active.. GlobalVar setting is wrong!")
    Return False    ; /2
ENDIF
;---------

; v1
;    IF     (i == 1)
;        myF_Place(TrophyMarker_01, i)
;    ELSEIF (i == 2)
;        myF_Place(TrophyMarker_02, i)
;    ENDIF

; v2a, v2b
    myF_Place(akNewContainer, i)

    Return TRUE        ; /3    trophy successful placed
ENDFUNCTION


;--------------------------------------------------------
FUNCTION myF_Place(ObjectReference akNewContainer, Int i)  ; v2
;--------------------------------------------------------
; silently remove the trophy misc item from players inventory
    akNewContainer.RemoveItem(Trophy_Item as Form, 1, TRUE)

; place a trophy at the relevant marker
    i = i - 1                                                ; adjust start position

;;    objectReference oRef = Array_TrophyMarkers[i]                            ; get the marker from array
    objectReference oRef = TrophyMarkerList.GetAt(i) as ObjectReference        ; get the marker by formlist

    IF ( oRef )
        oRef = oRef.PlaceAtMe(Trophy_To_Place as Form, 1)    ; place a new object "the trophy" depends on this misc item
        IF ( oRef )
            (oRef as wilw_Trophy_Activator).myF_Init(i)        ; <-- By changing script name adjust here !!!
        ELSE
            Debug.Notification("Failed to place the trophy!")
        ENDIF
    ELSE
        Debug.Notification("Failed to get a valid trophy marker!")
    ENDIF
ENDFUNCTION


;;----------------------------------------------
;FUNCTION myF_Place(ObjectReference oRef, Int i)  ; v1
;;----------------------------------------------
;; silently remove the trophy misc item from players inventory
;    Game.GetPlayer().RemoveItem(Trophy_Item as Form, 1, TRUE)
;
;; place a trophy at the relevant marker
;    oRef = oRef.PlaceAtMe(Trophy_To_Place as Form, 1)
;    IF ( oRef )
;        (oRef as wilw_Trophy_Activator).myF_Init(i)            ; <-- By changing script name adjust here !!!
;    ELSE
;        Debug.Notification("Failed to place the trophy!")
;    ENDIF
;ENDFUNCTION

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

DF_Script_Trophy_Activator

 

Scriptname DF_Script_Trophy_Activator extends ObjectReference
{This script deletes the trophy being activated and sets its global back to 0.}


;Original script created by Darkfox127
;Any potential problems which may arise from this script being changed from the original are the sole responsibility of the mod author making the changes.


GlobalVariable Property Global_Trophy_Placed_01 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}
GlobalVariable Property Global_Trophy_Placed_02 Auto
{The trophy global for the trophy base to know if a trophy is already in place.}

Int Property XPos_TrophyMarker_01 Auto
{The X axis position of the X-Marker used for the first trophy base.}
Int Property XPos_TrophyMarker_02 Auto
{The X axis position of the X-Marker used for the second trophy base.}

LeveledItem Property Trophy_Craft_Items Auto
{A leveled list containing all of the items used for creating the trophy.}

ObjectReference Property PlayerREF Auto
{The default reference for the game to point toward the player.}

String Property ReturnMSG Auto
{The notification to show when the craft items have been returned to the player.}



Event OnActivate(ObjectReference akActionRef)

    If (Self.GetPositionX() == XPos_TrophyMarker_01)
        Global_Trophy_Placed_01.SetValue(0) ;Set the trophy global to 0 to allow the base to know a new trophy can be placed
    ElseIf (Self.GetPositionX() == XPos_TrophyMarker_02)
        Global_Trophy_Placed_02.SetValue(0) ;Set the trophy global to 0 to allow the base to know a new trophy can be placed
    EndIf

    PlayerREF.AddItem(Trophy_Craft_Items, 1, True) ;Silently give the player all of the items back which were used in this trophys creation
    debug.notification(ReturnMSG) ;Show a notification to inform the player their items have been returned to them
    Self.delete() ;The trophy now deletes itself and is no longer visible on the trophy base, allowing for a new trophy to be put down
    
EndEvent

 

wilw_Trophy_Activator

 

Scriptname wilw_Trophy_Activator extends ObjectReference
{v1.0 ReD 2022-01-21}  ; This script deletes the trophy being activated and sets its global back to 0.

; https://www.nexusmods.com/skyrim/mods/79519?tab=files
; "Ressource Pack" made by Darkfox127

; Original created by Darkfox127
; Any potential problems which may arise from this script being changed from the
; original are the sole responsibility of the mod author making the changes.
;-------------------------------------------------------------------------------

  LeveledItem PROPERTY Trophy_Craft_Items auto                        ; A leveled list containing all of the items used for creating the trophy.
  String PROPERTY ReturnMSG = "You got all trophy items back!" auto   ; {The notification to show when the craft items have been returned to the player.}

; -----------------------------------------------------
 ;;Int Property XPos_TrophyMarker_01 Auto                      ; {The X axis position of the X-Marker used for the first trophy base.}
 ;;Int Property XPos_TrophyMarker_02 Auto                      ; {The X axis position of the X-Marker used for the second trophy base.}

; v1
 ;;GlobalVariable PROPERTY Global_Trophy_Placed_01 Auto        ; {The trophy global for the trophy base to know if a trophy is already in place.}
 ;;GlobalVariable PROPERTY Global_Trophy_Placed_02 Auto        ; {The trophy global for the trophy base to know if a trophy is already in place.}
 ;; ..
 ;;GlobalVariable PROPERTY Global_Trophy_Placed_21 Auto        ; {The trophy global for the trophy base to know if a trophy is already in place.}

; v2
  GlobalVariable[] PROPERTY Array_Global_Trophy_Placed auto        ; array of Globals pre-placed by CreationKit
  ; Array_Global_Trophy_Placed[0] = Global_Trophy_Placed_01
  ; ..
  ; Array_Global_Trophy_Placed[20] = Global_Trophy_Placed_21

; next properties will be set during runtime
  GlobalVariable PROPERTY Global_Trophy_Placed auto Hidden    ; {The trophy global for the trophy base to know if a trophy is already in place.}


; -- EVENTs -- (3 of 3)

EVENT OnInit()
;;    Debug.Trace(" OnInit() - has been reached.. " +self)        ; for debugging only
ENDEVENT


EVENT OnActivate(ObjectReference akActionRef)
IF (akActionRef == Game.GetPlayer() as ObjectReference)
ELSE
    RETURN    ; - STOP -    not player activated!
ENDIF
;---------------------
    self.Disable(TRUE)                    ; fade it out

; silently give the player all of the items back, which were used in this creation of trophy.
    akActionRef.AddItem(Trophy_Craft_Items as Form, 1, TRUE)    ; all goods/materials back to player

; set the trophy global to 0 to allow the base to know a new trophy can be placed
    Global_Trophy_Placed.SetValue(0.0)

    Debug.Notification(ReturnMSG)        ; inform the player, that trophy material items have been returned to the inventory

; The trophy now deletes itself and is no longer visible on the trophy base, allowing for a new trophy to be put down
    self.Delete()
ENDEVENT


; -- FUNCTION --

;-----------------------
FUNCTION myF_Init(Int i)  ; v2, external called by "wilw_Trophy_Misc.psc"
;-----------------------
    IF (i >= 0) && (i < Array_Global_Trophy_Placed.Length)
        Global_Trophy_Placed = Array_Global_Trophy_Placed[i]
        Global_Trophy_Placed.SetValue(1.0)
    ELSE
        Debug.Trace(" myF_Init() - Error: array index is out of bound! " +i)
    ENDIF

; now destroy the array of globalVars, no longer needed!
    GlobalVariable[] b
    Array_Global_Trophy_Placed = b
ENDFUNCTION


;;-----------------------
;FUNCTION myF_Init(Int i)  ; v1, external called by "wilw_Trophy_Misc.psc"
;;-----------------------
;    IF     (i == 1)
;        Global_Trophy_Placed = Global_Trophy_Placed_01
;    ELSEIF (i == 2)
;        Global_Trophy_Placed = Global_Trophy_Placed_02
;
;    ..
;
;    ELSEIF (i == 21)
;        Global_Trophy_Placed = Global_Trophy_Placed_21
;    ENDIF
;
;    Global_Trophy_Placed.SetValue(1.0)
;ENDFUNCTION

 

 

 

Advantage you do not have to deal with a lot of "X axis position of the X-Marker".

Edited by ReDragon2013
Link to comment
Share on other sites

Im getting an error with the Misc Script, saying this. Also, how do i make a spoiler tag, and an Array? As I said, i'm VERY NEW to scripting.

EDIT: I'm looking at it, and I think it has to do with the two lines saying "By changing script name adjust here !!!"

C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CG_Script_Trophy_Misc.psc(110,18): cannot convert to unknown type cg_trophy_activator
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CG_Script_Trophy_Misc.psc(110,18): cannot cast a objectreference to a cg_trophy_activator, types are incompatible
C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\CG_Script_Trophy_Misc.psc(110,42): cg_trophy_activator is not a known user-defined type
No output generated for CG_Script_Trophy_Misc, compilation failed.
Edited by wilwhitt56
Link to comment
Share on other sites

(1) you wrote: "I'm VERY NEW to scripting."

Well.. a reason, but no thank you or any other good sign of you. I am really disappointed, in older days your postings were called "script kiddies"!

original scriptnames

   DF_Script_Trophy_Base.psc
   DF_Script_Trophy_Misc.psc
   DF_Script_Trophy_Activator.psc

my scriptnames

  wilw_Trophy_Base.psc
  wilw_Trophy_Misc.psc
  wilw_Trophy_Activator.psc
(oRef as wilw_Trophy_Activator).myF_Init(i)        ; <-- By changing script name adjust here !!!

your scriptnames

  cg_Trophy_Base.psc
  cg_Trophy_Misc.psc
  cg_Trophy_Activator.psc
(oRef as cg_Trophy_Activator).myF_Init(i)        ; <-- By changing script name adjust here !!!

(2) you wrote: "how do i make a spoiler tag"

Did you have a brain? If yes, use an internet web searcher or the forum search function (right on top).

 

 

[ spoiler ]

hidden posting, to make it work remove the spaces within the brackets

[ /spoiler ]

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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