Jump to content

Item Pickup & Message scripting troubleshooting


Recommended Posts

Hi,

I'm a novice scripter. I'm trying to improve on a script whereby a revolver is placed on a desk in a cell, a frenemy is watching the player and if it's picked up, a message will appear on the screen and the frenemy switches to hostile and attacks the player. This is working fine, but I would like to build upon that so the pop-up message and faction change doesn't occur if the frenemy has already been killed. I've tried this by adjusting the existing script, and by adding a separate script entirely that deletes the original pickup script upon frenemy's death.

My working script for picking up the pop-up when frenemy is alive:

ScriptName MarkedRevolverPickupSCRIPT

short bDoneOnce

Begin OnAdd player

    if bDoneOnce == 0
        ShowMessage MESSAGE1
        SetEnemy PlayerFaction DFACTION
        player.drop MARKEDREVOLVER1
        set bDoneOnce to 1  ; Mark as completed so the message doesn’t trigger again
    endif

End
 

I've tried adding this script to forego the above if frenemy is killed, with no effect:

ScriptName 1DeathSCRIPT

Begin OnDeath

    RemoveScript MarkedRevolverPickupSCRIPT ""  ; Removes the pickup script from the weapon

End

 

Another way I've approached this is to modify the existing script:

ScriptName MarkedRevolverPickupSCRIPT

short bDoneOnce
ref HostageRef  ; Reference variable for the hostage taker

Begin GameMode
    set HostageRef to GetReference frenemy  ; Assign the hostage taker's reference (this may need manual setup in GECK)
End

Begin OnAdd player

    if bDoneOnce == 0
        if GetDead HostageRef == 0  ; Check if hostage taker is alive
            ShowMessage MESSAGE1
            SetEnemy PlayerFaction DFaction
            player.drop MARKEDREVOLVER1
        endif
        set bDoneOnce to 1  ; Prevent repeat triggers
    endif

End
 

Implementing either of these changes nullifies the working effects of my original script.

Thank you.

Link to comment
Share on other sites

I think the nightkin Davison in Repconn Test Site has something similar. If his brahmin skull on the desk was moved even a pixel from its original place he will go hostile on our ass.

You can reference the revelant script or activator with that. 

--

The caravan sacked site north of Jean Sky Diving Shack also has some similar script. If you move outside and loot the bodies, fine. But if you move into the camper, the (slightly farther) Powder ganger would run toward that camper, and (if neutral before) turn to hostile, and infect that hostility with the wandering PG nearby

Link to comment
Share on other sites

  On 5/14/2025 at 5:06 AM, laclongquan said:

I think the nightkin Davison in Repconn Test Site has something similar. If his brahmin skull on the desk was moved even a pixel from its original place he will go hostile on our ass.

You can reference the revelant script or activator with that. 

--

The caravan sacked site north of Jean Sky Diving Shack also has some similar script. If you move outside and loot the bodies, fine. But if you move into the camper, the (slightly farther) Powder ganger would run toward that camper, and (if neutral before) turn to hostile, and infect that hostility with the wandering PG nearby

Expand  

Thank you I'll give that a look, I did try to think of in-game examples to copy from but got sidetracked. If I get it going I'll let you know!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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