1
2
ID:163527
Aug 21 2007, 4:09 am
|
|
How do I make like a pokemon game (just a example) when I can catch a mob (the mob dissapears) then use a release verb and the mob comes up behind you and follow you? Also how can I make the mob attack a selected target (also how do I select a target)?
|
In response to CrazedHunter
|
|
There we got one thing :P
|
Not many will be willing to offer completed program snippets for you to copy and paste into a project; you should evaluate some demos, tutorials or libraries and take a crack at it, then bring any relevant code problems to the forum. You'll find more are willing to help when you're showing initiative to learn and try it yourself first.
|
In response to Mobius Evalon
|
|
I figured out some parts myself of ways to do it (maybe since it's not tested) but it would just give a whole [dirty word, sorry!] of code that I maybe could avoid :/
I mean I could give the mobs I'm trying to capture a variable like "catch" and when it turns on it will follow the one that catched it. Could someone give me a example code how I define a certain mob from all other? Like mob/M = mob/player, ok there we got that M is a player but that could be any player right? Can I use "usr" and "src" in this situation? Like if "catch" equals 1 then "follow usr"? Well there we go for the catch system :P Will look if I find any libs that maybe can help me with the "select mob" part... EDIT: Nope, didn't find what I looked for :( I get confused with the select part that it should only attack the mob the player choose when "catch" equals 1... And what's this about "when you're showing initiative to learn and try it yourself first." I've tried it myseld, in my mind and I get really confused about everything above...Why would I ask if I didn't want to learn? People ask questions because they don't know the answer...... Sorry if something above was bad wroten since I had a lot on my mind then so I just wrote everything I thought of without no special order. |
In response to Syltmunk
|
|
Show us the code you're trying to make functional and we'll try and help you resolve it. I don't know how to fix your attack code if I can't see it.
|
In response to Evre
|
|
Even thought this should be in code problems....
mob/Monster/Hiroshi_Ghost That's a example but since I don't know things I have to know to make it working I made up some stuffs like "mob_chosen". So what I need there is how to select a mob and how to make the catched mob go and attack the selected mob. |
In response to Syltmunk
|
|
anyone get what I mean?
|
In response to Syltmunk
|
|
Ooof, italian-style code :P
I'll give you a brief example of one way to handle a catch and release system. This is just for illustration, I wouldn't plunk this into your code: mob Follow? |
In response to CriticalBotch
|
|
That's looks good :)
I will try it tomorrow, time for bed :P |
In response to Syltmunk
|
|
tried copy paste but I get "Catch.dm:13:error::invalid expression"
on "chosen.Move(locate(usr.x,usr.y-1,usr.z))" |
In response to Syltmunk
|
|
Well, as I mentioned, I wouldn't just plunk it into your code. The example was for you to see and consider, not for actual use.
Also, if you're trying to emulate the snippet I provided, I will have to borrow from Lummox: No put usr in proc, ungh. I specifically had it set for src, which will always be the mob that the proc belongs to. As for the actual error, I'll have to take another look in a minute. Edit: Looks like the lines under the if statement above the error shouldn't be indented (no idea why I had them that way, my apologies). |
In response to CriticalBotch
|
|
Not following you but that may be because I changed some stuffs in your code so this is how it look for me:
proc/Release() //called to release the chosen Monster |
In response to Syltmunk
|
|
I don't think you're quite getting what I'm saying; you don't want to use the code I provided as an actual system. It was merely meant to illustrate a possible way to do it, and a poor way at that. In the above snippet, reduce the indent under the if(!chosen) return 0 section by one.
Seriously though, read through it and see what the snippet was supposed to do, learn from it, and make your own. Just plugging what I put up into your game will make your game less, not more. |
In response to CriticalBotch
|
|
Yeah I think I will make my own since your example really helped me.
Well it's my own type of combinations so in a way it's still my game :P |
mob If you have any questions or would like me to explain more feel free to ask :) |
In response to Khalamari
|
|
oh....my...god! O.O Will look trough it O.o
|
In response to Khalamari
|
|
I get this error in game >.<
"runtime error: Cannot read null.len proc name: AddPartyMember (/mob/proc/AddPartyMember) usr: the hoisetg (/mob/player/male) src: the hoisetg (/mob/player/male) call stack: the hoisetg (/mob/player/male): AddPartyMember(null) the hoisetg (/mob/player/male): CatchMonster(null) the hoisetg (/mob/player/male): Catch(Hiroshi Ghost (/mob/Monster/Hiroshi_Ghost))" Since I'm not familiar to "len" I don't really know what's wrong. |
In response to Syltmunk
|
|
Look up lists in the reference or in dream maker. The problem is that party isn't initialized (the object is null) so it can't access the len variable (which is the length of the list; see also the length() proc).
|
In response to CriticalBotch
|
|
So how do I fix it?
I want to give party a value? |
1
2
Theres a demo on making a mob follow you.