English Hit sound and flash script

14 replies
Goto Page
To the start Previous 1 Next To the start
03.04.19 08:12:59 pm
Up
M3t4l_M0uth
Super User
Offline Off
I am having trouble with my new map. I want there to be a sound every time I left click (for reasons that will be revealed in the release of the new version(s) of SII Enhanced)
I have spent too much time trying to figure this out and have gotten nowhere.

I want something like this:
Code:
1
2
3
4
on:(every time the player clicks the hit button){
     (play sound)
     (create flash)
}


I have also tried to replicate a similar code in tower defense:
Code:
1
2
3
on:attack1{
     skipevent;
}


I haven't figured out either of these, and I should have asked for help long ago instead of wasting precious hours.
edited 1×, last 03.04.19 08:19:25 pm
03.04.19 08:15:32 pm
Up
Assassin moder
User
Offline Off
use
Code:
1
2
3
on:attack1 {
     skipevent;
}
03.04.19 08:18:58 pm
Up
M3t4l_M0uth
Super User
Offline Off
Oh, yeah. That script. Sorry, didn't refer to SII when typing the last post, ill fix it. Anyway, it didn't work for me for some reason, I don't know why. I don't think I was missing something. Have you got it to work?

p.s. I guess i didn't give much info on the map. It is pretty much alien war and it's amazing, although it's more of a mini-mode kind of like tower defense and color game and such but with more aliens and laser vision and shooting. (The laser vision is the script i'm trying to figure out, I already put in the script player_attackrange and a big number. The problem is, it doesn't sound or look like laser vision, so the only way is to pretend, and that's fine for me, but It makes it look amateur and improvised (Which it may be, i dunno) so I would like to make it better for playing quality)
11.04.19 03:17:48 pm
Up
JasJack67
Super User
Offline Off
Code:
1
2
3
4
5
6
on:attack1 {
     if(lives("unit",1)==1){
          play "sound.wav";
          flash 255,255,255,0.8,1.3;
     }
}


Attach this script to player ID=1.
If the player is dead nothing will happen.
In play, the name of the file to play in the sounds folder.
In flash, the first 3 numbers are the color, then the other 2 numbers can be manipulated for length of time the flash exists and speed at which it fades out/in.
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
11.04.19 09:09:10 pm
Up
M3t4l_M0uth
Super User
Offline Off
All right I have had trouble with the 'attack1' script, but mostly I was trying to do the skipevent. I'll try again with the new code you've given me. Thanks
12.04.19 04:00:08 am
Up
JasJack67
Super User
Offline Off
skipevent; simply nullifies the intended event...so basically when you click attack1 mouse button NOTHING happens because it skips the event to attack.

Same for where ever you put skipevent...if, for example,
you script on:changeday{ skipevent;} the day will
not change. That's all it does...it skips the original
intended event.

Just for the record: you can also add script before or after the skipevent; command and those scripts will still run...only the original event will be skipped.

so example time:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
This script you will notice when hitting
attack button the player does not attack or hit
anything, or shoot or swing a weapon...but you
still get the sound and flash

on:attack1 {
     skipevent;
     if(lives("unit",1)==1){
          play "sound.wav";
          flash 255,255,255,0.8,1.3;
     }
}

in scripting though i found sometimes i had to move the
skipevent; below the script to make it do this. Like it
depends on where you use it.

on:attack1 {
     if(lives("unit",1)==1){
          play "sound.wav";
          flash 255,255,255,0.8,1.3;
     }
     skipevent;
}

one of these two will result in not attacking anything,
but still have sound n flash.
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
16.04.19 05:01:13 pm
Up
M3t4l_M0uth
Super User
Offline Off
Neither of the codes does anything

help plz
edited 1×, last 17.04.19 03:33:09 am
17.04.19 08:18:11 am
Up
JasJack67
Super User
Offline Off
well, you can try editing the global script in the game.inf file maybe that will make it work.

Code:
1
2
3
4
5
6
7
on:keyhit03 {
     primary_attack;
}

on:keyhit04 {
     secondary_attack;
}


i didn't actually test so idk why it wouldn't work for ya...and idk if anyone edited the source code in the .exe your using.
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
17.04.19 05:56:43 pm
Up
M3t4l_M0uth
Super User
Offline Off
So then I would just do some thing like this:

Code:
1
2
3
4
on:primary_attack;
     flash 255,255,255;
     play sound.wav;
}
17.04.19 08:28:01 pm
Up
JasJack67
Super User
Offline Off
now your gettin it yes.

but you have a mistake in the first line use { not ; and use keyhit03 as that is the key you hit (mouse button) per options, setting, controls.
Code:
1
on:keyhit03 {


p.s. scripting is very strict. you need " around the sound file name like this:

play "sound.wav";

Code:
1
2
3
4
on:keyhit03 {
     flash 255,255,255;
     play "sound.wav";
}
edited 8×, last 17.04.19 08:58:03 pm
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
17.04.19 08:28:41 pm
Up
Assassin moder
User
Offline Off
@user M3t4l_M0uth: no.. There is a long road of scripting in front of you..
17.04.19 10:49:25 pm
Up
M3t4l_M0uth
Super User
Offline Off
Oh, no.. Well, DC did this previously. Maybe I could get his advice on this. It appeared that he did it without much coding on tower defense.

user DC :Hit me up if you know the answer to this question.
18.04.19 12:21:04 am
Up
JasJack67
Super User
Offline Off
tower defense doesn't hit a button like the player. what i said above is accurate.
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
18.04.19 07:04:44 pm
Up
M3t4l_M0uth
Super User
Offline Off
Ok, thanks. Will try when I am able to use my windows computer. (this one doesn't run s2)


EDIT: I tried it. It still doesn't work. Unfortunately with all of these codes, either I'm doing it wrong or the code simply doesn't work.
edited 1×, last 19.04.19 10:24:14 pm
20.04.19 03:06:45 pm
Up
JasJack67
Super User
Offline Off
you have been asked before to post your script so we can see what your doing, and if your doing something wrong. It is more productive this way...we can tell you what to correct. It also shows use your not just bullshitting us and wasting our time and we see your at least trying.

Just saying" it doesn't work" or "might be doing it wrong" is irrelevant if we can't see what your writing.

It won't work if you are missing a "."comma , or a ( or a { or " or something else.

p.s. I see no reason this would not work. copy n paste it to the player scripts ID=1. Make sure it is the ONLY on:attack1 command. If you have 2 of them post the other one so we can see it.
Code:
1
2
3
4
5
6
on:attack1 {
     if(lives("unit",1)==1){
          play "sound.wav";
          flash 255,255,255,0.8,1.3;
     }
}

Attach this script to player ID=1.
If the player is dead nothing will happen.
In play, the name of the file to play in the sounds folder.
In flash, the first 3 numbers are the color, then the other 2 numbers can be manipulated for length of time the flash exists and speed at which it fades out/in.
edited 2×, last 20.04.19 03:29:42 pm
The Survivalist_09-26-18 is now available. DOWNLOAD HERE >The Survivalist 09-26-18 | Performance-In options keep Water Detail off
To the start Previous 1 Next To the start