Gravity

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Gravity

Post by Dani »

Is it possible to have a lever and when you pull it the grravity flips???
Angex
Major
Posts: 293
Joined: Mon Dec 30, 2002 1:23 pm
Contact:

Post by Angex »

Well the g_allclasses has a gravity attribute for the worldspawn, so I guess you can use that, but it doesn't give any ranges so you'll have to play around with it:
g_allclasses.html wrote:gravity( Float worldGravity )

Set the gravity for the whole world.
E.G.

Code: Select all

$world gravity 1.0
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

cool ,that never came to mind :D ,id love to try it out when ur map is done dani :wink:
Image
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

don't use 1.0, that should give you virtually 0 gravity, gravity 800 is default. Or around the neck of the woods. :wink:
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I hear that $world gravity is about 800 but while working with physics I found that a setting of 1 is normal gravity when setting the gravity of an entity . I guess that is 100% of the worldgravity setting of 800 .
Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Thanks for all ur help guys, but the thing is i don't even know how to make a lever. Let alone make it do nething, could u guys give me som hints of were i can find this out?
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

im nothing close to a scripter ,but i can tell u theoritically what u need .
1st of all u need a basic grasp of scripting which is all i know :D .
here are all the tuts on .map
check them out ,specially the script language ones .

there are several types of levers ,so choose one (from animate_equipment) and place it in ur map and give it a targetname (lever for example) .i choose alarmswitch
then put a trigger_use over it and give this one a target name too (lever_trigger for example.)

then type the following code in ur .scr file for ur map

Code: Select all

no_gravity_thread:
$lever_trigger waittill trigger
$lever anim on //this turns the switch animation on 
$lever playsound alarm_switch
$world gravity 1.0

$lever_trigger waittill trigger
$lever anim off //this turns the switch animation off
$lever playsound alarm_switch
$world gravity 800 //if thats the default value .
goto no_gravity_thread
this should make it turn on or off or on again ;)
if u want the player to wait for a while b4 turning it off again then put

Code: Select all

wait //and number of seconds here
in the empty line i left ;)



*cool ,my 1st piece of thought up script *

something might be wrong with it but im sure some1 might come and save the day
Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Wow thx m8! :D Great. Cos i know how to do action script Very well (macromedia flash programing). I am full of good ideas i just don't know how to make em.
:wink: Thx again

A few mins l8er:
Soz m8 it didn't work :( maybe next time
Last edited by Dani on Fri Jul 23, 2004 7:25 pm, edited 1 time in total.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

well,i hope it works :D it is my 1ST thought up script ,used to just copy paste b4 ;) .

check out the tuts i told u about ,specially the script language ones .u can do alot of things in mohaa if u know script (unfortunatly i dont know much )
Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Sorry m8 it didn't work, the lever didn't animate and nothing happened. Sorry :(
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

darn .it was a nice try though :D ,im sure some1 would come and save the day *nervously looking around*

edit:
oops .i think u might have forgotten to activate the thread .i kinda skipped that part ,maybe this is the problem ?

u stick the peace of script i told u somewhere at the end (u do have a base .scr file i am assuming )

then put

Code: Select all

thread no_gravity_thread
somewhere b4 waittill spawn and after waittill prespawn
Image
Post Reply