Forum

> > Stranded II > Scripts > Immortal Killing Sword
Forums overviewStranded II overview Scripts overviewLog in to reply

English Immortal Killing Sword

5 replies
To the start Previous 1 Next To the start

old Immortal Killing Sword

Xephoriah
User Off Offline

Quote
I'm making a sword that does around 12500 damage and if it hits any object that has Invulnerability, it will remove the state and the second hit is a sure kill, whenever i hit an invincible entity, it works, but when i hit anything that's not invincible i get an error message.
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
28
29
30
### OP Sword
id=121
name=OP Sword
group=weapon
icon=gfx\crystalblade.bmp
model=gfx\crystalblade.b3d
scale=1.6
behaviour=blade
mat=metal
weight=0
rate=300
damage=12500
info=You shoudn't have this!
healthchange=0
script=start
	on:impact {
		if (impact_class()>0){
			if (impact_id()>0){
				freestate impact_class(),impact_id(),"invulnerable";
			}
		}
	}
	on:attack2 {
		event "iskill_fish","global";
		event "iskill_wood","global";
		event "iskill_plant","global";
		event "iskill_hunt","global";
		event "iskill_dig","global";
	}
script=end
I aslo made it so when you Rightclick you upgrade every skill by one.
but i get an error message in the console when I hit a destructible object, so how do I fix this. other than that, it works just fine!

old Re: Immortal Killing Sword

DC
Admin Off Offline

Quote
Maybe you have to check if the object has the "invulnerable" state before you try to remove it. Use s2 cmd gotstate to do so:

1
2
3
if (gotstate(impact_class(),impact_id(),"invulnerable")==1) {
	freestate impact_class(),impact_id(),"invulnerable";
}

Just an assumption. Didn't test it.

old Re: Immortal Killing Sword

Xephoriah
User Off Offline

Quote
It created even more errors, I can't figure out if the reason you left out the >0 after the impact_class, was it even needed?
EDIT: Nevermind, i figured out it was supposed to go with my code and not replace it, i'll let you know if it makes any errors.
RE-EDIT: it did the same thing, the code is saying things like: " is not a state, Mismatched Brackets, expecting ','. i don't know whats going on...
edited 2×, last 28.03.15 11:02:30 pm

old Re: Immortal Killing Sword

JasJack67
Super User Off Offline

Quote
yes@invulnerability

or simply put 17 instead? without the " "

so your original script will work without checking "gotstate" too

old Re: Immortal Killing Sword

Xephoriah
User Off Offline

Quote
i figured it out! first of all, yes, i was getting errors for a wrong state, second of all in the impact_class, it only needed two of these ( ) surrounding it and not needing a second two beside it, it works, thank you all!

EDIT: Darn! I was wrong! now it acts like a regular sword... it doesn't kill invincible things... I tried id 17 without " and invulnerability instead of invulnerable, they both don't work!
edited 1×, last 30.03.15 05:28:03 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview