Hi guys,
I'm having abit of trouble with a 3d game im making. Currently i have models i've created from 3ds max and what i'm trying to do is figure out how to get them to "interact" with one another.
Like for example, in a rpg game where the character the user is controlling is near another character, they can press a button to talk to them.
the logic ive got is:
closeNPC = mathMan.worldposition.x - hero.worldposition.x
if (closeNPC < 30)
cantalk == true
endif
if (cantalk = =true)
display "press e to talk"
if (cantalk == true && keypress e == true)
display dialogue
endif
endif
I've got the code for the "e keypress" as a bool flag (same as my movement code) so all i need help with really is the hero location (since im pretty new to lingo) and the && operator.
any links of tips would be greatly appriciated!
edit: actually, i may not need the "and" operator if i nest the second if statement (for the "e keypress") but it might come in handy later if you can tell me! Thanks.
2nd Edit:
Okay, after messing around abit, i've gotten this far:
closeNPC = pHero.worldPosition.y - pNPC.worldPosition.y
trace closeNPC
if (closeNPC < 25) && (closeNPC > -25)
member("talkOverlay").text = "Press SPACEBAR to talk"
end if
the problem is i still can't find out what the and operator is, if there was an easier/efficient way of writing what i've written, and i would have to do this for all the NPC's on the map, so the code is very crude. any help?
another edit: I figured it out >.< && was simply AND. Feel silly that i've done it now. If anyone can make it abit more efficient, i'd still be glad for the help!
I'm having abit of trouble with a 3d game im making. Currently i have models i've created from 3ds max and what i'm trying to do is figure out how to get them to "interact" with one another.
Like for example, in a rpg game where the character the user is controlling is near another character, they can press a button to talk to them.
the logic ive got is:
closeNPC = mathMan.worldposition.x - hero.worldposition.x
if (closeNPC < 30)
cantalk == true
endif
if (cantalk = =true)
display "press e to talk"
if (cantalk == true && keypress e == true)
display dialogue
endif
endif
I've got the code for the "e keypress" as a bool flag (same as my movement code) so all i need help with really is the hero location (since im pretty new to lingo) and the && operator.
any links of tips would be greatly appriciated!
edit: actually, i may not need the "and" operator if i nest the second if statement (for the "e keypress") but it might come in handy later if you can tell me! Thanks.
2nd Edit:
Okay, after messing around abit, i've gotten this far:
closeNPC = pHero.worldPosition.y - pNPC.worldPosition.y
trace closeNPC
if (closeNPC < 25) && (closeNPC > -25)
member("talkOverlay").text = "Press SPACEBAR to talk"
end if
the problem is i still can't find out what the and operator is, if there was an easier/efficient way of writing what i've written, and i would have to do this for all the NPC's on the map, so the code is very crude. any help?
another edit: I figured it out >.< && was simply AND. Feel silly that i've done it now. If anyone can make it abit more efficient, i'd still be glad for the help!
Last edited: