creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Critter hit script   
Malkin

Malkin
Australia  
Manager


 visit Malkin's website: Malkin's page at CWiki
  10/3/2011

I'm developing a critter hit script and I was hoping to get some opinions as to whether it's in the most efficient format.

This part makes the agent jump a little when it's hit:
scrp 2 15 10854 3
setv va00 rand -10 10
setv velx va00
setv va00 rand -10 -1
setv vely va00


This part reduces pain, fear and anger in the creature that hit the critter.

inst
doif from <> null
targ from
doif crea targ = 1
* REDUCE Pain, Fear and Anger!
driv 0 -0.45
driv 10 -0.35
driv 12 -0.35
endi
endi
endm


Any thoughts?


My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  10/3/2011

Hmm, it also works to do it like this:

scrp 2 15 10854 3
setv va00 rand -10 10
setv va01 rand -10 -1
velo va00 va01


Kind of a minor change though.



 
AquaShee

AquaShee



  10/3/2011

velo rand -10 10 rand -10 -1


More changes!

Other than that, I the script looks fine. :)


The Community Scribble: make (y)our own metaroom!
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  10/3/2011

lol, yeah, that's the next step... :P


 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  10/3/2011

Thanks! :)

Is there any way to make this step more efficient?

doif from <> null
targ from
doif crea targ = 1


My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  10/3/2011

hmm...


doif from <> null
doif crea from = 1
endi


but you're adjusting drives right after that, so you'd have to 'targ from' anyways. So maybe replace the whole sequence with something like this?


inst
doif from ne null
doif crea from eq 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
endi
endm


(I can't remember for certain that "-1 -1" is appropriate but that's how 'urge writ' handles it and I assume it's probably the same.)



 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  10/3/2011

So the -1 business is just to say 'nothing's happening here, move along'? I wish the help guide had that in it!


scrp 2 15 10854 3
velo rand -10 10 rand -10 -1
inst
doif from ne null
doif crea from eq 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
endi
endm


My TCR Norns
 
Papriko
Peppery One

Papriko



  10/4/2011

Why don't you directly use CREA?
doif crea from = 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
In case FROM is NULL, we still don't get any problems, since NULL is not a creature.



Yes, CREA has a NULL-Agent-Handling. I tested it ingame.
outv crea null
0


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  10/18/2011

velo rand -10 10 rand -10 -1
inst
doif from ne null
doif crea from = 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
endi
endm


Is that right?

Or are you trying to say that the first doif checking that from actually IS, could not have to be there?


My TCR Norns
 
Papriko
Peppery One

Papriko



  10/19/2011

Okay, I gonna try to explain it once more:

doif from ne null
doif crea from eq 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
endi
Here you first check if FROM actually exists at all with the first line. In case it exists you go to line two where you check if FROM is a CREA.



doif crea from eq 1
sway writ from 0 -0.45 10 -0.35 12 -0.35 -1 -1
endi
This saves you one DOIF and accordingly some time used to execute your code. Instead of checking if your FROM exists and only looking up whether it is a creature or not, you only check if it is a creature.
When FROM is a NULL agent, then it obviously can not be a creature, so the second piece of code does the same job faster.



Maybe you should ask someone else to make it a bit more clear, I can not explain that awesomely...


Lets play plants! Photosynthesis... Photosynthesis... Photosynthesis...
 
AquaShee

AquaShee



  10/19/2011

While Papriko is right, there's even a more important reason to skip the doif FROM eq NULL part: FROM can never be null, since scripts are always called by another agent. (Perhaps not always but I can't think of any example at all)

I'm not even sure if it is necesary to check the type of agent at all. "stim writ", a similar command, just does nothing on agents that aren't creatures, so "sway writ" might just do nothing as well without throwing any errors.


The Community Scribble: make (y)our own metaroom!
 
Malkin

Malkin

Manager


 visit Malkin's website: Malkin's page at CWiki
  3/7/2012

Is there a way to make the chemicals 'silent' using the sway writ command? If you wanted to have chemicals, and have certain amounts, but not have creatures learning from all of them?

My TCR Norns
 
Ghosthande
Prodigal Sock

Ghosthande


 visit Ghosthande's website: Breeders Beware
  3/7/2012

Do Creatures even learn from chemicals? I was under the impression that in C3/DS they only learned from stimuli.


 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
0 online
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki