PDA

View Full Version : Changeing player health Depending on Vehicle...



Inferno
July 30th, 2008, 05:14 PM
I'm working on a Vehicle CTF map and to balance the vehicles i need to write a script that changes a players health depending on which vehicle hes in.
More or less the way i Plan on doing it is with

(if (vehicle_test_seat "red-pelican-1" "driver" (unit (list_get (players) 0 ) ) ) ------------------------------------//checks until the player is in the vehicle
--(begin
-----(unit_set_maximum_vitality (unit (list_get (players) 0 ) ) 1000 1000 )-------------------------------------// sets the players health to 1000
-----(sleep_until ( = (vehicle_test_seat "red-pelican-1" "driver" (unit (list_get (players) 0 ) ) ) 0 )---------------// waits until he exits the vehicle
-----(unit_set_maximum_vitality (unit (list_get (players) 0 ) ) 100 100 )---------------------------------------//resets players health
--)
)

Problem with this is I'd have to do it with 16 players on every seat of every vehicle... and that's a fuck ton of scripting. So if you guys have any better ways of doing this, I'm open to suggestions.

Evil_Monkey
July 30th, 2008, 08:59 PM
I'm not sure if this works because I haven't tried it, but go ahead and test it and tell me if it works.


(global short playnum 0)

(script continuous red_peli
(if (vehicle_test_seat "red-pelican-1" "" (unit (list_get (players) playnum)))
(begin
(unit_set_maximum_vitality (unit (list_get (players) playnum)) 1000 1000)
(sleep_until ( = (vehicle_test_seat "red-pelican-1" "" (unit (list_get (players) playnum))) 0)
(unit_set_maximum_vitality (unit (list_get (players) playnum)) 100 100)
)
)
)
)
(set playnum (+ 1 playnum))
(if (= (> 15 playnum) true)
(begin
(set playnum 0
)
)
)That should check for any player that is in any seat of the red-pelican-1.

Apoc4lypse
July 30th, 2008, 10:11 PM
can't you just mess with the vehicle collision so when ever the vehicle is shot, the player gets dealt more damage? Thus making the player have less health or die more easily.

Inferno
July 30th, 2008, 11:26 PM
can't you just mess with the vehicle collision so when ever the vehicle is shot, the player gets dealt more damage? Thus making the player have less health or die more easily.

Doesn't work cause if you shoot the cockpit its a instant kill. Which throws off the game play a lot.


And @ evil monkey.
Ima try your script and see if it works next time i get a chance.

Although for the sake of knowledge I'd like to know what this whole section of the script does exactly.

(set playnum (+ 1 playnum))
(if (= (> 15 playnum) true)
(begin
(set playnum 0
)
)
)

I got the general idea but how does it work?

CtrlAltDestroy
July 30th, 2008, 11:51 PM
It basically loops through the entire script 16 times, once for each player, then resets itself back to the first player after the last iteration.

Inferno
July 31st, 2008, 01:26 PM
Doesn't work i tried it out. I guess ill just write it out for each player.

Edit-
Actually its not the script its a problem with the game. No matter what i do the vehicle_test_seat script always returns false. I went in game Got in red pelican 1 and typed into DEV
(vehicle_test_seat "red-pelican-1" "pilot" (unit (list_get (players) "0" ) ) )
and it returned false. Every single time.

Soooooo... anyone know how to fix this?

Edit Dos-

Oddly enough I tried replacing the seat NAME with the SEAT ANIMATION name and it worked.... So apparently you have to put "W-Driver" not "pilot". Who would have thought?

S3anyBoy
August 3rd, 2008, 10:34 PM
Edit Dos-

Oddly enough I tried replacing the seat NAME with the SEAT ANIMATION name and it worked.... So apparently you have to put "W-Driver" not "pilot". Who would have thought?
I figured that out a while back, it was pretty weird considering all the other scripts use the seat name not animation, guess the programmer was high or something.

Inferno
August 5th, 2008, 01:35 PM
I'm having a problem... The script only works for player 0. When someone joins they become player zero and the person who was player 0 before becomes player 1. So wtf do i do???