Author Topic: Help with weap spawn script  (Read 2963 times)

0 Members and 1 Guest are viewing this topic.

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Help with weap spawn script
« on: August 14, 2007, 03:10:54 pm »
can someone please help me make this script work?

Code: [Select]
var
  WNUM, PNUM: string;

function OnCommand(ID:Byte;Text:string):boolean;
begin
  if Copy(lowercase(Text), 1, 7) = '/spawn ' then begin
    try
      WNUM := GetPiece(Text, ' ', 2)
      PNUM := GetPiece(Text, ' ', 3)
      if (WNUM = (GetObjectStat(ID,Type))) then begin
        if GetPlayerStat(strtoint(PNUM), 'active') = true then begin
          SpawnObject(GetPlayerStat(PNUM,'x'),GetPlayerStat(PNUM,'y'),WNUM);
        end;
      end;
  end;
end;

help T_T
« Last Edit: August 15, 2007, 10:23:59 pm by Kavukamari »
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: help with these please
« Reply #1 on: August 14, 2007, 03:56:15 pm »
1st and 2nd: your color codes are too long, i guess you added the alpha values which are however not supported. for black text, you use either $000000 or RGB(0,0,0).

3rd: Don't use nades as bullettype, i think they are blocked or something. Use the m79 grenade instead ( = bullettype 4)
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: help with these please
« Reply #2 on: August 14, 2007, 06:39:13 pm »
I'm needin more help now

(see first post)
« Last Edit: August 14, 2007, 07:16:11 pm by Kavukamari »
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: More Help Needed
« Reply #3 on: August 14, 2007, 07:18:30 pm »
replace
Code: [Select]
CreateBullet(GetPlayerStat(1,'x'), GetPlayerStat(1,'y'), 0, 0,100, 4, 1);with
Code: [Select]
CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y'), 0, 0,100, 4, ID);
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: More Help Needed
« Reply #4 on: August 14, 2007, 07:47:41 pm »
O.o that easy? thanks, ur teh best

just one more thing, I need it to not be used too much, how do I make a cooldown (not trying to copy hexer, but this might lag if 10 ppl use it at same time ;) )

Date Posted: August 14, 2007, 08:23:46 PM
and then theres !sacrifice spamming, and I don't want that
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: just one more thing
« Reply #5 on: August 14, 2007, 08:31:42 pm »
do it like this:

Code: [Select]
var antispam: integer;

procedure AppOnIdle(Ticks: integer);
begin
  If antispam > 0 then
    antispam:=antispam-1;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
  if (Text = '!sacrifice') and (antispam = 0) then begin
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y'), 0, 0,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y'), -50, 0,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y'), 50, 0,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 75, 0, -50,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') - 75, -50, -50,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') + 75, 50, 50,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') + 75, 0, 50,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') + 75, -50, 50,100, 4, 1);
    CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') - 75, 50, -50,100, 4, 1);
    DoDamage(ID,4444);
    antispam:=Insert here how many seconds you want to prevent !sacrifice after it was used;
  end;
end;
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: just one more thing
« Reply #6 on: August 14, 2007, 10:28:50 pm »
can you figure out what's wrong with this one too?

Code: [Select]
var
  WNUM, PNUM: string;

function OnCommand(ID:Byte;Text:string):boolean;
begin
  if Copy(lowercase(Text), 1, 7) = '/spawn ' then begin
    try
      WNUM := GetPiece(Text, ' ', 2)
      PNUM := GetPiece(Text, ' ', 3)
      if (WNUM = (GetObjectStat(ID,Type))) then begin
        if GetPlayerStat(strtoint(PNUM), 'active') = true then begin
          SpawnObject(GetPlayerStat(PNUM,'x'),GetPlayerStat(PNUM,'y'),WNUM);
        end;
      end;
  end;
end;

it's sposed to be a weap spawn script
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: just one more thing
« Reply #7 on: August 14, 2007, 11:13:50 pm »
if i were to add another command like

begin
DoDamage(ID,-1000);
 antispam:=75;
 end;

how would i do it becouse i just cant get it right

Code: [Select]
var antispam: integer;

procedure AppOnIdle(Ticks: integer);
begin
 if (Text = '!Heal') and (antispam = 0) then begin
 antispam:=antispam-1;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
 if (Text = '!sacrifice') and (antispam = 0) then begin
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y'), 0, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y'), -50, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y'), 50, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 75, 0, -50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') - 75, -50, -50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') + 75, 50, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') + 75, 0, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') + 75, -50, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') - 75, 50, -50,100, 4, 1);
 DoDamage(ID,4444);
 antispam:=65;
begin
 if (Text = '!Heal') and (antispam = 0) then begin
 DoDamage(ID,-1000);
antispam:=75;
end;
 end;
end;

Im new so i come out w this can u show me the correct way to do this



Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Done with sacrifice, need help with this:
« Reply #8 on: August 15, 2007, 11:17:19 am »
can you figure out what's wrong with this one too?

Code: [Select]
var
  WNUM, PNUM: string;

