Lost + found

Post your scripting questions / solutions here

Moderator: Moderators

SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

humm yes I was thinking at removeclass as last resource..
Well I could try to spawn explosions close to the origin of each window..could this work? :?
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

switch to primary weapon

Post by SilentAngel »

I have a mod that take away all weapons when spawn and give you a sniper rifle..but when doing this the player born without the weapon in his hands...is possible to make him pull the rifle automatically?
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

ahah I forgot to add "self use..."
now it works...
WHAT A USELESS POST! :roll:
BatteryAziz
Moderator
Posts: 82
Joined: Tue Jun 15, 2010 4:44 pm

Post by BatteryAziz »

explosions is the easiest way i guess. it's hard to call the windows by script when they don't have targetnames etc.
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

access object via entity number...

Post by SilentAngel »

Is it possible?
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

You can only kill or delete entities by number.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

So no way to open a door knowing the entity number of the func_rotatingdoor of it has no targername? :/ ..so sad..
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

What about hex editing bsp adding a targername?? Or maybe removeclass to remove all func_rotatingdoor and then spawn them via scripting again but giving them a targername too?...
Lost1
Private
Posts: 3
Joined: Sat Nov 19, 2011 9:46 am
Location: Florida

wass up...lol

Post by Lost1 »

ok been scratching my butt for 3 weeks messing with this thing.I've been reading posts and searching all day. Now I'm going to act like a woman and just ask.
I'm trying to get this thing to work, what I want to do is have the scr checks what map is running then exec 2 scr's. for each map, heres part of the code

Code: Select all

main:

thread  messages

end

level waittill prespawn

messages:

        level.mapname = getcvar (mapname)
	switch (level.mapname)

	{
		case "dm/mohdm1":
        
		      exec global/messages/rifle.scr
                     // exec global/weapons/rifle.crp	
end
        }
                case "dm/mohdm2":
			exec global/messages/sniper.scr
                        //exec global/weapons/sniper.crp			
end
        {
now heres the thing if I leave the // in front of exec global/weapons/rifle.crp it will show the messages for each map.But if I try to get it to exec the weapons.crp also game hangs up.

I have it working on my server by adding the exec global/messages/sniper.scr and exec global/weapons/sniper.crp
to the mam mapfixes scr where the map fixes are at, Also will work if I add the exec's to the map.scrs. but I would like to get it to work whitout useing the mam files. A stand alone mod. Any Ideas? Oh and I know I can download a weapons limiter .
To err is human...to forgive devine...niether is Marine Corps Policy
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Ok..just some suggestions..
I'm with the phone so i Try to write less possible :)
Insert level waittill prespawn inside main and use break instead of end inside switch sentences..also you closed curly brackets when not necessary..just use one to open switch and one to close it! However it's a Good idea to post console result too. It's a useful debugging tool ;)
Lost1
Private
Posts: 3
Joined: Sat Nov 19, 2011 9:46 am
Location: Florida

Post by Lost1 »

Ok I did this

Code: Select all

///////////////////////////////////////////
//////// Lets the maps give weapons  //////
//////////////////////////////////////////

main:
thread  messages
level waittill prespawn
end
messages:
 level.mapname = getcvar (mapname)
 switch (level.mapname)

     {

      case "dm/mohdm1":
exec global/messages/rifle.scr
exec global/weapons/rifle.crp

break
      case "dm/mohdm2":
exec global/messages/sniper.scr
exec global/weapons/sniper.crp

break
      case "dm/mohdm3":
exec global/messages/nr.scr
exec global/weapons/nr.crp

break
     case "dm/mohdm4":
exec global/messages/sniper.scr
exec global/weapons/sniper.crp

break
      case "dm/mohdm5":
exec global/messages/nr.scr
exec global/weapons/nr.crp

break
     case "dm/mohdm6":
exec global/messages/rifle2.scr
exec global/weapons/rifle2.crp

break
      case "dm/mohdm7":
exec global/messages/mp44.scr
exec global/weapons/mp44.crp

break
      case "obj/obj_team1":
exec global/messages/nr.scr
exec global/weapons/nr.crp

break
      case "obj/obj_team2":
exec global/messages/shotgun.scr
exec global/weapons/shotgun.crp

break
     case "obj/obj_team3":
exec global/messages/sniper.scr
exec global/weapons/sniper.crp

break
      case "obj/obj_team4":
exec global/messages/rifle2.scr
exec global/weapons/rifle2.crp

     }
