Sending player to spec

Post your scripting questions / solutions here

Moderator: Moderators

sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

arrays seemed pretty simple to understand think its more like the using of while, for, and if. They were explained and look very simple. guess not paying enough attention to them. I do appriecate the help and hope that you understand that I am not trying to use your work but trying to understand it so that I will be able to learn from it. Thats is why I am going through and figuring out what ever line actually means. Not just copying and pasting it.

The part that has me confused I guess is this:


for (local.i = 1; local.i <= $player.size; local.i++)

my guess is loca.i is player number $player.size has me really confused
Last edited by sdlall on Tue Apr 21, 2009 9:55 pm, edited 1 time in total.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

There are some things about arrays that are probably not mentioned.
Check this out:
/forum/viewtopic.php?t=13428&start=9

If you cannot read scripts like newspapers, I can imagine you're having a really hard time with all the ifs, whiles, switches and fors.

The best way to understand something is to use it yourself. Try making scripts with for statements and arrays and I can assure you, you will understand and probably use them quite extensively yourself.

I did the same thing, I made a 23kb script full of for statements, arrays and strings (as in "a word"). The script itself was pointless, no use for it but I learned to use arrays/for statements/... and I learned it well. I have been using for statements and arrays all the time since then.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Well bro you are and have been for sometime one of the best script writers in the game. I am just mad that I am just now learning. Going to go study up on all this and again thank you for all the help. Will let you know in day or so how it all has worked out but need to do some reading before testing all this. So I understand how it works not that it just works.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Thank you, even though I haven't released many scripts nor mods.
But I appreciate and admire the effort you put in understanding the help given to you instead of blindly copying and using it.

I'm just glad there are still a few (new) scripting enthusiasts out there. It would be a shame to lose them. If you need any help or explanations, give a shout.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Yeah, for noobs like myself at scripting, this site and TMT are great for learning. Everytime I try making a mod of my own, I usually end up asking for help, and Sor swoops in to save the day. lol
HeavenBound

I'm new at this :)
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

sorry so late on getting back to you but have been reading your tuts on medalofhonor filefront. excellent job btw on those. learning alot from them. script works great. only found one problem and that was when i was testing it i had fire for effect mod on and was off by like 1 or 2 kills. close enough for me and took that mod off to go back to silent pistols. so again thank you. back to reading
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

sorry so late on getting back to you but have been reading your tuts on medalofhonor filefront. excellent job btw on those. learning alot from them. script works great. only found one problem and that was when i was testing it i had fire for effect mod on and was off by like 1 or 2 kills. close enough for me and took that mod off to go back to silent pistols. so again thank you. back to reading
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Thank you, even though I wrote those when I scripted for only a month. You could say I was a newbie back then. Hence the tutorial has some small mistakes. Don't worry, they aren't relevant to you but if you (want to) advance, you might need to know what's really correct. For example, the "waittill" explanations are wrong. They were told to me back then but I had to found out myself it works differently.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Ah found glitch in the script and not sure what is causing it. When spectating someone it causes the view to be jumpy. Also, allows the walls to be shot through.

Here is how I set it up. Not sure if it is setup or script it self.

1. I put the killed_player.scr in global folder
2. executed in from DMpreache
3. put

Code: Select all

spec_kick: 

        while(1) 
        { 
               for (local.i = 1; local.i <= $player.size; local.i++) 
               { 
                       if ($player[local.i].killcount != NIL && $player[local.i].dmteam != "spectator" && $player[local.i].killcount >= 6) 
                       { 
                                 $player[local.i] iprint "You have reached the 60 kill max for this map!" 1 
                                 $player[local.i] spectator
				 Wait 5
                                 $player[local.i] iprint "You will be allowed to rejoin next map!" 1
                                 wait 0.3 
                       } 
                 } 
  
               wait 1.5 
          } 

end
at bottom of the map.scr
4. put thread spec_kick after exec global/dmpreache and before level waittill spawn

Ran server on stock maps this way with no other mods on and this problem still is there. Any ideas?
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

This isn't really a solution, and idk if thats what is really in the script...but you have

Code: Select all

$player[local.i].killcount >= 6)
This may not help, but shouldn't it be 60?
HeavenBound

I'm new at this :)
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

ah 6 was just testing number. it counts pretty close so counting isnt problem. just soft walls and jumpy spec This the actually script I used sorry put wrong one in at top.

Code: Select all

spec_kick: 

        while(1) 
        { 
               for (local.i = 1; local.i <= $player.size; local.i++) 
               { 
                       if ($player[local.i].killcount != NIL && $player[local.i].dmteam != "spectator" && $player[local.i].killcount >= 60) 
                       { 
                                 $player[local.i] iprint "You have reached the 60 kill max for this map!" 1 
                                 $player[local.i] spectator
				 Wait 5
                                 $player[local.i] iprint "You will be allowed to rejoin next map!" 1
                                 wait 0.3 
                       } 
                 } 
  
               wait 1.5 
          } 

end
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

I have seen the bumby spectator view before but I can't seem to find an exact cause nor solution for it... I'll do some more tests.

However I never encountered being able to shoot through walls???
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Ja for some reason it has caused soft walls. Like I said stripped server down and put that scr in some stock maps and went in and tested it. You could shoot right through the walls. Then took that out went back in and tried shooting through same walls. Walls were hard then. I am thinking it has to do with.

Code: Select all

//Based on giffe's death detection 
setup_kill: 

   if(self.detect != NIL && self.detect != NULL) 
   { 
      self.detect remove 
   } 

   self.detect = spawn trigger_multipleall "spawnflags" "128" 
   self.detect.origin = self.origin 
   self.detect.angle = self.angle 
   self.detect setthread killed 
   self.detect glue self 
   self.detect.player = self 
   self.detect.team = self.dmteam 
   self.detect.alive = 1 
   self.detect.attacker = NIL    
   self.detect setsize ( -17 -17 0 ) ( 17 17 92 ) 
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Okay, this'll solve the bumpy view. I just tested the 'shooting' through walls with special decals which I can see very clearly and I concluded I can only shoot through doors not walls... Good thing you notified me about this, I'm using a very similar method and I'll try to fix it.

Code: Select all

spec_kick:

        while(1)
        {
               for (local.i = 1; local.i <= $player.size; local.i++)
               {
                       if ($player[local.i].killcount != NIL && $player[local.i].dmteam != "spectator" && $player[local.i].killcount >= 60)
                       {
				$player[local.i] thread killset
                                wait 0.1
                       }
		       if ($player[local.i].dmteam == "spectator" && self.detect)
                       {
                            self.detect delete
                       }
               }
 
               waitframe
          }

end

killset:

       self iprint "You have reached the 60 kill max for this map!" 1
       self spectator
       Wait 5
       self iprint "You will be allowed to rejoin next map!" 1
       wait 0.3
end
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
sdlall
Sergeant Major
Posts: 110
Joined: Tue Mar 24, 2009 11:41 pm

Post by sdlall »

Was my above setup like yours? (Look several posts back to see it)

Yeah I will try this out. I know of several places that the walls were being shot through so will test for that to. I appreciate you testing it for me.
Post Reply