function OnCommand(ID:Byte;Text:string):boolean;
begin
  if Copy(lowercase(Text), 1, 7) = '/spawn ' then begin
    try
      WNUM := GetPiece(Text, ' ', 2)
      PNUM := GetPiece(Text, ' ', 3)
      if (WNUM = (GetObjectStat(ID,Type))) then begin
        if GetPlayerStat(strtoint(PNUM), 'active') = true then begin
          SpawnObject(GetPlayerStat(PNUM,'x'),GetPlayerStat(PNUM,'y'),WNUM);
        end;
      end;
  end;
end;

it's sposed to be a weap spawn script
Quote from: enesce.com/help
function SpawnObject(X,Y:Single; ObjType: Byte): integer;
The bolded part is supposed to be a byte, not a string. replace your "WNUM" with "StrtoInt(WNUM)"

Date Posted: August 15, 2007, 12:16:25 PM
if i were to add another command like

begin
DoDamage(ID,-1000);
 antispam:=75;
 end;

how would i do it becouse i just cant get it right

Code: [Select]
var antispam: integer;

procedure AppOnIdle(Ticks: integer);
begin
 if (Text = '!Heal') and (antispam = 0) then begin
 antispam:=antispam-1;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
 if (Text = '!sacrifice') and (antispam = 0) then begin
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y'), 0, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y'), -50, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y'), 50, 0,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 75, 0, -50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') - 75, -50, -50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') + 75, 50, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') + 75, 0, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') + 75, -50, 50,100, 4, 1);
 CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') - 75, 50, -50,100, 4, 1);
 DoDamage(ID,4444);
 antispam:=65;
begin
 if (Text = '!Heal') and (antispam = 0) then begin
 DoDamage(ID,-1000);
antispam:=75;
end;
 end;
end;

Im new so i come out w this can u show me the correct way to do this
get rid of the "begin" and "end" around the new command.

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: Done with sacrifice, need help with this:
« Reply #9 on: August 15, 2007, 04:32:08 pm »
i did and i got the message

error (31:1) begin expected



Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Done with sacrifice, need help with this:
« Reply #10 on: August 15, 2007, 05:19:50 pm »
Code: [Select]
var antispam: integer;

procedure AppOnIdle(Ticks: integer);
begin
if (Text = '!Heal') and (antispam = 0) then begin
antispam:=antispam-1;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
if (Text = '!sacrifice') and (antispam = 0) then begin
  CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y'), 0, 0,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y'), -50, 0,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y'), 50, 0,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') - 75, 0, -50,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') - 75, -50, -50,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') + 75, 50, 50,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x'), GetPlayerStat(ID,'y') + 75, 0, 50,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') - 75, GetPlayerStat(ID,'y') + 75, -50, 50,100, 4, 1);
  CreateBullet(GetPlayerStat(ID,'x') + 75, GetPlayerStat(ID,'y') - 75, 50, -50,100, 4, 1);
  DoDamage(ID,4444);
  antispam:=65;
end;
if (Text = '!Heal') and (antispam = 0) then begin
  DoDamage(ID,-1000);
  antispam:=75;
end;
end;
urraka

Offline Tosty

  • Soldier
  • **
  • Posts: 172
  • Ultimate TW Medic
    • Just Click it
Re: Done with sacrifice, need help with this:
« Reply #11 on: August 15, 2007, 06:01:15 pm »
ty its workng now (+ i wont have to ask that question again)

Date Posted: August 15, 2007, 05:32:03 PM
Can u give me an example of a force weapon script It keeps say

comma (',') expected

When i try to use mine



Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Done with sacrifice, need help with this:
« Reply #12 on: August 15, 2007, 06:54:39 pm »
ty its workng now (+ i wont have to ask that question again)

Date Posted: August 15, 2007, 05:32:03 PM
Can u give me an example of a force weapon script It keeps say

comma (',') expected

When i try to use mine

Code: [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
begin
  if Text[1] = '%' then begin
    try
      ForceWeapon(ID,StrtoInt(Copy(Text,2,Length(Text))),255,0);
    except
      WriteConsole(ID,'Nooo! That ''tis noo numbuh!',$FFFFFFFF);
    end;
  end;
end;
will set the player's primary weapon to whatever weapon number was said after the % and secondary to fist.
Quote from: http://www.enesce.com/help/index.html?Functions/ForceWeapon.html
procedure ForceWeapon(ID, Primary, Secondary, Ammo: Byte);

Offline Kavukamari

  • Camper
  • ***
  • Posts: 435
  • 3.14159265358979, mmm... pi
Re: Done with sacrifice, need help with this:
« Reply #13 on: August 15, 2007, 07:53:10 pm »
Code: [Select]
var
  WNUM, PNUM: string;

function OnCommand(ID:Byte;Text:string):boolean;
begin
  if Copy(lowercase(Text), 1, 7) = '/spawn ' then begin
    try
      WNUM := GetPiece(Text, ' ', 2)
      PNUM := GetPiece(Text, ' ', 3)
      if (strtoint(WNUM) = (GetObjectStat(strtoint(WNUM),'Type'))) then begin
        if GetPlayerStat(PNUM,'active') = true then begin
          SpawnObject(GetPlayerStat(PNUM,'x'),GetPlayerStat(PNUM,'y'),strtoint(WNUM));
        end;
      end;
  end;
Result := false
end;

It still doesn't work

Date Posted: August 15, 2007, 07:57:53 PM
...
"Be mindful of fame, show a mighty courage, watch against foes. Nor shalt thou lack what thou desirest, if with thy life thou hast comest out from that heroic task."