Forum

> > Stranded II > Scripts > Shared XP, like an RPG.
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Shared XP, like an RPG.

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Shared XP, like an RPG.

pupp3tStudios
User Off Offline

Zitieren
In Pupp3t's Mod, I was going to implement a sort of leveling-up system like this:
• Each enemy you kill earns you a specific amount of XP for the same skill, like Hunting. For example, a normal zombie would be worth about 2 XP, and a Berzerker (refer to the mod) would be worth 10 XP.
As a test, I made a different "iskill" script for the Berzerker:
iskill_huntbigguy- and put in his script, so:
on:kill { event "iskill_huntbigguy",global;}
And in the "iskill_huntbigguy" section in the "game.inf", I put in:
on:iskill_huntbigguy{ incskill "hunt",10,"Hunting";}
Yet, in game-play, as I kill enough of these guys to advance a level, the "Level UP!" script doesn't play.
Mind you, it is also supposed to share the "$hunt". What can I do?

alt Re: Shared XP, like an RPG.

Vectarrio
User Off Offline

Zitieren
I think the problem is that if you have 8XP and you need 10, and you kill one and earn 10XP, you'll have 18 and it would skip the 10 point.
so, if the problem is in that, just make event "iskill_hunt" in a loop for 10 times. OR, you can change the level checker, by changing == to >=.
1× editiert, zuletzt 20.02.12 10:21:16

alt Re: Shared XP, like an RPG.

Hurri04
Super User Off Offline

Zitieren
@user Vectarrio: nope, in that case e.g. the first level would be triggered each time the player kills anything when he has more points than needes for the first level.

@user pupp3tStudios: so you want to script that the player gets 1 point from killing a normal enemy and 10 points from killing a special (stronger) enemy?

in that case, you have to put a loop around the the lines where the skillpoints are increased:
1
2
3
4
5
6
7
8
9
10
on:iskill_huntbigguy{
	loop("count", 10) {
		incskill "hunt",1,"Hunting";
		$tmp=skillvalue("hunt");
		if ($tmp==25){ event "skillup","global";}
		if ($tmp==50){ event "skillup","global";}
		if ($tmp==100){ event "skillup","global"; unlockbuilding 10; }
		if ($tmp==200){ event "skillup","global";}
	}
}

alt Re: Shared XP, like an RPG.

pupp3tStudios
User Off Offline

Zitieren
Works like a.. digital charm. :3
So, to alter the XP value for another unit, I just change the
loop("count",10) to maybe loop("count",5) and do the same script listed below for another unit?

alt Re: Shared XP, like an RPG.

Vectarrio
User Off Offline

Zitieren
I think you just could make that:
1
loop("count",10){event "iskill_hunt","global";}
and yeah, just change value in loop to change XP gain.
I hope I'm not wrong this time

alt Re: Shared XP, like an RPG.

Hurri04
Super User Off Offline

Zitieren
@user pupp3tStudios: that's exactly right

@user Vectarrio: yeah, this would also work, but...
I noticed, that events use a lot of calculation time so they tend to slow down the pc when there are many events at once. thus, although it might be some less code, it's always better to use as few events as possible.
if Pupp3t would e.g. put a ultra hard dragon boss or something in his mod that gives the player 500 points upon killing, this would make 500 events which would probably result in a screen-freeze of about half a minute.
1× editiert, zuletzt 21.02.12 11:40:53
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht