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

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

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

Post 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...
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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
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.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Great scr, but whats setsize for simple not pulsating mohaa explosives?

..and how can in println player name?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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")
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.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post 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.
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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.
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.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

bit more memory... so it slow down fps?
btw may script (without spawn and printin, etc) affect fps?
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post 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 :)
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.
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 »

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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply