Page 1 of 1

DROP AND PICKUP - for example explosives... pleaase scr.

Posted: Mon Dec 01, 2008 3:00 pm
by Aprop
Hello
I looking for script.... player pick up explosives, carry it, and when player dies he drop it...and another player can pick it up. Please show me ready script ;D because i dont know how to spawn explosives ON GROUND when player die...

Posted: Tue Dec 02, 2008 5:01 pm
by $oldier Of Ra
Fill in the required spots :)

Code: Select all

pickup:

local.object = spawn trigger_use "targetname" "object"
local.object model "your model"
local.object.origin = ( X Y Z )
local.object.angles = ( X Y Z )
local.object setsize ( -X -Y -Z ) ( X Y Z )
local.object solid
local.object setthread pickit

end

pickit:

self nottriggerable
local.p = parm.other

local.model = self.model
local.origin = self.origin
waitframe
self remove

local.p playsound plantbomb1
local.p iprint "You picked up the Object!" 1
iprintlnbold ("The " + local.p.dmteam + " have picked up the Object")

while (isalive local.p)
{
wait 0.2
}

if (local.p == NIL || local.p == NULL)
{
local.p.origin = local.origin
local.respawned = 1
}

local.floor = spawn script_model
local.floor.origin = local.p.origin
local.floor notsolid
local.floor droptofloor

local.dropper = spawn trigger_use "targetname" "object"
local.dropper model local.model
local.dropper.origin = local.p.origin
local.dropper.angles = local.p.angles
local.dropper setsize ( -X -Y -Z ) ( X Y Z )
local.dropper solid
local.dropper setthread pickit

local.dropper nottriggerable

local.dropper speed 50 //change if too fast or too slow
local.dropper moveto local.floor
local.dropper waitmove

local.dropper triggerable

if (local.respawned != 1)
{
iprintlnbold "The object has been dropped!"
}
else 
{
iprintlnbold "The object has been respawned at his original position!"
}

waitframe 
local.floor immediateremove

end

Posted: Tue Dec 02, 2008 9:03 pm
by Aprop
Great scr, but whats setsize for simple not pulsating mohaa explosives?

..and how can in println player name?

Posted: Wed Dec 03, 2008 12:08 pm
by $oldier Of Ra
For the explosive this will suffice: ( -10 -10 -10 ) ( 10 10 10 )

If you plan on using this in BT you can access the player name with .netname. If you plan on using it in SH, you need a BT-to-SH converted gamex86.dll file so you can use the .netname function in SH.

Without the converted .dll, you cannot get the player's name in SH and unfortunately in AA there's no way nor workaround to get it. :(

So if you use this in BT or a fixed SH game use this to print it:

iprintln (local.p.netname + " your text")

Posted: Wed Dec 03, 2008 12:40 pm
by Aprop
I fortunatelly use BT :D its awesome engine...

btw "()" is not needed, i always print text like:

Code: Select all

iprintln " player " local.p.netname " dropped " local.object.model " at " local.p.origin
its clearlier and easier.

Posted: Wed Dec 03, 2008 3:12 pm
by $oldier Of Ra
Well the engine must use a bit more memory to read simplified syntax

I doubt players will be able to tell where the object has fallen by using an origin :) and also it will be printed like this:
( 322.5500 -55.0068 150.3302 )
This'll take a lot of space in your print.

Posted: Wed Dec 03, 2008 6:56 pm
by Aprop
bit more memory... so it slow down fps?
btw may script (without spawn and printin, etc) affect fps?

Posted: Wed Dec 03, 2008 7:31 pm
by $oldier Of Ra
If too much simplified syntax is used and a script is working with very fast loops, many weaponcommands or many entities commands etc... then it can lag, sometimes lag very hard. But don't worry, this script is far from lag :)

Posted: Thu Dec 04, 2008 8:35 pm
by Rookie One.pl
What do you mean by "simplified syntax"? As far as I know, the script parser doesn't differentiate between any types of syntax, it only has a very elastic (really, very elastic) set of rules that makes it very easy to make logical mistakes and extremely hard to debug. It also allows for C/C++-like strict programming as well as non-strict programming.

One such rule is that any token which is not quoted and not recognized as a keyword (or an identifier, or an operator) is evaluated as a string. This sometimes makes sense, but most of the time it doesn't.