
Somone77
Joined: Aug 25, 2007
|
Posted: Mar 24, 2008 10:13 PM
Msg. 1 of 29
I need a script to make a player drop thier weapon when say they get to a tigger volume... how do i do this?
|
|
|

DarkZealot
Joined: Jan 1, 2008
Time management: 40% Xbox, 30% PC, 30% Skating
|
Posted: Mar 24, 2008 10:18 PM
Msg. 2 of 29
Uh... as far as I know, that's impossible. :\
Still trying to get Grifball over here?
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 25, 2008 07:14 AM
Msg. 3 of 29
there must be a way becuae the flag is a weapon and that means that there must be a script in halo that makes you drop the weapon... and btw cheatsman its not a drop all weapons take my bomb for example now the guy has 3 weapons i want him to drop that bomb OR I just thought of an idea can you make a script so when he gets to a trigger it tells the mechine that he pressed fire? so trhen i would drop the bomb and it would explode if i set the time rght! You think that would work?
|
|
|

Mista Man
Joined: Mar 19, 2008
Unfortunately for us both, I like crazy.
|
Posted: Mar 25, 2008 11:25 AM
Msg. 4 of 29
Maybe, You would need someone who is a master at Guerilla and knows how to hack or change weapon properties
|
|
|

ThePlague
Joined: Dec 16, 2007
Steam: jubalearlybh
|
Posted: Mar 25, 2008 11:45 AM
Msg. 5 of 29
There is no hacking involved with that. All you have to do is be good at scripting, Sapien, and Trigger Volumes. I am not good at Scripting but if you can wait till someone that is good at it replys.
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 25, 2008 05:05 PM
Msg. 6 of 29
There is a way. You could make a "Player Starting Profile" that has no weapons in the scenario with Guerilla, and then implement it with scripts when the player goes into the trigger volume. Give the profile a health and shield modifier of 1, and possibly a few plasma and frag grenades. Just leave "primary weapon" and "secondary weapon" empty. Make sure to give the profile a name as well, so it can be referred to by a script. The command for using a player profile is this: (player_add_equipment <unit> <starting_profile> <boolean>) adds/resets the player's health, shield, and inventory (weapons and grenades) to the named profile. resets if third parameter is true, adds if false. So, to use it in a map, just use this basic syntax: (player_add_equipment (unit (list_get (players) #)) <profile_name> 1) You want the boolean to be "true" so it resets because otherwise the player won't lose its weapons. The number "#" there should be 0 if you're making a single player map. The side effects of this are that the grenade count and health/shields will be reset regardless of the player's condition, but there's no other way of changing his grenade count or the weapon he's holding. But, this alone will just make his weapon disappear, and nothing will actually be dropped. I'm assuming this is a single player map, so do this: Just make a "Weapon" for each type of weapon the player could be holding under Objects > Items > Weapons in Sapien, and give each one a name. Make sure they will spawn initially. Give each one a decent amount of ammo, and try to make each name short and easy to remember. Then, in your scenario under "References" in Guerilla (you'll need Kornmann's Guerilla v2 for this), make new blocks and select each weapon tag used for the weapons in Sapien. Now, before any scripts, in your source file, make global variables referring to each weapon reference with this format: (global object_definition <short name for variable> <path and filename of tag, in quotes>) Ok. Last part: I was going to put this in words, but that would take longer than making the script for you, surprisingly. So, here's a summary script for implementing all of this, but with parts for you to fill in based on what you need: (global object_definition <short name for variable> <path and filename of tag, in quotes>) (repeat for each weapon tag)
(script startup my_fingers_are_tired (sleep_until (volume_test_objects <volume name> (players))) ;; player triggers this by going into volume (if (unit_has_weapon (unit (list_get (players) 0)) <variable name for 1 weapon>) ;; checking to see if the player has the weapon (begin (objects_attach (list_get (players) 0) "" <object name for same weapon in sapien> "") ;; attaching weapon to player to bring it to him (objects_detach (list_get (players) 0) <object name for same weapon in sapien>) ;; detaching it, thereby dropping it ) ) ;; repeat this entire (if) section for EACH weapon. (player_add_equipment (unit (list_get (players) 0)) <profile name> 1) ;; taking the weapons away from player. ) Make sure that player_add_equipment is AFTER all of the (if) sections. ;; = comments. You can leave them in when compiling if you want. They don't affect anything. Edited by Me KS on Mar 25, 2008 at 05:10 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 25, 2008 08:15 PM
Msg. 7 of 29
Me KS that is sort of what i was looking for but lets just put it this way: ok i have a bomb, it picks up as a weapon, then you are now holding three weapons, I want you to drop that bomb and only the bomb. what if i set the profile to have primary and secondary will that mean it will drop a thrid weapon?
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 25, 2008 10:01 PM
Msg. 8 of 29
Well, if that's the case, then it could still be applied to my idea, but with a few changes.
One of the changes will be what you said: set a primary and second weapon so only the bomb is dropped. The only problem with this is that it will change whichever weapons the player was holding to the profile's weapons. You can hide this effect by somehow making sure that the player can only have those two weapons at that point in the level, but you don't need to do that if it'll disturb the game play.
Then, the other change is convenient: because you only need to drop the bomb, you only need to create one weapon with a name in Sapien (the bomb), one reference to the bomb in the scenario, and only one variable referring to the bomb in the script. So, you can still use the script in my last post, but you don't need to repeat anything, because you only need to worry about the bomb.
I would leave in the "unit_has_weapon" check even though it seems pointless now with just the bomb. That way, there won't be a random bomb dropping from nowhere if the player actually isn't holding the bomb when he gets into the trigger.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 25, 2008 10:18 PM
Msg. 9 of 29
What if i did this?:
(global object_definition <short name for variable> <path and filename of tag, in quotes>) (script startup drop (if (unit_has_weapon (unit (players) 0)) <name> (objects_attach (list_get (players) 0) "" <object name for same weapon in sapien> "") (sleep_until (volume_test_objects drop1 (players) 0)) 1) (objects_detatch (list_get (players) 0) "" <object name for same weapon in sapien> "") )
Would that work the way i want it or no? becuase i want him to drop the bomb when they get to the trigger. O dang and i just thought of something. The script as i see doesnt (i think) take into acount that the person that has the bomb has to activate the script not anyone else... I think this is saying the last person to join lol becuase of 0)... Im guessing that this wont work then becuase of this reson. Unless... is there a script that can set like a temporary name or something for the person holding the bomb? because then we could just have the script tell when that person with the name or the bomb gets to the trigger and then he drops it. But im not the expert. I think i might as well forget about this becuase unless i have help this "griffball for CE "thing is never going to happen.
Edited by cheater101 on Mar 25, 2008 at 10:40 PM
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 03:55 PM
Msg. 10 of 29
So it isn't a single player map? Like I said, that will complicate things. It could still be doable, but the problem with "Weapons" in Sapien is that they disappear in a multiplayer game after their respawn time is up. But, weapons are always synchronized, so what could happen is a simple host check and then the host can constantly recreate the bomb when it disappears. That script you made up there wouldn't work. I think what you were trying to do with the line: (sleep_until (volume_test_objects drop1 (players) 0)) 1) is check for when the player is in the trigger volume, right? That's already done. The script would've already worked as it is-it drops the bomb if the player has it when he gets into the trigger volume. Now, knowing that we're talking about an MP map, and that each player has to have the bomb dropped every time he's in that trigger volume, I'll redo the script for that (I'll edit this if it's too small to read, but otherwise it would take up a lot of space): (global boolean host 0) (global object_definition <short name for variable> <path and filename of bomb tag, in quotes>)
(script startup host_check_dammit (if (> (unit_get_health <vehicle name>) -1) ; only the host can access vehicles through scripts (set host 1) ) )
(script continuous respawn_bomb (if (and (<= (unit_get_health <object name for bomb in sapien>) -1) ; checking to see if bomb is gone (= host 1) ; only host can respawn it ) (object_create_anew <object name for bomb in sapien>) ; respawns bomb ) )
(script continuous disarm_bomb (if (and (or (volume_test_object <volume name> (list_get (players) 0)) (volume_test_object <2nd volume name> (list_get (players) 0)) ) ; player needs to be in one of these volumes (unit_has_weapon (unit (list_get (players) 0)) <variable name for bomb>) ; checking to see if the player has the bomb ) (begin (objects_attach (list_get (players) 0) "" <object name for bomb in sapien> "") ; attaching bomb to player to bring it to him (objects_detach (list_get (players) 0) <object name bomb in sapien>) ; detaching it, thereby dropping it (player_add_equipment (unit (list_get (players) 0)) <profile name> 1) ; taking the bomb away from player. ) ) ; repeat this entire (if) section for EACH player (numbers 1 through 15). ) What I mean at the end is for each (list_get (players) #) and (unit (list_get (players) #)) section, just repeat the entire (if) section with the # changed to 1, and then 2, and then so on again until you have an (if) section for each player from 0-15. Also, create a vehicle that can't be destroyed (any default vehicle should work) and put it in a hidden place, making sure that it'll spawn in every gametype by default in Sapien. Then, give it a name, and use it under <vehicle name>. This is needed to check to see who is host. Edited by Me KS on Mar 26, 2008 at 05:03 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 04:22 PM
Msg. 11 of 29
ummm problem....... you cant set a name for an item colection... so how do i do the object name for the bomb? or is it the global definition short name?
P.S. btw me ks you are being a real friendly person usualy peope bye this time would be mad for all this work but thanks! If this griffball thing ever gets done ill be sure you get in the credits for helping with scripts! Edited by cheater101 on Mar 26, 2008 at 04:36 PM
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 04:31 PM
Msg. 12 of 29
No problem. I like figuring things out in general, and I enjoy scripting because of that. That's why I don't consider this work, but more of an interesting challenge. In fact, every time I make a script for some cause, I learn something more in the process.
As long as you've learned something from all of this, it's not a problem.
I say that because I basically gave you the script, so if you don't understand any part of the script, tell me, so that you can learn from it by understanding it. That's why I put the comments ";;" near some lines, so you understand what each part is for.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 04:39 PM
Msg. 13 of 29
Quote: ummm problem....... you cant set a name for an item colection... so how do i do the object name for the bomb? or is it the global definition short name? I edited without seeing your post sry
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 04:43 PM
Msg. 14 of 29
Put the bomb under Objects > Items > Weapons in Sapien with its .weapon tag. It's the only way to name it. Make sure it'll spawn initially, too.
Also, the global variable name can be whatever you want. It's just so it can be referred to in the script by "unit_has_weapon". Edited by Me KS on Mar 26, 2008 at 04:48 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 04:49 PM
Msg. 15 of 29
ok and about the 5th line sapien has a problem it says this: i expected (if [condition] [else] or something like that. What now?
O and i have two goals would i jsut be able to put a trigger in there and call it say score2 and then make two volume_test_objects (bal bal bal) when i make the script or would that be rong and halo would come out of my computer and knock my head like the V8 ads... Edited by cheater101 on Mar 26, 2008 at 04:54 PM
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 04:58 PM
Msg. 16 of 29
Do you have a profile set up and named? Do you have a vehicle for host checking spawned and named? Do you have the bomb set up and named? Do you have the trigger set up and named? Did you give a name to the global variable and give the proper reference to your bomb's weapon tag for the variable, and in the scenario under "References"?
If you didn't do all of that yet, then do it now. Once you have everything in your scenario with a name, then make sure to fill in the all of the <> parts with the name needed. Otherwise, it won't compile right.
Edit: Sure you could. I'll edit the script in my other post for that. Edited by Me KS on Mar 26, 2008 at 05:04 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 05:09 PM
Msg. 17 of 29
Quote: Do you have a profile set up and named? What do you mean this script (for what i see) doesnt have any indecation that i needed one so i didnt find anywhere to put a name for a profile...
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 05:17 PM
Msg. 18 of 29
............................ Actually, it's right here: (begin (objects_attach (list_get (players) 0) "" <object name for bomb in sapien> "") ; attaching bomb to player to bring it to him (objects_detach (list_get (players) 0) <object name bomb in sapien>) ; detaching it, thereby dropping it (player_add_equipment (unit (list_get (players) 0)) <profile name> 1) ; taking the bomb away from player. )
Have you read through everything in my posts? I don't even think you read through the script. What you've asked me so far has already been answered at least once in all of my other posts in this topic. Before asking anything again, please look for an answer in my posts. If you want to know what "profile" I'm talking about, look in the first post I made in this topic. Edited by Me KS on Mar 26, 2008 at 05:18 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 05:20 PM
Msg. 19 of 29
it still says the smae thing in sapien This is the place it has a problem with: (script startup host_check_dammit (if (> (unit_get_health syncer) -1) ;; only the host can access vehicles
through scripts (set host 1) Edited by cheater101 on Mar 26, 2008 at 05:24 PM
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 05:30 PM
Msg. 20 of 29
Alright. That's strange. I'm pretty sure my syntax is fine, but it might be the comments. You can get rid of them since the script is in the forums anyways. I don't know why the comments would cause problems, but just making sure.
If that doesn't fix it, then to make this process faster, just take what you have in your scripts .hsc file and post it on here (in the code "#" and also with font Times new Roman so it's small) so I can see what you did and make sure it's fine.
Also, look at the post where I gave you the most recent script for MP. I changed it for your two trigger volumes.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 05:43 PM
Msg. 21 of 29
so what are you saying get rid of that part of the script?
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 05:46 PM
Msg. 22 of 29
No. The comments are what the start with the ";"s. Just get rid of the ";"s and whatever is stated after it that isn't code, and see if that fixes it.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 05:49 PM
Msg. 23 of 29
ok that worked now it thinks the ball) -1) in line 15 is the name of the weapon! what now!
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 05:52 PM
Msg. 24 of 29
It is the name of the weapon, so I don't know what you mean. Like I said, post your script as it is now in the forums inside code "#" and with the font Times New Roman so I can see what's wrong.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 05:54 PM
Msg. 25 of 29
ok here: (global boolean host 0) (global object_definition <ball> weapons\bomb\bomb)
(script startup host_check_dammit (if (> (unit_get_health syncer) -1) (set host 1) )
)
(script continuous respawn_bomb
(if (and (= (unit_get_health ball) -1) (= host 1) ) (object_create_anew ball) ) )
(script continuous disarm_bomb (if (and (volume_test_object score (list_get (players) 0)) ;; player needs
to be in volume (unit_has_weapon (unit (list_get (players) 0)) ball) ;;
checking to see if the player has the bomb ) (begin (objects_attach (list_get (players) 0) "" ball "") ;;
attaching bomb to player to bring it to him
(objects_detach (list_get (players) 0) ball) ;; detaching it, thereby dropping it
(player_add_equipment (unit (list_get (players) 0)) post_score 1) ;; taking the bomb away
from player. ) ) ;; repeat this entire (if) section for EACH player (numbers 1 through 15). )
I didnt put all 15 repeted things to make it shorter
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 06:11 PM
Msg. 26 of 29
(global boolean host 0) (global object_definition <ball> weapons\bomb\bomb)
(script startup host_check_dammit (if (> (unit_get_health syncer) -1) (set host 1) ) )
(script continuous respawn_bomb (if (and (<= (unit_get_health (unit ball)) -1) (= host 1) ) (object_create_anew ball) ) )
(script continuous disarm_bomb (if (and (volume_test_object score (list_get (players) 0)) ;; player needs to be in volume (unit_has_weapon (unit (list_get (players) 0)) <ball>) ;; checking to see if the player has the bomb ) (begin (objects_attach (list_get (players) 0) "" ball "") ;; attaching bomb to player to bring it to him (objects_detach (list_get (players) 0) ball) ;; detaching it, thereby dropping it (player_add_equipment (unit (list_get (players) 0)) post_score 1) ;; taking the bomb away from player. ) ) ;; repeat this entire (if) section for EACH player (numbers 1 through 15). ) I made it neat again, and put the (<=) back into the unit_get_health because it was changed to (=) for some reason. Now, the name of your variable is <ball>, so you use that name in your unit_has_weapon check, which I changed above. The reason why it might be giving you errors is because possibly the weapon needs to be converted into a unit with (unit), which you can see I changed in the line above. Keep that the same, and try compiling it now with this script. Edited by Me KS on Mar 26, 2008 at 06:11 PM
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 06:31 PM
Msg. 27 of 29
Ok i got it to compile fine now i have it ingame but when i get to the trigger he doesnt drop it it just has the model (like a pet) falow you wile your in the trigger volume but it wont leave your hands... Edited by cheater101 on Mar 26, 2008 at 06:44 PM
|
|
|

Me KS
Joined: Feb 2, 2008
Desire is Reality. Xfire: jetmaster23
|
Posted: Mar 26, 2008 07:43 PM
Msg. 28 of 29
Does it drop when you leave the trigger volume, or stay in your hands from that point on? Does the bomb as a weapon that you're using disappear, even though the bomb still is attached to your hands? Is the bomb weapon named "ball" the same bomb that you pick up before going into the trigger volume?
I'll edit it depending on the answers.
|
|
|

Somone77
Joined: Aug 25, 2007
|
Posted: Mar 26, 2008 10:50 PM
Msg. 29 of 29
ok i have to go to bed bus i have to get up at 5 a.m. tomarow so i do have a vid that i took of the bug. do you have xfire? cus i can send it and you can understand whats going on better (btw ignor the little bomb abuv the big one thats there on accedent and ill take it out) my xfire is iky001
|
|
|