Author Topic: Javalin / Predator Missile  (Read 1140 times)

0 Members and 4 Guests are viewing this topic.

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Javalin / Predator Missile
« on: December 05, 2009, 03:56:42 pm »
I'm working on my "Modern Warfare Trenchwar" script, and I wanted to start with my two most favoured weapons (Ya, I play COD:MW2) to use in the modern battlefield.

The javalin is kinda like fired by someone "Outside the battlefield" So all that the player needs to see is a Grenade crashing down from the sky.
Specs that it needs to get:
- Can be Fired every 120 seconds (This should keep on counting even when the player died)
- Needs to check the Direction the player faces/looks
- It needs to have a 5 second timer (between the time the player typed /javalin and the actual grenade/javalin coming down)
- It cannot be fired by Spectators.

Some stuff I wrote so far:
Code: [Select]
function OnCommand(Launcher: byte; Damage: integer): integer;
var Lx,Ly,Ld: single;
begin
   if Text = '/javalin' then begin
Lx := GetPlayerStat(Launcher,'X');
Ly := GetPlayerStat(Launcher,'Y');
Ld := GetPlayerStat(Launcher,'Direction');
if (GetPlayerStat(Ld) = '>') then begin
WriteLn('Javalin Launched!');
CreateBullet(Px+1000,Vy+10000,5,-250,1500,5,Launcher);
else
WriteLn('Javalin Launched!');
CreateBullet(Px-1000,Vy+10000,-5,-250,1500,5,Launcher);
end;
end;
Result := Damage;
end;

I have No idea if this is right though.. First time EVER I wrote a script all by myself (AKA: Without modifieing someone else's script. I want to be able to fire it first.. Then I'll try to add the Timers ect.. I just want to be able to fire the grenade in the direction I'm looking :)

+ I have NO clue how to work with AppOnIdle (3600 ticks untill you can fire another one)
--

Predator Missile: Admin only weapon, against people that are annoying ect.. I want to be able to type "/Predator *player number*" and then like 3 M79 grenades come crashing down their heads..

^^ I'll come to that when I finished the javalin :)
                  Forum Rules   -   Search

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Javalin / Predator Missile
« Reply #1 on: December 05, 2009, 04:19:57 pm »
1) Its javelin. J A V E L I N
2) THIS IS A REAL MISSILE

http://enesce.com/help/
Use this to learn what does what make.
It would need CreateBullet(), for which i reccomend that you look at airstrike scripts, but if you want that it looks like a missile use 2)
Also, 2) doesnt hit colider polygons, which is the only problem.
« Last Edit: December 05, 2009, 04:22:41 pm by croat1gamer »
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Javalin / Predator Missile
« Reply #2 on: December 05, 2009, 04:49:18 pm »
1) Its javelin. J A V E L I N
2) THIS IS A REAL MISSILE

http://enesce.com/help/
Use this to learn what does what make.
It would need CreateBullet(), for which i reccomend that you look at airstrike scripts, but if you want that it looks like a missile use 2)
Also, 2) doesnt hit colider polygons, which is the only problem.

1. Soz, I noticed xD
2. Hmm, a Modified Editon of the AA script could be used as well..

Anyway, I rather create my own. So come up with what I did wrong.
                  Forum Rules   -   Search

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
Re: Javalin / Predator Missile
« Reply #3 on: December 05, 2009, 04:58:48 pm »
1)
Code: [Select]
function OnCommand(Launcher: byte; Damage: integer): integer; -> wtf is that? Mix of OnPlayerDamage and OnCommand?
2)
Code: [Select]
Ld := GetPlayerStat(Launcher,'Direction'); -> Ld is single, and that func returns char
3)
Code: [Select]
WriteLn('Javalin Launched!'); -> I think you don't know what this func does...
4)
Code: [Select]
CreateBullet(Px-1000,Vy+10000,-5,-250,1500,5,Launcher); -> bigger Y = lower
5)
Code: [Select]
Result := Damage; -> thats connected with 1)

Offline croat1gamer

  • Veteran
  • *****
  • Posts: 1327
  • OMG CHANGING AVATAR!!! ^ω^
Re: Javalin / Predator Missile
« Reply #4 on: December 05, 2009, 05:05:44 pm »
Now that gizd explained the problems, please take a look at this site:

http://enesce.com/help/

There is almost everything you need, explained and with examples.
If you need more help, ask on #soldat.devs.
Last year, I dreamt I was pissing at a restroom, but I missed the urinal and my penis exploded.

Offline D4NG3R NL

  • Soldier
  • **
  • Posts: 130
  • You got Rickroll'd
Re: Javalin / Predator Missile
« Reply #5 on: December 05, 2009, 05:23:01 pm »
1)
Code: [Select]
function OnCommand(Launcher: byte; Damage: integer): integer; -> wtf is that? Mix of OnPlayerDamage and OnCommand?
2)
Code: [Select]
Ld := GetPlayerStat(Launcher,'Direction'); -> Ld is single, and that func returns char
3)
Code: [Select]
WriteLn('Javalin Launched!'); -> I think you don't know what this func does...
4)
Code: [Select]
CreateBullet(Px-1000,Vy+10000,-5,-250,1500,5,Launcher); -> bigger Y = lower
5)
Code: [Select]
Result := Damage; -> thats connected with 1)

1: Used one of my older scripts for this.. That was quite stupid o.O

2: Confused ???

3: WriteConsole(0,'Javelin Launched!',RGB(75,75,75))
My mistake lol

4: I just noticed >.<

5: Fits 1.
                  Forum Rules   -   Search

Offline SpiltCoffee

  • Veteran
  • *****
  • Posts: 1579
  • Spilt, not Split!
    • SpiltCoffee's Site
Re: Javalin / Predator Missile
« Reply #6 on: December 06, 2009, 05:38:20 am »
2: Confused ???
According to the scripting manual, GetPlayerStat's Direction stat returns a character, not a number, certainly not a single. (dunno if it's < and > or L and R or something... I think it's < and >).
When life hands you High Fructose Corn Syrup, Citric Acid, Ascorbic Acid, Maltodextrin, Sodium Acid Pyrophosphate,
Magnesium Oxide, Calcium Fumarate, Yellow 5, Tocopherol and Less Than 2% Natural Flavour... make Lemonade!