|
Post by pragon977 on Nov 22, 2016 16:58:03 GMT
I am trying to create a cop chase game, where the police car or the player must subdue/apprehend the suspect vehicle. I created this script so that the player car hits the AI car, and after it reaches the desired force, the player wins -
OBJ_66 = textprint OBJ_88 = exitfade
float force = 50000;;
void Main() { //IN_0 = contact force if(IN_0 >= force) { iObjectShow(OBJ_66) //textprint visible }
if(IN_0 >= force) { iObjectStart(OBJ_88) //starts exitfade } } Now, can you all help me, and tell me how to add a health system using the contact force? Basically I want the player's police car to hit the suspect AI car to subdue the suspect by hitting the suspect multiple times, such that the force gets added up to a set value. So, I still want -
if(IN_0 >= force) { iObjectShow(OBJ_66) } if(IN_0 >= force) { iObjectStart(OBJ_88) }
Any suggestions and help will be appreciated!!!
|
|
|
Post by GH Games on Nov 22, 2016 19:01:35 GMT
I see what you mean and I think you may be able to do something similar with EventOnContact's. However don't take my word for it xD Hope it helps!
|
|
|
Post by pragon977 on Nov 23, 2016 3:50:27 GMT
The script is connected to EventOnContact, from which the contact force is derived. I just want to be able to manipulate the script so that the force from multiple hits adds up to 50000, thus ending the game.
|
|
|
Post by indiedev on Nov 23, 2016 6:59:47 GMT
i can do all that without a script, just need to add a counter and value to each hit
|
|
|
Post by kulu on Nov 23, 2016 8:10:27 GMT
indiedev is right. Every time the Event on contact is successful (collision occurs) , then counter is started . e.g initial counter value is 100 and the increment value is -50 . everytime the counter is started by a successfull collision, then 50 is minused from the initial counter value. so , after two successfull collisions, the counter value should be zero. you can then use value print object with the counter , to show the player their health on screen.
|
|
|
Post by TinSoldier on Nov 23, 2016 15:52:04 GMT
I am trying to create a cop chase game, where the police car or the player must subdue/apprehend the suspect vehicle. I created this script so that the player car hits the AI car, and after it reaches the desired force, the player wins -
OBJ_66 = textprint OBJ_88 = exitfade
float force = 50000;;
void Main() { //IN_0 = contact force if(IN_0 >= force) { iObjectShow(OBJ_66) //textprint visible }
if(IN_0 >= force) { iObjectStart(OBJ_88) //starts exitfade } } Now, can you all help me, and tell me how to add a health system using the contact force? Basically I want the player's police car to hit the suspect AI car to subdue the suspect by hitting the suspect multiple times, such that the force gets added up to a set value. So, I still want -
if(IN_0 >= force) { iObjectShow(OBJ_66) } if(IN_0 >= force) { iObjectStart(OBJ_88) }
Any suggestions and help will be appreciated!!!
First thing i noticed, you don't need 2 or more separate if() statements when they are the same.. just add them together like i've done below. if(IN_0 >= force) { iObjectShow(OBJ_66); iObjectStart(OBJ_88); }
|
|