The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
races bodies
Author Message
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #1
races bodies
Hey guys, im trying to find the right code
for my bodies, thing is, some of my races will either use the human body and other the elf body.
What Im trying to do is to change the body accordingly to the current sex of the player.
Like, if I choose the female elf body, and then in game, on the race selection, I decide I want to be a human afterall, I gotta have the human body, but the female one, of course, so I wanted to know the IF statement I can add to check if the body is male or female, thanks guys.
09-01-2015 11:42 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #2
RE: races bodies
this body check is hardcoded, and on some situations also check for ghost ID too or check if it's male/female using IF (<CAN> & mt_female)

Human:
-man: 400 + 402 (ghost)
-woman: 401 + 403 (ghost)
-others: 987 (GM body)

Elf:
-male: 605 + 607 (ghost)
-female: 606 + 608 (ghost)

Gargoyle:
-male: 666 + 694 (ghost)
-female: 667 + 695 (ghost)
09-01-2015 01:05 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #3
RE: races bodies
You can check it in various ways:

1) As coruja said, checking the body: if (<body>==400) //this is a man.

2) if (<can>&mt_female)//can flags are inherited from [CHARDEF ], both c_woman and c_elf_female have it, also any chardef created from them.

3) <sex 1/0> // this will retrieve 1 if your body is a male one, 0 if it's a female one (this works based on 2), but can have more different usages).
09-01-2015 05:16 PM
Find all posts by this user Like Post Quote this message in a reply
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #4
RE: races bodies
Osiris, here is some funcitons i use to make this verifications:

Code:
[function ishuman]
if (<body> == c_man) || (<body> == c_woman)
return 1
endif
return 0

[function isgargoyle]
if (<body> == c_gargoyle_male) || (<body> == c_gargoyle_female)
return 1
endif
return 0

[function iselven]
if (<body> == c_elf_male) || (<body> == c_elf_female)
return 1
endif
return 0

[function ismale]
if (<body> == c_gargoyle_male) || (<body> == c_elf_male) || (<body> == c_man)
return 1
endif
return 0

[function isfemale]
if (<body> == c_gargoyle_female) || (<body> == c_elf_female) || (<body> == c_woman)
return 1
endif
return 0

[FUNCTION ishumanaid]
if (<ismale> || <isfemale>)
RETURN 1
endif
RETURN 0

There is a function that checks if the player is male or female in any race.
Hope it help you!

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
09-02-2015 07:03 AM
Find all posts by this user Like Post Quote this message in a reply
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #5
RE: races bodies
Thanks guys ! This all helps a lot ! Not so sure about how to use the CAN flag yet in a script but Ill try to find some examples to learn from. Im starting to see how limitless scripting can become, its epic Smile
Thanks escribano for these functions examples, its exactly what I was looking for

EDIT:

Hmmm for some reasons I get an error in my console saying it can't resolve o.O

So I tried this but the body doesnt change.
IF (<src.body> == c_man || c_elf_male)
Src.body = c_man
Src. Obody = c_man
ELSE
SRC.BODY = c_woman
SRC.OBODY = c_woman
return 1
Endif
return 0

Probably the return 0 huh ? Forgot to try removing it
(This post was last modified: 09-02-2015 11:16 AM by Osirirs.)
09-02-2015 10:02 AM
Find all posts by this user Like Post Quote this message in a reply
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #6
RE: races bodies
I'm Glad to help!!! thats why we are all here for!

Are u sure that <SRC> is the player?

Try this:
Code:
if (<src.body> == c_man) || (<src.body> == c_elf_male)
    src.id = c_man
    src.body = c_man
    src.obody = c_man
else
    src.id = c_woman
    src.body = c_woman
    src.obody = c_woman
endif

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
(This post was last modified: 09-02-2015 11:33 AM by escribano.)
09-02-2015 11:15 AM
Find all posts by this user Like Post Quote this message in a reply
pointhz
Journeyman
*

Posts: 148
Likes Given: 1
Likes Received: 55 in 28 posts
Joined: Oct 2013
Reputation: 1



Post: #7
RE: races bodies
That function doesn't make any sense.

You are checking if the body is c_man OR c_elf_male, and if it is ANY of these, it will be changed to c_man. Why would you check c_man and change to c_man?

Also, "else". Every other body that is not c_man or c_elf_male will be changed to c_woman.

You probably want something like:

IF (<SRC.BODY>==c_elf_male)
SRC.BODY=c_man
ELSEIF (<SRC.BODY>==c_elf_female)
SRC.BODY=c_woman
ENDIF
09-02-2015 12:05 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes pointhz's post
escribano
Journeyman
*

Posts: 170
Likes Given: 16
Likes Received: 32 in 23 posts
Joined: Nov 2012
Reputation: 2

Dragon Shard

Post: #8
RE: races bodies
What pointhz sayed makes PERFECT sense!

If the src.body doesn't work (what is really, REALLY, strange... ) try to use this one:
Code:
if (<src.body> == c_elf_male)
    src.id = c_man
    src.body = c_man
    src.obody = c_man
else if (<src.body> == c_elf_female)
    src.id = c_woman
    src.body = c_woman
    src.obody = c_woman
endif

UltimaPHP - OpenSource Ultima Online Server v0.1-pre-alpha under development, we need help!
(This post was last modified: 09-02-2015 12:35 PM by escribano.)
09-02-2015 12:27 PM
Find all posts by this user Like Post Quote this message in a reply
Osirirs
Journeyman
*

Posts: 73
Likes Given: 6
Likes Received: 4 in 2 posts
Joined: Feb 2014
Reputation: 2



Post: #9
RE: races bodies
Oooops... Guys, I must have been really tired yesterday... O.o wow haha, Im trying that right ahead ! Thanks !!

EDIT: Okay.. hmmm I dont see what I'm doing wrong here.. I've tried many things.. Here's what I got at the moment o.O :

Code:
[FUNCTION f_gender1]
IF (<src.body>==c_elf_male)
    SRC.ID=c_man
    SRC.BODY=c_man
    SRC.OBODY=c_man
    ELSEIF (<SRC.BODY>==c_elf_female)
        SRC.ID=c_woman
        SRC.BODY=c_woman
        SRC.OBODY=c_woman
        RETURN 1
    ENDIF
ENDIF
[/spoiler]

Oh and while you're there, its not part of the same topic but is there any way to change de value of hits to got ten times the str ? Same with mana and stam.
1 STR = 10 Hitpoints
1 DEX = 10 Stamina
1 INT = 10 mana ??
I know Ill have to change lots of stuff to keep the game balanced haha
(This post was last modified: 09-03-2015 10:40 AM by Osirirs.)
09-03-2015 08:38 AM
Find all posts by this user Like Post Quote this message in a reply
azmanomer
Journeyman
*

Posts: 139
Likes Given: 4
Likes Received: 18 in 16 posts
Joined: Nov 2013
Reputation: 1



Post: #10
RE: races bodies
http://wiki.sphere.torfo.org/index.php/@StatChange use this trigger for example for str;
on @statchange
if <argn1>==0
maxhits = <eval <argn3>*10>
return 1
endif

i didnt try but it should work Smile
09-03-2015 11:43 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)