My script isnt working for some reason...

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

My script isnt working for some reason...

Post by HDL_CinC_Dragon »

Heres the .scr which i wrote in NotePad:

Code: Select all

main:


	level waittill prespawn



//thread ArtySupport
//	local.player = parm.other
//	local.ArtyShell = spawn script_model "targetname" "Arty_Shell"
//	local.ArtyShell model "animate/fx_mortar_dirt.tik"
//	local.ArtyShell.origin = local.player.origin
//	local.ArtyShell.angles = ( 0 0 0 )
//	local.ArtyShell.scale = 1

thread CoronaOps
	$Corona hide
	$CoronaLight light 1 0 0 350


	level waittill spawn


CoronaOps:
while(1)
{
	$CoronaShow waittilltrigger
	$Corona show
	$CoronaLight lighton
	wait 1
	$Corona hide
	$CoronaLight lightoff
	$CoronaShow triggerable
	waitframe
}
end



//ArtySupport:
//while(1)
//{
//	$Bridge waittill trigger
//	$Bridge nottriggerable
//	local.player = parm.other
//if (local.player.dmteam == "axis")
//	{
//		local.player stufftext "say OMG! They have artillary protecting the Bridge!"
//		wait 2
//		Arty_Shell anim start
//		local.player hurt 9999
//	}
//	watiframe
//	$Bridge riggerable
//}
//end
Am i missing something here?
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

you need an end for main, it's falling through and doing everything then fnd an end and doesnt do...

just put an end before CoronaOps :P
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

Code: Select all

main: 


   level waittill prespawn 

//thread ArtySupport //<--set variables before calling thread
 
//   local.player = parm.other 
//   local.ArtyShell = spawn script_model "targetname" "Arty_Shell" 
//   local.ArtyShell model "animate/fx_mortar_dirt.tik" 
//   local.ArtyShell.origin = local.player.origin 
//   local.ArtyShell.angles = ( 0 0 0 ) 
//   local.ArtyShell.scale = 1 

   $Corona hide
   thread CoronaOps 

   level waittill spawn 

end

CoronaOps: 
while(1) 
{ 
   $CoronaShow waittill trigger 
   local.player = parm.other 
   $Corona show 
   $CoronaLight light 1 0 0 350
   while (local.player istouching $CoronaShow)
         wait .1 
   $Corona hide 
   $CoronaLight light 0 0 0 100
// $CoronaShow triggerable 
   waitframe 
} 
end 



//ArtySupport: 
//while(1) 
//{ 
//   $Bridge waittill trigger 
//   $Bridge nottriggerable 
//   local.player = parm.other 
//if (local.player.dmteam == "axis") 
//   { 
//      local.player stufftext "say OMG! They have artillary protecting the Bridge!" 
//      wait 2 
//      Arty_Shell anim start 
//      local.player hurt 9999 
//   } 
//   watiframe 
//   $Bridge triggerable //<--missing T
//} 
//end

Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

Thanks Tom!

Also, theres an error in the script when i try to run all the Arty stuff. Can you tell me what the problem is? I simply copied and pasted the script you provided me. Perhaps theres a problem with my local.player = parm.other stuff? i have it twice in the script, once in the prespawn and once in the spawn under ArtySupport:

~EDIT~
I made it so that the $Arty_Shell blows up after i walk off of the trigger but i set the origin to a fixed 0 0 50.

Now attempting to get it at players position...

~EDIT~
Apparently the local.ArtyShell is ignoring local.ArtyShell.origin completely. I just realized that no matter what i set the origin to, its always at 0 0 0.

Attempting to fix origin register problem

~EDIT~
Ok i got it to work using the local.ArtyShell.origin and it now blows up on cue. BUT, it always blows up where the player walked into it rather than where they are at the time, so i enter the trigger on side A and exit on side B but side B blows up. If i enter on side A and exit one side A, side A blows up, so it definatly is blowing up where the player triggered it from.

Attempting to correct...

~EDIT~
Ok now i dont understand it at all... I walked onto the bridge and then jumped off the side and it blew up where i had stepped onto the bridge. I then killed myself via Console "kill", respawned, walked back onto the bridge, walked off the other side normally, and it blew up where i had jumped off...

~EDIT~
Ok, the first series of numbers is My origin and the second series of numbers is the $Arty_Shell origin:

Code: Select all

0) (41.609283, 144.696930, 0.125002) | (0.000000, 0.000000, 0.000000) // (My origin at triggering | $Arty_Shells origin at triggering)
1) (27.189257, -154.028152, 0.124998) | (27.189257, -154.028152, 0.124998) // (My origin at trigger release | $Arty_Shells origin at trigger release)
P.S. I deleted all my old codes from the post becase they were just extra spam takeing up space in here...
P.P.S A very nice electrical storm just kicked up (Lighting and thunder)

~EDIT~
Ok i better get to bed, i have to wake up in 3 and a half hours...
Code so far...

Code: Select all

main:

   level waittill prespawn

   local.ArtyShell = spawn script_model "targetname" "Arty_Shell"
   local.ArtyShell model "animate/fx_mortar_dirt.tik"
   local.ArtyShell.angles = (0 0 0)
   local.ArtyShell.scale = 1
   level.count = 0 //integer to count how many times the explosion takes place
   $Corona hide
   thread CoronaOps

   level waittill spawn

end

CoronaOps:
while(1)
{
   $Bridge waittill trigger
   local.player = parm.other
   $Corona show
   $CoronaLight light 1 0 0 350
   iprintln (level.count + ") " + local.player.origin + " | " + $Arty_Shell.origin)
   while (local.player istouching $Bridge)
{
         waitframe
}
   $Arty_Shell.origin = local.player.origin
   $Arty_Shell anim start
   level.count ++ //add one to the current value of level.count
   iprintln (level.count + ") " + local.player.origin + " | " + $Arty_Shell.origin)
   $Corona hide
   $CoronaLight light 0 0 0 100
   waitframe
}
end
What the script does:
When i step into the triggerMultiple labled "Bridge" it prints out a message on the left hand side of the screen telling me My origin and the explosions origin but it doesnt show the explosion yet, Then when i step out of the triggerMultiple it prints out the same message only my origin and the explosions origin are a little more updated and it also shows the explosion.
Current standing errors:
Although the explosion origin is a little more updated when I exit the trigger multiple it is always one step behind me rather than right on me when i exit the trigger.
Last edited by HDL_CinC_Dragon on Mon Apr 24, 2006 6:36 am, edited 2 times in total.
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

Ok well i just finished with my last update in the above reply ^
Ill continue working on it tomarrow...


Goodnight everyone!
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

When the line "local.player = parm.other" is read by the script, the parameters of the player touching the trigger are assigned to the variable "local.player". In other words, the player's origin is recorded just after he first touches the trigger. So, if you want his parameters recorded again, you will need to repeat the "local.player = parm.other" line after he leaves the trigger.

Another way to do it would be to bind the arty shell to the local.player as he enters the trigger.

Code: Select all

main: 

   level waittill prespawn 

   local.ArtyShell = spawn script_model "targetname" "Arty_Shell" 
   local.ArtyShell model "animate/fx_mortar_dirt.tik" 
   local.ArtyShell.angles = (0 0 0) 
   local.ArtyShell.scale = 1 
   level.count = 0 //integer to count how many times the explosion takes place 
   $Corona hide 
   thread CoronaOps 

   level waittill spawn 

end 

CoronaOps: 
while(1) 
{ 
   $Bridge waittill trigger 
   local.player = parm.other
   $Arty_Shell.origin = local.player.origin 
   $Arty_Shell bind local.player
   $Corona show 
   $CoronaLight light 1 0 0 350 
   iprintln (level.count + ") " + local.player.origin + " | " + $Arty_Shell.origin) 
   while (local.player istouching $Bridge) 
{ 
         waitframe 
} 
   $Arty_Shell playsound arty_leadinmp1 // whistling sound
   wait .5
   $Arty_Shell anim start
   radiusdamage $Arty_Shell 250 192  // damage and radius
   $Arty_Shell unbind local.player
   waitexec global/earthquake.scr .3 1.5 0 0 // may not need both
   waitexec global/earthquake.scr .35 .75 0 0
   level.count ++ //add one to the current value of level.count 
   iprintln (level.count + ") " + local.player.origin + " | " + $Arty_Shell.origin) 
   $Corona hide 
   $CoronaLight light 0 0 0 100 
   waitframe 
} 
end
I guess I still don't understand what you are trying to do. If the objective of the thread is to keep players off the bridge, why not just use a minefield?
Tom Trude,

Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

Ah great idea Tom! I should have thought of that!

The reason this map seems pretty dumb is because its simply teaching me to get this kind of thing down so i can apply it to a much better map. Once i work out the kinks and learn the script i will begin working on a better map.

I am at school right now :x :cry: so i cant work on it yet but when i get home i will work on it. Thanks again!
Image
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

Ok ive given up on the Arty shell hitting directly on the player, instead i just have it hitting the center of the little bridge with enough radius to kill the user

Now im working on getting a flak 88 to aim at the player, fire, and then go back to its normal position...
Image
Post Reply