PDA

View Full Version : Sword-Specific Level


Travesty
03-25-2007, 09:43 AM
I'm trying to make it so that when a player is in this level, the player has 10 hearts and a level 2 sword, while everywhere else, 13 hearts and a level 3 sword. Possible?

Heh... can you do that in GS1?

killerogue
03-25-2007, 09:57 AM
Yes. Hold on a minute.

Could work, couldn't work. Might want to put this in a class and let me know.



//#CLIENTSIDE
function onPlayerleaves()
{
this.firsthearts = clientr.swordfullhearts;
this.firstspower = clientr.swordpower;

player.swordpower = 2;
player.fullhearts = 10;
}

function onPlayerenters()
{
player.swordpower = this.firstspower;
player.fullhearts = this.firsthearts;
}

Twinny
03-25-2007, 01:10 PM
Yes. Hold on a minute.
Could work, couldn't work. Might want to put this in a class and let me know.


Umm... you can't set a players sword power or hearts clientside. Also, this.firstpower and this.firsthearts are undefined. You also managed to mix up the order (clientr. is set when the player leaves?).

I'll write it in GS2 first and i'll try and work it out in GS1

function onCreated()
{
this.sethearts=10;
this.setsword=2;
}

function onPlayerEnters()
{
player.clientr.setsword = player.swordpower;
player.clientr.sethearts = player.fullhearts;
player.swordpower = this.setsword;
player.fullhearts = this.sethearts;
player.chat = "Default stats set!";
}

function onPlayerLeaves()
{
player.swordpower = player.clientr.setsword;
player.fullhearts = player.clientr.sethearts;
player.clientr.setsword = "";
player.clientr.sethearts = "";
player.chat = "Original Stats Restored";
}

godofwarares
03-25-2007, 02:04 PM
Umm... you can't set a players sword power or hearts clientside. Also, this.firstpower and this.firsthearts are undefined. You also managed to mix up the order (clientr. is set when the player leaves?).

I'll write it in GS2 first and i'll try and work it out in GS1

function onCreated()
{
this.sethearts=10;
this.setsword=2;
}

function onPlayerEnters()
{
player.clientr.setsword = player.swordpower;
player.clientr.sethearts = player.fullhearts;
player.swordpower = this.setsword;
player.fullhearts = this.sethearts;
player.chat = "Default stats set!";
}

function onPlayerLeaves()
{
player.swordpower = player.clientr.setsword;
player.fullhearts = player.clientr.sethearts;
player.clientr.setsword = "";
player.clientr.sethearts = "";
player.chat = "Original Stats Restored";
}


In GS1:


if (created)
{
this.sethearts = 10;
this.setsword = 2;
}

if (playerenters)
{
setstring clientr.setsword, playerswordpower;
setstring clientr.sethearts, playerfullhearts;
playerswordpower = this.setsword;
playerfullhearts = this.sethearts;

setplayerprop #c,Default stats set!;
}

if (playerleaves)
{
playerswordpower = clientr.setsword;
playerfullhearts = clientr.sethearts;
setstring clientr.setsword,;
setstring clientr.sethearts,;

setplayerprop #c,Original Stats Restored;
}



* I love how when people ask for GS1, everyone gives him GS2 ...

Twinny
03-25-2007, 03:26 PM
* I love how when people ask for GS1, everyone gives him GS2 ...

I skipped GS1 all together so I don't know it all. I post a solution in GS2 in case the original poster / someone else can use it to translate to GS1.

Skyld
03-25-2007, 03:42 PM
Please only post in the language relevant to the post. Ideally we do not want to confuse people by mixing up the languages.

Riot
03-25-2007, 11:45 PM
In GS1:

* I love how when people ask for GS1, everyone gives him GS2 ...

You almost had it right:

if (created)
{
this.sethearts = 10;
this.setsword = 2;
}

if (playerenters)
{
setstring clientr.setsword,#v(playerswordpower);
setstring clientr.sethearts,#v(playerfullhearts);
playerswordpower = this.setsword;
playerfullhearts = this.sethearts;

setplayerprop #c,Default stats set!;
}

if (playerleaves)
{
playerswordpower = strtofloat(#s(clientr.setsword));
playerfullhearts = strtofloat(#s(clientr.sethearts));
setstring clientr.setsword,;
setstring clientr.sethearts,;

setplayerprop #c,Original Stats Restored;
}