Now if I just use it on my computer by rcon map dm/ mhdm1 it works great. But if I exec a server.cfg the console log show this and it doesn't work at all:

Press fire to join the battle!' does not have a localization entry
^~^~^ Add the following line to the *_precache.scr map script:
cache models/items/binoculars.tik
level waittill prespawn (global/wcmds.scr, 7)
level ^

^~^~^ Script Error: invalid waittill prespawn for 'Level'
To err is human...to forgive devine...niether is Marine Corps Policy
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

If you are exec it From DMprechace.scr then level waittill prespawn will give you error becouse here you are tryin to execute code before prespawn while DMprechace is automaticaly loaded AFTER level waittill prespawn. Leave out this line and it should work! Also remember to use one end to close your message thread..
Lost1
Private
Posts: 3
Joined: Sat Nov 19, 2011 9:46 am
Location: Florida

Post by Lost1 »

nope added the end and removed thr waittill prespawn tried it it will still work on comp. but not with server.cfg only thing is now with server.cfg I don't get the error messages it just don't work...lol
I think I'll just leave it for now running from map scr's. Just wanted to try to fix it up so it's faster to change set up.
I'll look into some other weapons limters see how they do it. I downloaded admin pro see if I can figure it out.
Thanks for the help.
To err is human...to forgive devine...niether is Marine Corps Policy
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

Post by SilentAngel »

Code: Select all

main:

	waitthread messages
	
end

messages:

     println "THIS CODE WORKS GOOD"   //this is for debugging reasons!
	//if it's not necessary in other scripts there's no need to
	//delcare level.mapname...
	
	switch(getcvar(mapname))
	{
		case "dm/mohdm1":
			exec global/messages/rifle.scr
			exec global/weapons/rifle.crp
			break
		case "dm/mohdm1":
			exec global/messages/sniper.scr
			exec global/weapons/sniper.crp
			break
		...
		...
		...
		case "obj/obj_team4":
			exec global/messages/rifle2.scr
			exec global/weapons/rifle2.crp
			break
		default:
			break
	}
	
end
Place this in your Script.scr and add next line at the end of DMprecache.scr

Code: Select all

exec global/Script.scr
If your Script.scr is not in global then edit the path the rite way..
Aaaah of course replace ... With missing cases in the switch! :lol:
Using DMprecache you can make your script run at every map loading. Now i don't know what is inside the files you execute in the switch sentence maybe they need to be run before prespawn or after spawn. In the first case you must execute Script.scr via map script placing it's execution before level waittill prespawn, in the second case just add level waittill spawn before waitthread messages. This code i think it should work fine If you use it and read in console THIS CODE WORKS GOOD..then the problem must be inside the scripts you exec in the switch......
SilentAngel
Captain
Posts: 239
Joined: Wed Mar 12, 2008 8:27 pm

from slot to $player

Post by SilentAngel »

Hi! :D
I have some code that has to be executed via scripting but it's called from another program. This program works with slots number.
Supposing I want this script code to be exec for a player that is in slot 0, how can I know the index of the $player array for this player?
Initially I used to add +1 to the slot number but I noticed it was not working probably because when a player leaves the server slots does not update but $player array does.
Supposing I have 2 players on my server:
slot 0 -> $player[1] -> Player1Name
slot 1 -> $player[2] -> Player2Name
for now adding +1 to the slot number works but if Player1Name leaves the server the situation is this:
slot 1 -> $player[1] -> Player2Name
because $player array do update but slot do not...
This is driving me crazy lol
...Can you help me find a way to solve my problem?? Ty
:wink:
Locked