|
Re: Script Factory
[Re: JazzDude]
#127652
05/03/07 00:23
05/03/07 00:23
|
Joined: Aug 2002
Posts: 572 Toronto
MadMark
User
|
User
Joined: Aug 2002
Posts: 572
Toronto
|
Okay, here comes one that I haven't been able to figure out for the life of me.
I have a spaceship model, and I move it through my level. When it gets to within 100 quants of the outside of a planet model, I would like it to orbit the planet, left to right, facing slightly towards the planet. I would like it to continue orbitting the sphere and present a menu to the player, allowing key input or mouse clicks on the menu, until the "X" key is pressed. Once pressed, the menu should disappear, the ship should smoothly turn away from the planet, escape orbit by 50 quants, and return steering to the player.
Problems that I have had are that the spheres are different sizes, and everything that I do seems to focus on the origin of the sphere and not its perimeter. I either end up inside the planet model, or way too far away.
Might be too much, but hey, you asked!
Cheers Mark
People who live in glass houses shouldn't vacuum naked.
|
|
|
Re: Script Factory
[Re: MadMark]
#127653
05/03/07 01:06
05/03/07 01:06
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
lol, try using the min_x/max_x for finding the size, and then add an offset to it.
offset = 100; distance = (my.max_x - my.min_x)/2 + offset;
This will return the distance [radius] from the origin of the model to use...
xXxGuitar511 - Programmer
|
|
|
Re: Script Factory
[Re: Blink]
#127655
05/03/07 05:18
05/03/07 05:18
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
i also have a request, do you know how to do a quake3 style cheat code input system?
- aka Manslayer101
|
|
|
Re: Script Factory
[Re: Realspawn]
#127657
05/03/07 11:51
05/03/07 11:51
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
@Loopix: Something like this should do it Code:
define hours_a_day, 24; define days_a_month, 30; define months_a_year, 12;
define time_offset, 6;
var time_hour; var time_day; var time_month; var time_year;
function TimeCounter() { var check; while(1) { while(1) { time_hour = sun_angle.pan/(360/hours_a_day); time_hour += time_offset; time_hour %= hours_a_day; if(time_hour > 0.9){check = 1;} if(time_hour < 0.5 && check){check = 0; break;} wait(1); } time_day += 1; if(time_day == days_a_month) { time_day = 0; time_month += 1; if(time_month == months_a_year) { time_year += 1; time_month = 0; } } wait(1); } }
@Manslayer101: I don´t know either what you mean with quake3 style...
|
|
|
Re: Script Factory
[Re: Slin]
#127658
05/03/07 12:45
05/03/07 12:45
|
Joined: May 2005
Posts: 2,713 Lübeck
Slin
OP
Expert
|
OP
Expert
Joined: May 2005
Posts: 2,713
Lübeck
|
@Blink: Try this Code:
function Shield() { my.passable = on; my.transparent = on; my.red = 0; my.green = 0; my.blue = 255; my.light = on; you = my.parent; vec_set(my.scale_x,you.scale_x); vec_scale(my.scale_x,my.skill3); var MaxEnergy; MaxEnergy = my.skill1; var Temp1; while(you) { vec_set(my.x,you.x); vec_set(my.pan,you.pan); if(you.skill2 > 0){my.skill1 += min(my.skill1+you.skill2,MaxEnergy); you.skill2 = 0;} if(you.skill1 < 100 && my.skill1 > 0) { my.alpha = my.skill2; Temp1 = min(my.skill1,100-you.skill1); my.skill1 -= Temp1; you.skill1 += Temp1; } if(my.alpha > 0){my.alpha -= time_step;} wait(1); you = my.parent; } }
string ModelFileName; function Shield_Activate(Pointer,ShieldEnergy,ShieldAlpha,ShieldScale) { you = Pointer; if(you) { str_for_entfile(ModelFileName,you); you = ent_create(ModelFileName,nullvector,Shield); you.parent = Pointer; you.skill1 = ShieldEnergy; you.skill2 = ShieldAlpha; you.skill3 = ShieldScale; } }
Add this at the top of the plBiped01.wdl (make a backup of that file before...) and write this at the end of the action PlBiped01: Shield_Activate(my,100,40,1.13); The players armor is the shield enegy to start with. I wasn´t able to test this so if you get any errors, just post your error message here.
|
|
|
|