Cubescript onhit argument
#1
hi,
The command :
onHit actor target damage gun gib


I want making a script who work when i do a gibs .
The probleme is the order of argument

onhit (findcn $curname) target damage (curweapon) 0 = [echo gib ]
What can i replace target and damage
I want the script work according any target and any damage .
Thanks given by:
#2
Could you use /onkill?
http://assault.cubers.net/docs/reference...ier_onKill
Thanks given by:
#3
(08 Dec 12, 11:59AM)MykeGregory Wrote: Could you use /onkill?
http://assault.cubers.net/docs/reference...ier_onKill

Onkill is better because you delete the argument "damage" but the problem is the same for target

onKill actor target gun gib
onkill (findcn $curname) target (curweapon) 0 = [echo gib ]
Thanks given by:
#4
(08 Dec 12, 12:29PM)888 Wrote:
(08 Dec 12, 11:59AM)MykeGregory Wrote: Could you use /onkill?
http://assault.cubers.net/docs/reference...ier_onKill

Onkill is better because you delete the argument "damage" but the problem is the same for target

onKill actor target gun gib
onkill (findcn $curname) target (curweapon) 0 = [echo gib ]

I think you misunderstood the way onKill, onHit and such aliases work.
When someone is killed, onKill is automatically called by the game and given a few parameters.

You just have to define onKill, like any other alias. Eg :
onKill = [ echo (player $arg1 name) killed (player $arg2 name), gib $arg3 ]

Will display : 888 killed unarmed, gib 1
every time you gib unarmed.
Thanks given by:
#5
No ,no .
You don't understand my problem .

Onkill = [echo died ]
This script write "died" when any player die .

onKill (findcn $curname) = [echo died ]
this script write "died" when i kill a player .The script work .

It's the same things that :
onKill = [ if (= ($arg1) (findcn $curname)) [ echo died] ]




The advantage of first script is who avoid to do condition (if)

Now i want to make a script who write gibs when i kill a player in gibs .

I could make a script like this
onKill = [ if (= ($arg1) (findcn $curname)) [ if ($arg3)[echo gibs] [echo no gibs] ] []]

or

onKill (findcn $curname) = [ if ($arg3)[echo gibs] [echo no gibs] ]

I think he exist a techiq for the same things without the condition (if)

onkill (findcn $curname) target (curweapon) 0 = [echo gib ]
The problem is argument target .
Thanks given by:
#6
(08 Dec 12, 01:47PM)888 Wrote: onKill (findcn $curname) = [echo died ]
this script write "died" when i kill a player .The script work .
Are you sure this script actually works ?
Thanks given by:
#7
The script dont work
i dont understand ,it work this morning .


I am confused
Thanks given by:
#8
(08 Dec 12, 03:58PM)888 Wrote: The script dont work
i dont understand ,it work this morning .


I am confused

if you want to simplify the code, you can use separate aliases :
[code=cubescript]
onKill = [ if (= $arg4 1) [ onGib $arg1 $arg2 $arg3 $arg4; ]
if (= $arg1 (player1 cn)) [ onOwnKill; $arg1 $arg2 $arg3 $arg4; ]]

onGib = [ ... ]
onOwnKill = [ ... ]
[/code]
Thanks given by: