Page 2 of 2

Posted: Tue Mar 25, 2003 2:23 am
by bdbodger
rotatez 325 rotates an object at a speed of 325 degrees a second

rotatezupto 325 rotates an object to an angle of 325 degrees from it's 0 angle on the axis used

rotatezup 325 rotates an object 325 degrees from it's current angle

you don't need to set the speed if you use rotatez so the second line is only if you are rotateing up upto down or downto where the rotation is to an angle .

Posted: Tue Mar 25, 2003 11:07 pm
by nuggets
lol, ahh nevermind just ignore me :P

Posted: Wed Mar 26, 2003 7:46 am
by bdbodger
ok I rechecked my script and it uses time not speed so I changed it to speed . hmm didn't work the same it seemed that speed didn't work for me at least not for rotation anyway . I don't know it may be a spearhead thing . I think I used speed before in a mohaa map . Or it maybe that speed is for the moveto command and not for rotation hmm I'll post and see if anyone knows .

Posted: Wed Mar 26, 2003 11:37 am
by tltrude
I have no Idea if this will work or not, but here is what I have so far.......

Speed does not work for rotating things. Use time and set the number to how long it takes to rotate the degrees set. However there is a limit on how fast your prop can turn because of people's frame rates.

Make your prop and it's center script_origin a single script_object with one targetname ($prop). Also do the same for your control lever ($teststand_lever). Then place a trigger_use over your lever and give it a targetname as well ($teststand_trigger).

Code: Select all


level waittill prespawn

	level.lever_set_time = 150 // tenths of a second	
	level.propeller_speed = 0
	level.leverpos = 0
	thread teststand_waittill_startup
end


teststand_waittill_startup:

while ( $teststand_trigger )
{
$teststand_trigger waittill trigger

	local.player = parm.other
	//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
        if (local.player.dmteam == level.planting_team) 
	{
		goto teststand_waittill_set
		println "failed dmteam check" local.player.dmteam	
	}
	level.leverpos = 0
	while ( (Isalive local.player) && ($local.player cansee $teststand_trigger 30 128) && (local.player.useheld == 1) )
	{
		if (level.leverpos == 0)
			local.player stopwatch (level.lever_set_time * .1)
			
		level.leverpos++
		$test_stand_lever rotateXup 1
		level.propeller_speed == (level.propeller_speed + 1)
		$prop rotateZup ( (24 * (level.propeller_speed) )

		wait .1
		if (level.leverpos >= 15)
		{
			iprintlnbold "The propeller is turning at full speed!"
			thread teststand_waittill_shutoff
			end
		}
	}
	if (local.counter > 0)
		local.player stopwatch 0
}
end

level.planting_team has to be set in prespawn--as it does in any objective match script.

Posted: Sat Apr 05, 2003 3:53 pm
by solar
Ok, I know this is long time since a reply but I finally worked out a few of my problems and had a chance to try this out. Tom, if you're out there please respond.

I tried this script and I can't get it to work. The prop doesn't rotate and the lever doesn't trigger. My script is below and I have omitted a couple threads because they are unrelated, but if you think they might be the problem, let me know and I'll put my entire ecript in.

scipt:
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"




level waittill prespawn




//teststand precache
level.lever_set_time = 150 // tenths of a second
level.propeller_speed = 0
level.leverpos = 0
thread teststand_waittill_startup
end




//***Precache Dm Stuff
exec global/DMprecache.scr
level.script=maps/obj/cust_obj_test.scr
exec global/ambient.scr cust_obj_test
thread global/exploder.scr::main

level waittill spawn


//obj setup
level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast

// Set the parameters for round based match
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

// level waittill roundstart // Comment out this line using '//' before it to be able to set the bomb when alone on the map ( just for testing )

$panel_bomb thread global/obj_dm.scr::bomb_thinker // "panel_bomb" is the targetname set on the bomb in MOHRadiant
thread allies_win_bomb // Start the win check thread for allies
$panel_bomb thread axis_win_timer // Start the win check thread for axis
end // end of main

// Allied victory test


allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) // While undestroyed objectives left
waitframe // chill out
teamwin allies // No objectives left allies win
end // end allied victory test

// Axis victory test


axis_win_timer:
level waittill axiswin // At the end Axis win
end // end axis victory test







//------------------------
//test stand prop rotation
//------------------------

teststand_waittill_startup:

while ( $teststand_trigger )
{
$teststand_trigger waittill trigger

local.player = parm.other
//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
if (local.player.dmteam == level.planting_team)
{
goto teststand_waittill_set
println "failed dmteam check" local.player.dmteam
}
level.leverpos = 0
while ( (Isalive local.player) && ($local.player cansee $teststand_trigger 30 128) && (local.player.useheld == 1) )
{
if (level.leverpos == 0)
local.player stopwatch (level.lever_set_time * .1)

level.leverpos++
$test_stand_lever rotateXup 1
level.propeller_speed == (level.propeller_speed + 1)
$prop rotateZup ( (24 * (level.propeller_speed) )

wait .1
if (level.leverpos >= 15)
{
iprintlnbold "The propeller is turning at full speed!"
thread teststand_waittill_shutoff
end
}
}
if (local.counter > 0)
local.player stopwatch 0
}
end
I'm wondering with my limited scripting experience, if the "end" command is what is screwing me up, because I have that at the end of my other threads that I haven't included. Does that matter or do you only want one "end" command in the script??

Posted: Sat Apr 05, 2003 4:54 pm
by jv_map
An end ends the current thread. You need one end for every thread you make.

If you put ends in the middle of your script, the script stops running in the middle of it. So get rid of that end.

Posted: Sun Apr 06, 2003 3:27 am
by solar
Are you saying you have to put an end command at the end of every thread section? Ah, screw it. This is my script as it stands now. I think maybe I just don't have things in the right order:

script:
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" ""
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none

level waittill prespawn

//hangar door timing
$hangardoor1 time 4 // travel time in seconds
$hangardoor2 time 4
$hangardoor3 time 4
$hangardoor4 time 4
thread hanger_doors
//stop timing

//teststand precache
level.lever_set_time = 150 // tenths of a second
level.propeller_speed = 0
level.leverpos = 0
thread teststand_waittill_startup
end

thread bindall

//***Precache Dm Stuff
exec global/DMprecache.scr
level.script=maps/obj/cust_obj_test.scr
exec global/ambient.scr cust_obj_test
thread global/exploder.scr::main

level waittill spawn

//obj setup
level.defusing_team = "axis" // Axis like the bombs unplanted
level.planting_team = "allies" // Allies will try to plant the bombs
level.targets_to_destroy = 1 // Number of targets in this map
level.bomb_damage = 200 // Default damage of the bomb
level.bomb_explosion_radius = 2048 // Default radius of bomb blast

// Set the parameters for round based match
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw

// level waittill roundstart // Comment out this line using '//' before it to be able to set the bomb when alone on the map ( just for testing )

$panel_bomb thread global/obj_dm.scr::bomb_thinker // "panel_bomb" is the targetname set on the bomb in MOHRadiant
thread allies_win_bomb // Start the win check thread for allies
$panel_bomb thread axis_win_timer // Start the win check thread for axis
end // end of main

// Allied victory test

allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) // While undestroyed objectives left
waitframe // chill out
teamwin allies // No objectives left allies win
end // end allied victory test

// Axis victory test

axis_win_timer:
level waittill axiswin // At the end Axis win
end // end axis victory test

//door window binding
$window2 thread windowoperate
end

//------------------------------
// Hanger doors thread
//------------------------------

hanger_doors:
$hangardoor_trigger waittill trigger
$hangardoor_trigger remove
$hangardoor_switch anim turn
$hangardoor_switch playsound alarm_switch
$hangardoor1 loopsound lighthouse_run
$hangardoor4 loopsound lighthouse_run

$hangardoor2 moveWest 336
$hangardoor2 move
$hangardoor3 moveEast 336
$hangardoor3 move

wait 4

$hangardoor2 moveWest 336
$hangardoor2 move
$hangardoor3 moveEast 336
$hangardoor3 move
$hangardoor1 moveWEst 336
$hangardoor1 move
$hangardoor4 moveEast 336
$hangardoor4 waitmove

