Jump to content

How to use a script to check if the player has any weapons?


Recommended Posts

Hey there!

 

I've worked extensively with this, and I can't ever get ICARUS (the scripting language) to 'get' the player's weapon data. For instance, in order to perform an IF statement, you need to 'get' the value of set_weapon. And, for some reason, I can't figure out what values it returns. It's not a string (weapon_blaster, or other variations of this) or a float (numberical equivelant?). So maybe if we can look at the ICARUS code, we can see how to properly handle weapon checks, but atm, you can't. :(

Link to comment

Damn. I had an awesome idea for this whole big puzzle (it was like a security checkpoint thing). You were going to have to do all this neat stuff like pick up some bodies using force grip and drop them on some pressure pads, use force push to use two consoles within seconds of each other to open a door, mind trick a guy, etc. My ideas and ambitions are always forcing me to try things that it turns out aren't possible in these games.

 

On a related note, could you bind a .cfg file (or something else maybe) to a key to make the player drop their lightsaber, in SP? I know there's the console command g_saberPickupableDroppedSabers or whatever it is, so that you can grab other jedi's/sith's lightsabers when they die. Seems like it might be possible to drop them as well.

 

EDIT: And I want the player to be able to pick them back up again. It's part of the puzzle. There's a scanner you have to walk through that scans you for weapons, and if you have any on you the room goes into lockdown. So you have to drop your weapon, go through the scanner, do the thing with the bodies on the pressure pads, hit the switches, mind trick a guy, finally the door opens, so you step through the doorway and use force pull to get your lightsaber back.

Link to comment

There are several scripts, close in function to what you are asking. One of them blocks all the weapons and powers. The Player can't jump too in this instance.

 

Another one is (also) used on Nar Shaddaa in Jedi Outcast. Should you try using any weapon, Kyle would comment, that he can't use it ("I don't want any trouble... Yet!").

Surely this second script is not linked to the fact, that Kyle says something. It's rather that the script checks whether you try to use them or not and that you are not allowed to activate them (perhaps by another script).

 

I came to a conclusion, that a phrase "this can be possible merely through code-tampering of the game" sometimes might prove wrong.  Scripting bring amazing results sometimes...

Stoiss and therfiles like this
Link to comment

Hey @@DarthStevenus! Don't get discouraged too quickly. ICARUS is very touchy and limiting, and its all about working around the shortcomings of the system. For instance:

 

  • You could place a trigger with a script runner around weapon pickups (for this example, we'll use a blaster) and then have a script that sets a variable (again, let's say HAS_BLASTER to 1). That way, when he gets the weapon, we'll have a fully functioning variable working that the scripts can use!
  • Mind trick is also editable. There is a block, called SET_MINDTRICK_SCIRPT, that runs a designated script on the NPC when a successful mind trick is performed. It's really cool, and you can do practically anything with it!
  • Additionally, you could make your NPCs for the pressure pads unkillable, so when they reach 1 hp (you could use a pain script to check that) they can run death animations and sounds, but still have them be "alive". Then you can use triggers to check to see if those NPCs are on the pressure pad, and that should be possible.
  • You can time the force pushes. Just have two scripts that set a variable (let's say PUSH_NUMBER) +1 it's value. For instance, it starts at 0, then when the first push is activated, it adds 1 to the value, and checks to see if the value is 2. Then, have it wait 3 seconds, and have the script subtract 1. Then duplicate the process for the second push. So, when both +1s are used withing a three second period, the number will be 2, and you can run a script to check the value and open the door.
  • I know there is a SET_WEAPON key named "drop", but I'm not sure it works. There is a UI command that can clear ALL the player's weapons, however. You'd need to use SET_MENU_SCREEN and some other trickery to accomplish this. But then, using the HAS_BLASTER commands I outlined previously, you can restore the weapons that were owned previously.
  • You could use force pull to get your weapon back, just target the force brush to the target_scriptrunner.

I'd be happy to help you think through any of these challenges, if you like! :)

Link to comment

Well I was working at it last night when I started this thread actually. I got to the part where I wanted the script to check for weapons and I realized I had no idea how to do that. For the dead bodies (so morbid to type it out like that) I was going to run a cfg when the player started the game that would set corpseremovaltime to 0 so that the NPCs bodies would never disappear. You can move bodies with grip, but you can tell the game doesn't like it when you do that. They're sort of hard to lock onto, and you tend to drop them unexpectedly, so your way sounds better. Plus if I made it so NPCs were never removed, it would probably cause performance issues eventually. For the pressure pads I was using two big square brushes on the floor that I turned into two separate func_buttons, pretty sure I tried this with something else before and it seemed to work. And I'm all set on the mind control and force push stuff. I made some func_statics with the push flags checked out of some super thin caulk brushes and put them in front of my control consoles, which are actually func_buttons with on/off textures on either one. I guess it's mainly the weapon checking thing that is going to give me trouble. If all else fails, I'll just have the player walk up and "use" something and when they do, run a script on them that takes away their weapons.

 

Would be nice to be able to map a function to a key that will drop the player's lightsaber though. I was thinking of adding a gameplay element to this mod (it's a SP campaign mod that I'm toying around with BTW) using g_saberPickupableDroppedSabers so that you could pick up a fallen sith's/jedi's lightsaber or sabers, and I might even go so far as to add a menu screen on your datapad where you can drop your saber/sabers, like if you're using two sabers and you want to switch to just one. I've even considered giving special attributes to enemy sabers, like a longer blade or increased parry strength, so you could upgrade and mix and match as you play. Which begs the question, would it be possible to show those kinds of .sab file details on a menu screen?

therfiles likes this
Link to comment

I don't think so...unless you could get the UI to perform a cvar test based on "single1" (which is the cvar used for saber hilts). If so (I feel like you could) then it'd be a matter of hiding/showing the info when the cvar is correct. Just need to have a bunch of UI items for each hilt.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...