$hangardoor1 loopsound lighthouse_run wait
$hangardoor4 loopsound lighthouse_run wait

end

//-------------------------
// binding of door windows
//-------------------------

bindall:
$window2 solid
$window2 bind door2
$window2.target hide
$window2.target notsolid
$window2.target bind door2
end

windowoperate:
self waittill trigger
self playsound snd_glass_shatter1
self hide
self notsolid
self.target show
end

//------------------------
//test stand prop rotation
//------------------------

teststand_waittill_startup:

while ( $teststand_trigger )
{
$teststand_trigger waittill trigger

local.player = parm.other
//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
if (local.player.dmteam == level.planting_team)
{
goto teststand_waittill_set
println "failed dmteam check" local.player.dmteam
}
level.leverpos = 0
while ( (Isalive local.player) && ($local.player cansee $teststand_trigger 30 128) && (local.player.useheld == 1) )
{
if (level.leverpos == 0)
local.player stopwatch (level.lever_set_time * .1)

level.leverpos++
$test_stand_lever rotateXup 1
level.propeller_speed == (level.propeller_speed + 1)
$prop rotateZup ( (24 * (level.propeller_speed) )

wait .1
if (level.leverpos >= 15)
{
iprintlnbold "The propeller is turning at full speed!"
thread teststand_waittill_shutoff
end
}
}
if (local.counter > 0)
local.player stopwatch 0
}
end

Also, this error message is in the console. What does this mean???

error message:
bad token:
TOKEN_EQUALITY:
==

level.propeller_speed == (level.propeller_speed + 1) (maps/obj/daimbenz2.scr, 172)
level.propeller_speed ^

^~^~^ Script file compile error: Couldn't parse 'maps/obj/daimbenz2.scr'
ScriptMaster::GetScript: Script 'maps/obj/daimbenz2.scr' was not properly loaded

Posted: Sun Apr 06, 2003 6:08 am
by jv_map
//teststand precache
level.lever_set_time = 150 // tenths of a second
level.propeller_speed = 0
level.leverpos = 0
thread teststand_waittill_startup
end //<-- get rid of this

== <--- token_equality, evaluates to 1 or 0
Use in conditions (if, while or for)
if(local.a == 5)

= <--- token_assignment, use to assign a value to a variable
Use in calculations
local.b = local.a + 8

So in your case,
level.propeller_speed == (level.propeller_speed + 1)
should have been
level.propeller_speed = (level.propeller_speed + 1)
or just
level.propeller_speed++ // <-- adds one

Posted: Sun Apr 06, 2003 12:33 pm
by solar
Thx, jv_map, and thx for not making it so easy- that way I wouldn't learn anything. I've done very little c++ study and your explanation of the token equality makes sense. I have one other question that I can't find an answer for in the search engine. Some of the commands in the script such as "$test_stand_lever rotateXup 1" have the "$" in front of them but their targetname in the k/v pair does not have that. Is that correct? I think that symbol means string doesn't it?

Posted: Sun Apr 06, 2003 1:34 pm
by jv_map
The $ means 'entity with this targetname'.

Therefore the entity doesn't need the $ in the key/value pair.

The (Morpheus <-- that's what it's called) scripting language doesn't use any special signs to cast values to data types. It's not QBasic ;)

Posted: Mon Apr 07, 2003 6:12 pm
by nihilo
not sure how much of an effect this has, but in your script:

Code: Select all

}  // <--- Change this one
if (local.counter > 0) 
local.player stopwatch 0 
} 
The two closing brackets may cause an error. My scripting knowledge is limited, but in my experience compilers are picky about things like that.

two

Posted: Tue Apr 08, 2003 5:12 am
by tltrude
There should be two because one is for the "if" action and the other is for a "while" action that the "if" statement is in.

BTW, I'm still not sure that script will work because I'm not sure how to change rotation speed. I do know that increasing the time makes it rotate slower, but decreasing it below 1 does not seem to make it go any faster.

Maybe you should just stick with a one speed propeller. If you want to send me the map/script, I'll be happy to look it over for ya.